mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Fixed https://bugs.eclipse.org/bugs/show_bug.cgi?id=67834. Thanks to Dave for the JUnit test.
This commit is contained in:
parent
0454da5130
commit
59f4a03242
2 changed files with 32 additions and 1 deletions
|
@ -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
|
||||||
|
|
|
@ -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,
|
||||||
|
|
Loading…
Add table
Reference in a new issue