mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Placement New Code Review w/Hoda.
This commit is contained in:
parent
c64fbade9d
commit
d66610119d
2 changed files with 13 additions and 2 deletions
|
@ -512,4 +512,15 @@ public class CompleteParseASTTest extends CompleteParseBaseTest
|
|||
assertFalse( i.hasNext() );
|
||||
}
|
||||
|
||||
public void testNewXReferences() throws Exception
|
||||
{
|
||||
Iterator declarations = parse( "const int max = 5;\n int * x = new int[max];").getDeclarations();
|
||||
IASTVariable max = (IASTVariable) declarations.next();
|
||||
IASTVariable x = (IASTVariable) declarations.next();
|
||||
assertFalse( declarations.hasNext() );
|
||||
assertEquals( callback.getReferences().size(), 1 );
|
||||
IASTVariableReference maxRef = (IASTVariableReference) callback.getReferences().get(0);
|
||||
assertEquals( maxRef.getReferencedElement(), max );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -107,8 +107,8 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
|||
result = startingScope.lookup( firstSymbol.getImage());
|
||||
if( result != null )
|
||||
references.add( createReference( result, firstSymbol.getImage(), firstSymbol.getOffset() ));
|
||||
//else
|
||||
// throw new ASTSemanticException();
|
||||
else
|
||||
throw new ASTSemanticException();
|
||||
}
|
||||
catch (ParserSymbolTableException e)
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue