Skip to content

Commit 17aedcc

Browse files
committed
Use correct filename for tokens from macro
1 parent e41ce63 commit 17aedcc

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/cppconv/dwriter.d

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3036,8 +3036,8 @@ void parseTreeToDCode(T)(ref CodeWriter code, DWriterData data, T tree, immutabl
30363036
if (!hasNewline)
30373037
{
30383038
while (tokens.length && tokens[$ - 1].isWhitespace
3039-
&& (tokens[$ - 1].token.name.startsWith(" ")
3040-
|| tokens[$ - 1].token.name.startsWith("\t")))
3039+
&& (tokens[$ - 1].token.content.startsWith(" ")
3040+
|| tokens[$ - 1].token.content.startsWith("\t")))
30413041
tokens = tokens[0 .. $ - 1];
30423042
}
30433043
writeComments(code, data, tokens);

src/cppconv/macrodeclaration.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ void applyMacroInstances(DWriterData data, Semantic mergedSemantic,
563563
if (macroDeclaration2 is null)
564564
{
565565
tokens = data.sourceTokenManager.sourceTokens[RealFilename(
566-
locationContext.filename)];
566+
locRange.context.filename)];
567567
}
568568
else
569569
{

tests/multifile/testinclude74/testinclude74a.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ import cppconvhelpers;
55
import testinclude74;
66

77
__gshared const(char)* testa = test;
8-
__gshared const(char)* testa2 = mixin(str(q{x/+ char +/y z}));
8+
__gshared const(char)* testa2 = mixin(str(q{x y z}));
99

0 commit comments

Comments
 (0)