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
|
@ -511,5 +511,16 @@ public class CompleteParseASTTest extends CompleteParseBaseTest
|
||||||
IASTVariable variableY = (IASTVariable)i.next();
|
IASTVariable variableY = (IASTVariable)i.next();
|
||||||
assertFalse( i.hasNext() );
|
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());
|
result = startingScope.lookup( firstSymbol.getImage());
|
||||||
if( result != null )
|
if( result != null )
|
||||||
references.add( createReference( result, firstSymbol.getImage(), firstSymbol.getOffset() ));
|
references.add( createReference( result, firstSymbol.getImage(), firstSymbol.getOffset() ));
|
||||||
//else
|
else
|
||||||
// throw new ASTSemanticException();
|
throw new ASTSemanticException();
|
||||||
}
|
}
|
||||||
catch (ParserSymbolTableException e)
|
catch (ParserSymbolTableException e)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue