1
0
Fork 0
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:
John Camelon 2003-08-25 18:19:55 +00:00
parent c64fbade9d
commit d66610119d
2 changed files with 13 additions and 2 deletions

View file

@ -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 );
}
} }

View file

@ -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)
{ {