1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00
This commit is contained in:
John Camelon 2004-06-18 15:49:21 +00:00
parent 0454da5130
commit 59f4a03242
2 changed files with 32 additions and 1 deletions

View file

@ -674,6 +674,29 @@ public class ScannerTestCase extends BaseScannerTest
} }
} }
public void testBug67834() throws Exception {
initializeScanner(
"#if ! BAR\n" + //$NON-NLS-1$
"foo\n" + //$NON-NLS-1$
"#else\n" + //$NON-NLS-1$
"bar\n" + //$NON-NLS-1$
"#endif\n" //$NON-NLS-1$
); //$NON-NLS-1$
validateIdentifier("foo"); //$NON-NLS-1$
validateEOF();
validateBalance();
initializeScanner(
"#if ! (BAR)\n" + //$NON-NLS-1$
"foo\n" + //$NON-NLS-1$
"#else\n" + //$NON-NLS-1$
"bar\n" + //$NON-NLS-1$
"#endif\n" //$NON-NLS-1$
); //$NON-NLS-1$
validateIdentifier("foo"); //$NON-NLS-1$
validateEOF();
validateBalance();
}
public void testPreprocessorMacros() public void testPreprocessorMacros()
{ {
try try

View file

@ -1408,12 +1408,20 @@ public class ExpressionParser implements IExpressionParser, IParserData {
typeId.freeReferences(astFactory.getReferenceManager()); typeId.freeReferences(astFactory.getReferenceManager());
throw bte; throw bte;
} }
mark = null; // clean up mark so that we can garbage collect
if (templateIdScopes != null) { if (templateIdScopes != null) {
templateIdScopes.pop(); templateIdScopes.pop();
popped = true; popped = true;
} }
IASTExpression castExpression = castExpression(scope, kind, key); IASTExpression castExpression = castExpression(scope, kind, key);
if( castExpression != null && castExpression.getExpressionKind() == IASTExpression.Kind.PRIMARY_EMPTY )
{
backup( mark );
if (typeId != null)
typeId.freeReferences(astFactory.getReferenceManager());
return unaryExpression(scope, kind, key);
}
mark = null; // clean up mark so that we can garbage collect
try { try {
return astFactory.createExpression(scope, return astFactory.createExpression(scope,
IASTExpression.Kind.CASTEXPRESSION, castExpression, IASTExpression.Kind.CASTEXPRESSION, castExpression,