Skip to content

Commit

Permalink
fix: [独自ヘッダー]削除対象のエラーを選択する際、ファイル名を照合するように
Browse files Browse the repository at this point in the history
  • Loading branch information
automatic9045 committed Jul 10, 2023
1 parent b9775a6 commit cd575ca
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 3 additions & 1 deletion AtsEx/MapStatements/Header.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,16 @@ internal sealed class Header : IHeader
public Identifier Name { get; }
public string Argument { get; }

public string DefinedFilePath { get; }
public int LineIndex { get; }
public int CharIndex { get; }

public Header(Identifier identifier, string argument, int lineIndex, int charIndex)
public Header(Identifier identifier, string argument, string definedFilePath, int lineIndex, int charIndex)
{
Name = identifier;
Argument = argument;

DefinedFilePath = definedFilePath;
LineIndex = lineIndex;
CharIndex = charIndex;
}
Expand Down
4 changes: 3 additions & 1 deletion AtsEx/MapStatements/HeaderErrorResolver.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
Expand Down Expand Up @@ -31,7 +32,8 @@ public void Resolve()
{
IEnumerable<LoadError> removeTargetErrors = LoadErrorManager.Errors.Where(error =>
{
bool isTargetError = Headers.Any(header => header.LineIndex == error.LineIndex && header.CharIndex == error.CharIndex);
bool isTargetError = Headers.Any(header
=> Path.GetFileName(header.DefinedFilePath).ToLowerInvariant() == error.SenderFileName.ToLowerInvariant() && header.LineIndex == error.LineIndex && header.CharIndex == error.CharIndex);
return isTargetError;
});
foreach (LoadError error in removeTargetErrors)
Expand Down
4 changes: 2 additions & 2 deletions AtsEx/MapStatements/HeaderSet.Factory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ private static (IDictionary<Identifier, IReadOnlyList<Header>> Headers, IReadOnl
string headerArgument = includePath.Substring(headerCloseBracketIndex + HeaderNameCloseBracket.Length);

Identifier identifier = Identifier.Parse(headerFullName);
Header header = new Header(identifier, headerArgument, s.LineIndex, s.CharIndex);
Header header = new Header(identifier, headerArgument, filePath, s.LineIndex, s.CharIndex);
if (header.Name.Namespace is null || !header.Name.Namespace.IsChildOf(Namespace.Root)) continue;

List<Header> list = headers.GetOrAdd(identifier, new List<Header>()) as List<Header>;
Expand All @@ -81,7 +81,7 @@ private static (IDictionary<Identifier, IReadOnlyList<Header>> Headers, IReadOnl
{
string headerArgument = includePath.Substring(NoMapPluginHeaderFullName.Length);

Header header = new Header(NoMapPluginHeader, headerArgument, s.LineIndex, s.CharIndex);
Header header = new Header(NoMapPluginHeader, headerArgument, filePath, s.LineIndex, s.CharIndex);
noMapPluginHeaders.Add(header);
}
else if (includePath.StartsWith(ReadDepthHeaderFullName))
Expand Down

0 comments on commit cd575ca

Please sign in to comment.