Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Camelon2003-08-25 14:19:55 -0400
committerJohn Camelon2003-08-25 14:19:55 -0400
commitd66610119d5afd2b1141cb06c09ad1f200a54815 (patch)
tree4eb004d5e602aba25585a3f784bfcef61567343d
parentc64fbade9d8e4ce903b0e5b6137078ec50234ea9 (diff)
downloadorg.eclipse.cdt-d66610119d5afd2b1141cb06c09ad1f200a54815.tar.gz
org.eclipse.cdt-d66610119d5afd2b1141cb06c09ad1f200a54815.tar.xz
org.eclipse.cdt-d66610119d5afd2b1141cb06c09ad1f200a54815.zip
Placement New Code Review w/Hoda.
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTTest.java11
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java4
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)
{

Back to the top