mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-09 09:15:38 +02:00
Patch for Devin Steffler.
Further updates to DOM AST View.
This commit is contained in:
parent
6ac6636352
commit
508ff688b8
2 changed files with 11 additions and 13 deletions
|
@ -832,8 +832,9 @@ public class AST2Tests extends AST2BaseTest {
|
|||
|
||||
// test tu.getDeclarations(IBinding)
|
||||
IASTName[] decls = tu.getDeclarations(f_name1.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls.length, 2);
|
||||
assertEquals(decls[0], f_name1);
|
||||
assertEquals(decls[1], f_name2);
|
||||
|
||||
decls = tu.getDeclarations(name_param1.resolveBinding());
|
||||
assertEquals(decls.length, 2);
|
||||
|
@ -841,8 +842,9 @@ public class AST2Tests extends AST2BaseTest {
|
|||
assertEquals(decls[1], name_param2);
|
||||
|
||||
decls = tu.getDeclarations(f_name2.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls.length, 2);
|
||||
assertEquals(decls[0], f_name1);
|
||||
assertEquals(decls[1], f_name2);
|
||||
|
||||
decls = tu.getDeclarations(name_param2.resolveBinding());
|
||||
assertEquals(decls.length, 2);
|
||||
|
@ -944,8 +946,9 @@ public class AST2Tests extends AST2BaseTest {
|
|||
|
||||
// test tu.getDeclarations(IBinding)
|
||||
IASTName[] decls = tu.getDeclarations(name_f.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls.length, 2);
|
||||
assertEquals(decls[0], name_f);
|
||||
assertEquals(decls[1], name_fdef);
|
||||
|
||||
decls = tu.getDeclarations(gdef.getDeclarator().getName()
|
||||
.resolveBinding());
|
||||
|
@ -953,12 +956,14 @@ public class AST2Tests extends AST2BaseTest {
|
|||
assertEquals(decls[0], gdef.getDeclarator().getName());
|
||||
|
||||
decls = tu.getDeclarations(name_fcall.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls.length, 2);
|
||||
assertEquals(decls[0], name_f);
|
||||
assertEquals(decls[1], name_fdef);
|
||||
|
||||
decls = tu.getDeclarations(name_fdef.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls.length, 2);
|
||||
assertEquals(decls[0], name_f);
|
||||
assertEquals(decls[1], name_fdef);
|
||||
}
|
||||
|
||||
public void testForLoop() throws Exception {
|
||||
|
|
|
@ -250,7 +250,6 @@ public class CVisitor {
|
|||
private IASTName[] declsFound = null;
|
||||
int numFound = 0;
|
||||
IBinding binding = null;
|
||||
boolean functionDeclared = false;
|
||||
boolean compositeTypeDeclared = false;
|
||||
|
||||
private void addName(IASTName name) {
|
||||
|
@ -304,9 +303,8 @@ public class CVisitor {
|
|||
parent = parent.getParent();
|
||||
|
||||
if ( parent instanceof IASTDeclaration ) {
|
||||
if ( !functionDeclared && parent != null && parent instanceof IASTFunctionDefinition ) {
|
||||
if ( parent != null && parent instanceof IASTFunctionDefinition ) {
|
||||
if ( declarator.getName() != null && declarator.getName().resolveBinding() == binding ) {
|
||||
functionDeclared = true;
|
||||
addName(declarator.getName());
|
||||
}
|
||||
} else if ( parent instanceof IASTSimpleDeclaration ) {
|
||||
|
@ -315,11 +313,6 @@ public class CVisitor {
|
|||
return PROCESS_CONTINUE;
|
||||
|
||||
if ( (declarator.getName() != null && declarator.getName().resolveBinding() == binding) ) {
|
||||
if ( declarator instanceof IASTStandardFunctionDeclarator ||
|
||||
declarator instanceof ICASTKnRFunctionDeclarator ) {
|
||||
functionDeclared = true;
|
||||
}
|
||||
|
||||
addName(declarator.getName());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue