1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 10:16:03 +02:00
Also added 2 JUnit tests to verify.
This commit is contained in:
John Camelon 2004-06-17 16:11:07 +00:00
parent 2b26b06747
commit 6f1acede84
4 changed files with 18 additions and 3 deletions

View file

@ -1942,4 +1942,9 @@ public class CompleteParseASTTest extends CompleteParseBaseTest
writer.write("}\n"); //$NON-NLS-1$
parse( writer.toString() );
}
public void testBug67622() throws Exception
{
parse( "const char * x = __FILE__;"); //$NON-NLS-1$
}
}

View file

@ -2247,7 +2247,11 @@ public class QuickParseASTTests extends BaseASTTest
public void testBadIdentifier() throws Exception
{
parse( "class 0302 { private: int stinks; };", true, false ); //$NON-NLS-1$
parse( "class 0302 { private: int stinks; };", true, false ); //$NON-NLS-1$
}
public void testBug67622() throws Exception
{
parse( "const char * x = __FILE__;"); //$NON-NLS-1$
}
}

View file

@ -276,7 +276,12 @@ public final class Scanner implements IScanner, IScannerData {
addDefinition( __FILE__,
new DynamicMacroDescriptor( __FILE__, new DynamicMacroEvaluator() {
public String execute() {
return contextStack.getMostRelevantFileContext().getContextName();
String fName = contextStack.getMostRelevantFileContext().getContextName();
StringBuffer buff = new StringBuffer(fName.length() + 2);
buff.append('"');
buff.append(fName);
buff.append('"');
return buff.toString();
}
} ) );

View file

@ -63,6 +63,7 @@ public class ScannerContextInclusion implements IScannerContext
*/
public void ungetChar(int undo) {
--offset;
if (undo == '\n') line--;
}
/**