From d66610119d5afd2b1141cb06c09ad1f200a54815 Mon Sep 17 00:00:00 2001 From: John Camelon Date: Mon, 25 Aug 2003 18:19:55 +0000 Subject: [PATCH] Placement New Code Review w/Hoda. --- .../cdt/core/parser/tests/CompleteParseASTTest.java | 11 +++++++++++ .../parser/ast/complete/CompleteParseASTFactory.java | 4 ++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTTest.java index f7e05d59452..cea6b8eb3fb 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTTest.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTTest.java @@ -511,5 +511,16 @@ public class CompleteParseASTTest extends CompleteParseBaseTest IASTVariable variableY = (IASTVariable)i.next(); 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 ); + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java index 8b13bbd2890..c8e5820dbd9 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java @@ -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) {