mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
Separates PDOM from IASTName and IASTTranslationUnit, see bug 149565.
This commit is contained in:
parent
196254955b
commit
75cbff035e
48 changed files with 637 additions and 796 deletions
|
@ -2496,15 +2496,15 @@ public class AST2CPPTests extends AST2BaseTest {
|
|||
assertEquals(s[0], "RED"); //$NON-NLS-1$
|
||||
assertTrue(((ICPPBinding) RED).isGloballyQualified());
|
||||
|
||||
IASTName[] decls = tu.getDeclarations(enum_x);
|
||||
IASTName[] decls = tu.getDeclarationsInAST(enum_x);
|
||||
assertEquals(decls.length, 1);
|
||||
assertSame(decls[0], col.getName(3));
|
||||
|
||||
decls = tu.getDeclarations(x_ref);
|
||||
decls = tu.getDeclarationsInAST(x_ref);
|
||||
assertEquals(decls.length, 1);
|
||||
assertSame(decls[0], col.getName(1));
|
||||
|
||||
decls = tu.getDeclarations(RED);
|
||||
decls = tu.getDeclarationsInAST(RED);
|
||||
assertEquals(decls.length, 1);
|
||||
assertSame(decls[0], col.getName(6));
|
||||
}
|
||||
|
@ -2592,7 +2592,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
|||
ICPPFunction f2 = (ICPPFunction) col.getName(5).resolveBinding();
|
||||
assertSame(f1, f2);
|
||||
|
||||
IASTName[] decls = tu.getDeclarations(f2);
|
||||
IASTName[] decls = tu.getDeclarationsInAST(f2);
|
||||
assertEquals(decls.length, 2);
|
||||
assertSame(decls[0], col.getName(2));
|
||||
assertSame(decls[1], col.getName(5));
|
||||
|
@ -2671,7 +2671,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
|||
assertSame(refs[0], col.getName(2));
|
||||
assertSame(refs[1], col.getName(4));
|
||||
|
||||
IASTName[] decls = tu.getDeclarations(ns);
|
||||
IASTName[] decls = tu.getDeclarationsInAST(ns);
|
||||
assertEquals(decls.length, 1);
|
||||
assertSame(decls[0], col.getName(0));
|
||||
|
||||
|
@ -2679,7 +2679,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
|||
assertEquals(refs.length, 1);
|
||||
assertSame(refs[0], col.getName(6));
|
||||
|
||||
decls = tu.getDeclarations(alias);
|
||||
decls = tu.getDeclarationsInAST(alias);
|
||||
assertEquals(decls.length, 3);
|
||||
assertSame(decls[0], col.getName(1));
|
||||
assertSame(decls[1], col.getName(3));
|
||||
|
@ -2701,7 +2701,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
|||
ICPPUsingDeclaration u = (ICPPUsingDeclaration) col.getName(7)
|
||||
.resolveBinding();
|
||||
|
||||
IASTName[] decls = tu.getDeclarations(u);
|
||||
IASTName[] decls = tu.getDeclarationsInAST(u);
|
||||
assertEquals(decls.length, 2);
|
||||
assertSame(decls[0], col.getName(1));
|
||||
assertSame(decls[1], col.getName(3));
|
||||
|
@ -2709,11 +2709,11 @@ public class AST2CPPTests extends AST2BaseTest {
|
|||
ICPPDelegate[] delegates = u.getDelegates();
|
||||
assertEquals(delegates.length, 2);
|
||||
|
||||
decls = tu.getDeclarations(delegates[0]);
|
||||
decls = tu.getDeclarationsInAST(delegates[0]);
|
||||
assertEquals(decls.length, 1);
|
||||
assertSame(decls[0], col.getName(7));
|
||||
|
||||
decls = tu.getDeclarations(delegates[0].getBinding());
|
||||
decls = tu.getDeclarationsInAST(delegates[0].getBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertSame(decls[0], col.getName(1));
|
||||
}
|
||||
|
@ -2776,7 +2776,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
|||
|
||||
ICPPUsingDeclaration comp = (ICPPUsingDeclaration) col.getName(7)
|
||||
.resolveBinding();
|
||||
IASTName[] decls = tu.getDeclarations(comp);
|
||||
IASTName[] decls = tu.getDeclarationsInAST(comp);
|
||||
assertEquals(decls.length, 2);
|
||||
assertSame(decls[0], col.getName(1));
|
||||
assertSame(decls[1], col.getName(2));
|
||||
|
|
|
@ -80,8 +80,8 @@ public class AST2KnRTests extends AST2BaseTest {
|
|||
assertEquals( x2, x3 );
|
||||
assertEquals( x3, x4 );
|
||||
|
||||
// test tu.getDeclarations(IBinding)
|
||||
IASTName[] decls = tu.getDeclarations(x1);
|
||||
// test tu.getDeclarationsInAST(IBinding)
|
||||
IASTName[] decls = tu.getDeclarationsInAST(x1);
|
||||
assertEquals( decls.length, 2 );
|
||||
assertEquals( decls[0], ((IASTStandardFunctionDeclarator)f1.getDeclarators()[0]).getParameters()[0].getDeclarator().getName() );
|
||||
assertEquals( decls[1], ((IASTSimpleDeclaration)((ICASTKnRFunctionDeclarator)f2.getDeclarator()).getParameterDeclarations()[0]).getDeclarators()[0].getName() );
|
||||
|
@ -116,8 +116,8 @@ public class AST2KnRTests extends AST2BaseTest {
|
|||
assertEquals( x2, x3 );
|
||||
assertEquals( x3, x4 );
|
||||
|
||||
// test tu.getDeclarations(IBinding)
|
||||
IASTName[] decls = tu.getDeclarations(x2);
|
||||
// test tu.getDeclarationsInAST(IBinding)
|
||||
IASTName[] decls = tu.getDeclarationsInAST(x2);
|
||||
assertEquals( decls.length, 1 );
|
||||
assertEquals( decls[0], ((IASTSimpleDeclaration)((ICASTKnRFunctionDeclarator)f2.getDeclarator()).getParameterDeclarations()[0]).getDeclarators()[0].getName() );
|
||||
|
||||
|
@ -188,8 +188,8 @@ public class AST2KnRTests extends AST2BaseTest {
|
|||
assertEquals( y_parm, y_parm2 );
|
||||
assertEquals( ret_x.resolveBinding(), x_parm );
|
||||
|
||||
// test tu.getDeclarations(IBinding)
|
||||
IASTName[] decls = tu.getDeclarations(ret_x.resolveBinding());
|
||||
// test tu.getDeclarationsInAST(IBinding)
|
||||
IASTName[] decls = tu.getDeclarationsInAST(ret_x.resolveBinding());
|
||||
assertEquals( decls.length, 1 );
|
||||
assertEquals( decls[0], x1.getName() );
|
||||
|
||||
|
@ -247,8 +247,8 @@ public class AST2KnRTests extends AST2BaseTest {
|
|||
assertTrue(c1_t.getType() instanceof IBasicType);
|
||||
assertEquals(((IBasicType)c1_t.getType()).getType(), IBasicType.t_char);
|
||||
|
||||
// test tu.getDeclarations(IBinding)
|
||||
IASTName[] decls = tu.getDeclarations(x3.resolveBinding());
|
||||
// test tu.getDeclarationsInAST(IBinding)
|
||||
IASTName[] decls = tu.getDeclarationsInAST(x3.resolveBinding());
|
||||
assertEquals( decls.length, 1 );
|
||||
assertEquals( decls[0], x2 );
|
||||
|
||||
|
@ -301,8 +301,8 @@ public class AST2KnRTests extends AST2BaseTest {
|
|||
assertTrue(((IASTBinaryExpression)((IASTReturnStatement)((IASTCompoundStatement)f.getBody()).getStatements()[0]).getReturnValue()).getOperand2() instanceof IASTLiteralExpression);
|
||||
assertEquals(((IASTLiteralExpression)((IASTBinaryExpression)((IASTReturnStatement)((IASTCompoundStatement)f.getBody()).getStatements()[0]).getReturnValue()).getOperand2()).toString(), "0"); //$NON-NLS-1$
|
||||
|
||||
// test tu.getDeclarations(IBinding)
|
||||
IASTName[] decls = tu.getDeclarations(((IASTIdExpression)((IASTBinaryExpression)((IASTReturnStatement)((IASTCompoundStatement)f.getBody()).getStatements()[0]).getReturnValue()).getOperand1()).getName().resolveBinding());
|
||||
// test tu.getDeclarationsInAST(IBinding)
|
||||
IASTName[] decls = tu.getDeclarationsInAST(((IASTIdExpression)((IASTBinaryExpression)((IASTReturnStatement)((IASTCompoundStatement)f.getBody()).getStatements()[0]).getReturnValue()).getOperand1()).getName().resolveBinding());
|
||||
assertEquals( decls.length, 0 );
|
||||
}
|
||||
|
||||
|
@ -349,8 +349,8 @@ public class AST2KnRTests extends AST2BaseTest {
|
|||
assertEquals(y1_parm, y2_parm);
|
||||
assertEquals(z1_parm, z2_parm);
|
||||
|
||||
// test tu.getDeclarations(IBinding)
|
||||
IASTName[] decls = tu.getDeclarations(((IASTIdExpression)((IASTBinaryExpression)((IASTReturnStatement)((IASTCompoundStatement)f.getBody()).getStatements()[0]).getReturnValue()).getOperand1()).getName().resolveBinding());
|
||||
// test tu.getDeclarationsInAST(IBinding)
|
||||
IASTName[] decls = tu.getDeclarationsInAST(((IASTIdExpression)((IASTBinaryExpression)((IASTReturnStatement)((IASTCompoundStatement)f.getBody()).getStatements()[0]).getReturnValue()).getOperand1()).getName().resolveBinding());
|
||||
assertEquals( decls.length, 1 );
|
||||
assertEquals( decls[0], x2 );
|
||||
|
||||
|
@ -376,8 +376,8 @@ public class AST2KnRTests extends AST2BaseTest {
|
|||
assertTrue(((IASTBinaryExpression)((IASTReturnStatement)((IASTCompoundStatement)f.getBody()).getStatements()[0]).getReturnValue()).getOperand2() instanceof IASTLiteralExpression);
|
||||
assertEquals(((IASTLiteralExpression)((IASTBinaryExpression)((IASTReturnStatement)((IASTCompoundStatement)f.getBody()).getStatements()[0]).getReturnValue()).getOperand2()).toString(), "0"); //$NON-NLS-1$
|
||||
|
||||
// test tu.getDeclarations(IBinding)
|
||||
IASTName[] decls = tu.getDeclarations(((IASTIdExpression)((IASTBinaryExpression)((IASTReturnStatement)((IASTCompoundStatement)f.getBody()).getStatements()[0]).getReturnValue()).getOperand1()).getName().resolveBinding());
|
||||
// test tu.getDeclarationsInAST(IBinding)
|
||||
IASTName[] decls = tu.getDeclarationsInAST(((IASTIdExpression)((IASTBinaryExpression)((IASTReturnStatement)((IASTCompoundStatement)f.getBody()).getStatements()[0]).getReturnValue()).getOperand1()).getName().resolveBinding());
|
||||
assertEquals( decls.length, 0 );
|
||||
}
|
||||
|
||||
|
@ -496,8 +496,8 @@ public class AST2KnRTests extends AST2BaseTest {
|
|||
IParameter[] f1_parms = f_fun1.getParameters();
|
||||
assertEquals( f1_parms.length, 1 );
|
||||
|
||||
// test tu.getDeclarations(IBinding)
|
||||
IASTName[] decls = tu.getDeclarations(x2.resolveBinding());
|
||||
// test tu.getDeclarationsInAST(IBinding)
|
||||
IASTName[] decls = tu.getDeclarationsInAST(x2.resolveBinding());
|
||||
assertEquals( decls.length, 1 );
|
||||
assertEquals( decls[0], x2 );
|
||||
|
||||
|
@ -544,12 +544,12 @@ public class AST2KnRTests extends AST2BaseTest {
|
|||
assertNull( list.getArrayModifiers()[0].getConstantExpression() );
|
||||
assertEquals( list.getPointerOperators().length, 1 );
|
||||
|
||||
// test tu.getDeclarations(IBinding)
|
||||
IASTName[] decls = tu.getDeclarations(list3.resolveBinding());
|
||||
// test tu.getDeclarationsInAST(IBinding)
|
||||
IASTName[] decls = tu.getDeclarationsInAST(list3.resolveBinding());
|
||||
assertEquals( decls.length, 1 );
|
||||
assertEquals( decls[0], list2 );
|
||||
|
||||
decls = tu.getDeclarations(prompt1.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(prompt1.resolveBinding());
|
||||
assertEquals( decls.length, 1 );
|
||||
assertEquals( decls[0], prompt2 );
|
||||
}
|
||||
|
|
|
@ -228,28 +228,28 @@ public class AST2Tests extends AST2BaseTest {
|
|||
assertEquals(var_x, name_ref_x.resolveBinding());
|
||||
assertEquals(var_y, name_ref_y.resolveBinding());
|
||||
|
||||
// test tu.getDeclarations(IBinding)
|
||||
IASTName[] decls = tu.getDeclarations(name_x.resolveBinding());
|
||||
// test tu.getDeclarationsInAST(IBinding)
|
||||
IASTName[] decls = tu.getDeclarationsInAST(name_x.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_x);
|
||||
|
||||
decls = tu.getDeclarations(name_f.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(name_f.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_f);
|
||||
|
||||
decls = tu.getDeclarations(name_y.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(name_y.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_y);
|
||||
|
||||
decls = tu.getDeclarations(name_z.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(name_z.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_z);
|
||||
|
||||
decls = tu.getDeclarations(name_ref_x.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(name_ref_x.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_x);
|
||||
|
||||
decls = tu.getDeclarations(name_ref_y.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(name_ref_y.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_y);
|
||||
|
||||
|
@ -375,33 +375,33 @@ public class AST2Tests extends AST2BaseTest {
|
|||
IField field_x = (IField) name_x.resolveBinding();
|
||||
assertEquals(field_x, fieldref.getFieldName().resolveBinding());
|
||||
|
||||
// test tu.getDeclarations(IBinding)
|
||||
IASTName[] decls = tu.getDeclarations(name_struct.resolveBinding());
|
||||
// test tu.getDeclarationsInAST(IBinding)
|
||||
IASTName[] decls = tu.getDeclarationsInAST(name_struct.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_struct);
|
||||
|
||||
decls = tu.getDeclarations(name_x.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(name_x.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_x);
|
||||
|
||||
decls = tu.getDeclarations(def_f.getDeclarator().getName()
|
||||
decls = tu.getDeclarationsInAST(def_f.getDeclarator().getName()
|
||||
.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], def_f.getDeclarator().getName());
|
||||
|
||||
decls = tu.getDeclarations(name_S.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(name_S.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_S);
|
||||
|
||||
decls = tu.getDeclarations(name_myS.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(name_myS.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_myS);
|
||||
|
||||
decls = tu.getDeclarations(ref_myS.getName().resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(ref_myS.getName().resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_myS);
|
||||
|
||||
decls = tu.getDeclarations(fieldref.getFieldName().resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(fieldref.getFieldName().resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_x);
|
||||
}
|
||||
|
@ -491,12 +491,12 @@ public class AST2Tests extends AST2BaseTest {
|
|||
assertEquals(name1.resolveBinding().getName(), "r"); //$NON-NLS-1$
|
||||
assertEquals(name2.resolveBinding().getName(), "s"); //$NON-NLS-1$
|
||||
|
||||
// test tu.getDeclarations(IBinding)
|
||||
IASTName[] decls = tu.getDeclarations(name1.resolveBinding());
|
||||
// test tu.getDeclarationsInAST(IBinding)
|
||||
IASTName[] decls = tu.getDeclarationsInAST(name1.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name1);
|
||||
|
||||
decls = tu.getDeclarations(name2.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(name2.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name2);
|
||||
}
|
||||
|
@ -562,25 +562,25 @@ public class AST2Tests extends AST2BaseTest {
|
|||
assertSame(str2, str3);
|
||||
assertSame(str3, str4);
|
||||
|
||||
// test tu.getDeclarations(IBinding)
|
||||
IASTName[] decls = tu.getDeclarations(nameA1.resolveBinding());
|
||||
// test tu.getDeclarationsInAST(IBinding)
|
||||
IASTName[] decls = tu.getDeclarationsInAST(nameA1.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], nameA1);
|
||||
|
||||
decls = tu.getDeclarations(fndef.getDeclarator().getName()
|
||||
decls = tu.getDeclarationsInAST(fndef.getDeclarator().getName()
|
||||
.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], fndef.getDeclarator().getName());
|
||||
|
||||
decls = tu.getDeclarations(nameA2.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(nameA2.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], nameA2);
|
||||
|
||||
decls = tu.getDeclarations(nameA3.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(nameA3.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], nameA2);
|
||||
|
||||
decls = tu.getDeclarations(namea.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(namea.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], namea);
|
||||
}
|
||||
|
@ -631,21 +631,21 @@ public class AST2Tests extends AST2BaseTest {
|
|||
assertSame(str1, str2);
|
||||
assertSame(str2, str3);
|
||||
|
||||
// test tu.getDeclarations(IBinding)
|
||||
IASTName[] decls = tu.getDeclarations(nameA1.resolveBinding());
|
||||
// test tu.getDeclarationsInAST(IBinding)
|
||||
IASTName[] decls = tu.getDeclarationsInAST(nameA1.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], nameA1);
|
||||
|
||||
decls = tu.getDeclarations(fndef.getDeclarator().getName()
|
||||
decls = tu.getDeclarationsInAST(fndef.getDeclarator().getName()
|
||||
.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], fndef.getDeclarator().getName());
|
||||
|
||||
decls = tu.getDeclarations(nameA2.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(nameA2.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], nameA1);
|
||||
|
||||
decls = tu.getDeclarations(namea.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(namea.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], namea);
|
||||
}
|
||||
|
@ -726,40 +726,40 @@ public class AST2Tests extends AST2BaseTest {
|
|||
assertSame(structA_2, structA_3);
|
||||
assertSame(structA_3, structA_4);
|
||||
|
||||
// test tu.getDeclarations(IBinding)
|
||||
IASTName[] decls = tu.getDeclarations(name_A1.resolveBinding());
|
||||
// test tu.getDeclarationsInAST(IBinding)
|
||||
IASTName[] decls = tu.getDeclarationsInAST(name_A1.resolveBinding());
|
||||
assertEquals(decls.length, 2);
|
||||
assertEquals(decls[0], name_A1);
|
||||
assertEquals(decls[1], name_Adef);
|
||||
|
||||
decls = tu.getDeclarations(name_A2.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(name_A2.resolveBinding());
|
||||
assertEquals(decls.length, 2);
|
||||
assertEquals(decls[0], name_A1);
|
||||
assertEquals(decls[1], name_Adef);
|
||||
|
||||
decls = tu.getDeclarations(name_a.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(name_a.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_a);
|
||||
|
||||
decls = tu.getDeclarations(name_Adef.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(name_Adef.resolveBinding());
|
||||
assertEquals(decls.length, 2);
|
||||
assertEquals(decls[0], name_A1);
|
||||
assertEquals(decls[1], name_Adef);
|
||||
|
||||
decls = tu.getDeclarations(name_i.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(name_i.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_i);
|
||||
|
||||
decls = tu.getDeclarations(fndef.getDeclarator().getName()
|
||||
decls = tu.getDeclarationsInAST(fndef.getDeclarator().getName()
|
||||
.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], fndef.getDeclarator().getName());
|
||||
|
||||
decls = tu.getDeclarations(name_aref.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(name_aref.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_a);
|
||||
|
||||
decls = tu.getDeclarations(name_iref.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(name_iref.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_i);
|
||||
}
|
||||
|
@ -807,25 +807,25 @@ public class AST2Tests extends AST2BaseTest {
|
|||
IASTDeclarator decl_i = declaration2.getDeclarators()[0];
|
||||
decl_i.getName().resolveBinding(); // add i's binding to the scope
|
||||
|
||||
// test tu.getDeclarations(IBinding)
|
||||
IASTName[] decls = tu.getDeclarations(x_1.resolveBinding());
|
||||
// test tu.getDeclarationsInAST(IBinding)
|
||||
IASTName[] decls = tu.getDeclarationsInAST(x_1.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], x_1);
|
||||
|
||||
decls = tu.getDeclarations(fdef.getDeclarator().getName()
|
||||
decls = tu.getDeclarationsInAST(fdef.getDeclarator().getName()
|
||||
.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], fdef.getDeclarator().getName());
|
||||
|
||||
decls = tu.getDeclarations(x_2.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(x_2.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], x_2);
|
||||
|
||||
decls = tu.getDeclarations(x_3.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(x_3.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], x_1);
|
||||
|
||||
decls = tu.getDeclarations(declaration2.getDeclarators()[0].getName()
|
||||
decls = tu.getDeclarationsInAST(declaration2.getDeclarators()[0].getName()
|
||||
.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], declaration2.getDeclarators()[0].getName());
|
||||
|
@ -922,23 +922,23 @@ public class AST2Tests extends AST2BaseTest {
|
|||
assertSame(param_2, param_3);
|
||||
assertSame(f_1, f_2);
|
||||
|
||||
// test tu.getDeclarations(IBinding)
|
||||
IASTName[] decls = tu.getDeclarations(f_name1.resolveBinding());
|
||||
// test tu.getDeclarationsInAST(IBinding)
|
||||
IASTName[] decls = tu.getDeclarationsInAST(f_name1.resolveBinding());
|
||||
assertEquals(decls.length, 2);
|
||||
assertEquals(decls[0], f_name1);
|
||||
assertEquals(decls[1], f_name2);
|
||||
|
||||
decls = tu.getDeclarations(name_param1.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(name_param1.resolveBinding());
|
||||
assertEquals(decls.length, 2);
|
||||
assertEquals(decls[0], name_param1);
|
||||
assertEquals(decls[1], name_param2);
|
||||
|
||||
decls = tu.getDeclarations(f_name2.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(f_name2.resolveBinding());
|
||||
assertEquals(decls.length, 2);
|
||||
assertEquals(decls[0], f_name1);
|
||||
assertEquals(decls[1], f_name2);
|
||||
|
||||
decls = tu.getDeclarations(name_param2.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(name_param2.resolveBinding());
|
||||
assertEquals(decls.length, 2);
|
||||
assertEquals(decls[0], name_param1);
|
||||
assertEquals(decls[1], name_param2);
|
||||
|
@ -974,16 +974,16 @@ public class AST2Tests extends AST2BaseTest {
|
|||
assertSame(params[0], param_a);
|
||||
assertSame(params[1], param_b);
|
||||
|
||||
// test tu.getDeclarations(IBinding)
|
||||
IASTName[] decls = tu.getDeclarations(fName.resolveBinding());
|
||||
// test tu.getDeclarationsInAST(IBinding)
|
||||
IASTName[] decls = tu.getDeclarationsInAST(fName.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], fName);
|
||||
|
||||
decls = tu.getDeclarations(name_a.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(name_a.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_a);
|
||||
|
||||
decls = tu.getDeclarations(name_b.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(name_b.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_b);
|
||||
}
|
||||
|
@ -1036,23 +1036,23 @@ public class AST2Tests extends AST2BaseTest {
|
|||
assertSame(function_1, function_2);
|
||||
assertSame(function_2, function_3);
|
||||
|
||||
// test tu.getDeclarations(IBinding)
|
||||
IASTName[] decls = tu.getDeclarations(name_f.resolveBinding());
|
||||
// test tu.getDeclarationsInAST(IBinding)
|
||||
IASTName[] decls = tu.getDeclarationsInAST(name_f.resolveBinding());
|
||||
assertEquals(decls.length, 2);
|
||||
assertEquals(decls[0], name_f);
|
||||
assertEquals(decls[1], name_fdef);
|
||||
|
||||
decls = tu.getDeclarations(gdef.getDeclarator().getName()
|
||||
decls = tu.getDeclarationsInAST(gdef.getDeclarator().getName()
|
||||
.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], gdef.getDeclarator().getName());
|
||||
|
||||
decls = tu.getDeclarations(name_fcall.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(name_fcall.resolveBinding());
|
||||
assertEquals(decls.length, 2);
|
||||
assertEquals(decls[0], name_f);
|
||||
assertEquals(decls[1], name_fdef);
|
||||
|
||||
decls = tu.getDeclarations(name_fdef.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(name_fdef.resolveBinding());
|
||||
assertEquals(decls.length, 2);
|
||||
assertEquals(decls[0], name_f);
|
||||
assertEquals(decls[1], name_fdef);
|
||||
|
@ -1112,25 +1112,25 @@ public class AST2Tests extends AST2BaseTest {
|
|||
assertSame(var_2, var_3);
|
||||
assertSame(var_3, var_4);
|
||||
|
||||
// test tu.getDeclarations(IBinding)
|
||||
IASTName[] decls = tu.getDeclarations(fdef.getDeclarator().getName()
|
||||
// test tu.getDeclarationsInAST(IBinding)
|
||||
IASTName[] decls = tu.getDeclarationsInAST(fdef.getDeclarator().getName()
|
||||
.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], fdef.getDeclarator().getName());
|
||||
|
||||
decls = tu.getDeclarations(name_i.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(name_i.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_i);
|
||||
|
||||
decls = tu.getDeclarations(name_i2.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(name_i2.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_i);
|
||||
|
||||
decls = tu.getDeclarations(name_i3.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(name_i3.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_i);
|
||||
|
||||
decls = tu.getDeclarations(name_i4.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(name_i4.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_i);
|
||||
}
|
||||
|
@ -1166,17 +1166,17 @@ public class AST2Tests extends AST2BaseTest {
|
|||
assertNotNull(x1);
|
||||
assertSame(x1, x2);
|
||||
|
||||
// test tu.getDeclarations(IBinding)
|
||||
IASTName[] decls = tu.getDeclarations(compType.getName()
|
||||
// test tu.getDeclarationsInAST(IBinding)
|
||||
IASTName[] decls = tu.getDeclarationsInAST(compType.getName()
|
||||
.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], compType.getName());
|
||||
|
||||
decls = tu.getDeclarations(name_x1.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(name_x1.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_x1);
|
||||
|
||||
decls = tu.getDeclarations(fdef.getDeclarator().getName()
|
||||
decls = tu.getDeclarationsInAST(fdef.getDeclarator().getName()
|
||||
.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], fdef.getDeclarator().getName());
|
||||
|
@ -1185,12 +1185,12 @@ public class AST2Tests extends AST2BaseTest {
|
|||
.getExpression()).getFieldOwner()).getOperand();
|
||||
IASTElaboratedTypeSpecifier elaboratedTypeSpecifier = ((IASTElaboratedTypeSpecifier) castExpression
|
||||
.getTypeId().getDeclSpecifier());
|
||||
decls = tu.getDeclarations(elaboratedTypeSpecifier.getName()
|
||||
decls = tu.getDeclarationsInAST(elaboratedTypeSpecifier.getName()
|
||||
.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], compType.getName());
|
||||
|
||||
decls = tu.getDeclarations(name_x2.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(name_x2.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_x1);
|
||||
}
|
||||
|
@ -1218,17 +1218,17 @@ public class AST2Tests extends AST2BaseTest {
|
|||
assertNotNull(label_1);
|
||||
assertEquals(label_1, label_2);
|
||||
|
||||
// test tu.getDeclarations(IBinding)
|
||||
IASTName[] decls = tu.getDeclarations(collector.getName(0)
|
||||
// test tu.getDeclarationsInAST(IBinding)
|
||||
IASTName[] decls = tu.getDeclarationsInAST(collector.getName(0)
|
||||
.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], collector.getName(0));
|
||||
|
||||
decls = tu.getDeclarations(collector.getName(1).resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(collector.getName(1).resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], collector.getName(2));
|
||||
|
||||
decls = tu.getDeclarations(collector.getName(2).resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(collector.getName(2).resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], collector.getName(2));
|
||||
}
|
||||
|
@ -1238,7 +1238,7 @@ public class AST2Tests extends AST2BaseTest {
|
|||
buffer.append("int f( X x );"); //$NON-NLS-1$
|
||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.C);
|
||||
|
||||
// test tu.getDeclarations(IBinding)
|
||||
// test tu.getDeclarationsInAST(IBinding)
|
||||
IASTSimpleDeclaration decl1 = (IASTSimpleDeclaration) tu
|
||||
.getDeclarations()[0];
|
||||
IASTSimpleDeclaration decl2 = (IASTSimpleDeclaration) tu
|
||||
|
@ -1252,19 +1252,19 @@ public class AST2Tests extends AST2BaseTest {
|
|||
.getDeclarators()[0]).getParameters()[0].getDeclarator()
|
||||
.getName();
|
||||
|
||||
IASTName[] decls = tu.getDeclarations(name_X1.resolveBinding());
|
||||
IASTName[] decls = tu.getDeclarationsInAST(name_X1.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_X1);
|
||||
|
||||
decls = tu.getDeclarations(name_f.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(name_f.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_f);
|
||||
|
||||
decls = tu.getDeclarations(name_X2.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(name_X2.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_X1);
|
||||
|
||||
decls = tu.getDeclarations(name_x.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(name_x.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_x);
|
||||
}
|
||||
|
@ -1272,12 +1272,12 @@ public class AST2Tests extends AST2BaseTest {
|
|||
public void testLongLong() throws ParserException {
|
||||
IASTTranslationUnit tu = parse("long long x;\n", ParserLanguage.C); //$NON-NLS-1$
|
||||
|
||||
// test tu.getDeclarations(IBinding)
|
||||
// test tu.getDeclarationsInAST(IBinding)
|
||||
IASTSimpleDeclaration decl1 = (IASTSimpleDeclaration) tu
|
||||
.getDeclarations()[0];
|
||||
IASTName name_x = decl1.getDeclarators()[0].getName();
|
||||
|
||||
IASTName[] decls = tu.getDeclarations(name_x.resolveBinding());
|
||||
IASTName[] decls = tu.getDeclarationsInAST(name_x.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_x);
|
||||
}
|
||||
|
@ -1377,61 +1377,61 @@ public class AST2Tests extends AST2BaseTest {
|
|||
assertSame(cp, cp3);
|
||||
assertSame(red, red2);
|
||||
|
||||
// test tu.getDeclarations(IBinding)
|
||||
IASTName[] decls = tu.getDeclarations(name_hue.resolveBinding());
|
||||
// test tu.getDeclarationsInAST(IBinding)
|
||||
IASTName[] decls = tu.getDeclarationsInAST(name_hue.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_hue);
|
||||
|
||||
decls = tu.getDeclarations(e1.getName().resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(e1.getName().resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], e1.getName());
|
||||
|
||||
decls = tu.getDeclarations(e2.getName().resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(e2.getName().resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], e2.getName());
|
||||
|
||||
decls = tu.getDeclarations(e3.getName().resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(e3.getName().resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], e3.getName());
|
||||
|
||||
decls = tu.getDeclarations(name_hue2.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(name_hue2.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_hue);
|
||||
|
||||
decls = tu.getDeclarations(name_col.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(name_col.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_col);
|
||||
|
||||
decls = tu.getDeclarations(name_cp.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(name_cp.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_cp);
|
||||
|
||||
decls = tu.getDeclarations(fn.getDeclarator().getName()
|
||||
decls = tu.getDeclarationsInAST(fn.getDeclarator().getName()
|
||||
.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], fn.getDeclarator().getName());
|
||||
|
||||
decls = tu.getDeclarations(r_col.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(r_col.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_col);
|
||||
|
||||
decls = tu.getDeclarations(r_blue.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(r_blue.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], e2.getName());
|
||||
|
||||
decls = tu.getDeclarations(r_cp.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(r_cp.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_cp);
|
||||
|
||||
decls = tu.getDeclarations(r_col2.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(r_col2.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_col);
|
||||
|
||||
decls = tu.getDeclarations(r_cp2.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(r_cp2.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_cp);
|
||||
|
||||
decls = tu.getDeclarations(r_red.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(r_red.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], e1.getName());
|
||||
}
|
||||
|
@ -1449,8 +1449,8 @@ public class AST2Tests extends AST2BaseTest {
|
|||
assertTrue(f.getPointerOperators().length == 0);
|
||||
assertFalse(f.getNestedDeclarator().getPointerOperators().length == 0);
|
||||
|
||||
// test tu.getDeclarations(IBinding)
|
||||
IASTName[] decls = tu.getDeclarations(f.getNestedDeclarator().getName()
|
||||
// test tu.getDeclarationsInAST(IBinding)
|
||||
IASTName[] decls = tu.getDeclarationsInAST(f.getNestedDeclarator().getName()
|
||||
.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], f.getNestedDeclarator().getName());
|
||||
|
@ -1609,37 +1609,37 @@ public class AST2Tests extends AST2BaseTest {
|
|||
assertTrue(t_AP instanceof IPointerType);
|
||||
assertSame(((IPointerType) t_AP).getType(), A);
|
||||
|
||||
// test tu.getDeclarations(IBinding)
|
||||
IASTName[] decls = tu.getDeclarations(compSpec.getName()
|
||||
// test tu.getDeclarationsInAST(IBinding)
|
||||
IASTName[] decls = tu.getDeclarationsInAST(compSpec.getName()
|
||||
.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], compSpec.getName());
|
||||
|
||||
decls = tu.getDeclarations(name_a1.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(name_a1.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_a1);
|
||||
|
||||
decls = tu.getDeclarations(name_A2.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(name_A2.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], compSpec.getName());
|
||||
|
||||
decls = tu.getDeclarations(name_AP.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(name_AP.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_AP);
|
||||
|
||||
decls = tu.getDeclarations(name_A3.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(name_A3.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], compSpec.getName());
|
||||
|
||||
decls = tu.getDeclarations(name_a2.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(name_a2.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_a2);
|
||||
|
||||
decls = tu.getDeclarations(name_AP2.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(name_AP2.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_AP);
|
||||
|
||||
decls = tu.getDeclarations(name_a3.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(name_a3.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_a3);
|
||||
}
|
||||
|
@ -1699,16 +1699,16 @@ public class AST2Tests extends AST2BaseTest {
|
|||
assertTrue(t_c_6 instanceof IBasicType);
|
||||
assertEquals(((IBasicType) t_c_6).getType(), IBasicType.t_char);
|
||||
|
||||
// test tu.getDeclarations(IBinding)
|
||||
IASTName[] decls = tu.getDeclarations(name_a.resolveBinding());
|
||||
// test tu.getDeclarationsInAST(IBinding)
|
||||
IASTName[] decls = tu.getDeclarationsInAST(name_a.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_a);
|
||||
|
||||
decls = tu.getDeclarations(name_b.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(name_b.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_b);
|
||||
|
||||
decls = tu.getDeclarations(name_c.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(name_c.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_c);
|
||||
}
|
||||
|
@ -1812,36 +1812,36 @@ public class AST2Tests extends AST2BaseTest {
|
|||
assertEquals(h_ps.length, 1);
|
||||
assertTrue(h_ps[0] instanceof IBasicType);
|
||||
|
||||
// test tu.getDeclarations(IBinding)
|
||||
IASTName[] decls = tu.getDeclarations(name_A1.resolveBinding());
|
||||
// test tu.getDeclarationsInAST(IBinding)
|
||||
IASTName[] decls = tu.getDeclarationsInAST(name_A1.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_A1);
|
||||
|
||||
decls = tu.getDeclarations(name_f.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(name_f.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_f);
|
||||
|
||||
decls = tu.getDeclarations(name_i.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(name_i.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_i);
|
||||
|
||||
decls = tu.getDeclarations(name_c.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(name_c.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_c);
|
||||
|
||||
decls = tu.getDeclarations(name_g.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(name_g.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_g);
|
||||
|
||||
decls = tu.getDeclarations(name_A2.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(name_A2.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_A1);
|
||||
|
||||
decls = tu.getDeclarations(name_h.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(name_h.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_h);
|
||||
|
||||
decls = tu.getDeclarations(name_A3.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(name_A3.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_A1);
|
||||
|
||||
|
@ -1927,45 +1927,45 @@ public class AST2Tests extends AST2BaseTest {
|
|||
assertNotNull(fieldDesignator.getName().toString());
|
||||
}
|
||||
|
||||
// test tu.getDeclarations(IBinding)
|
||||
IASTName[] decls = tu.getDeclarations(name_Coord2.resolveBinding());
|
||||
// test tu.getDeclarationsInAST(IBinding)
|
||||
IASTName[] decls = tu.getDeclarationsInAST(name_Coord2.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_Coord);
|
||||
|
||||
decls = tu.getDeclarations(name_xy.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(name_xy.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_xy);
|
||||
|
||||
decls = tu.getDeclarations(name_y2.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(name_y2.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_y);
|
||||
|
||||
decls = tu.getDeclarations(name_x2.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(name_x2.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_x);
|
||||
|
||||
decls = tu.getDeclarations(name_Point2.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(name_Point2.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_Point);
|
||||
|
||||
decls = tu.getDeclarations(name_point.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(name_point.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_point);
|
||||
|
||||
decls = tu.getDeclarations(name_width2.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(name_width2.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_width);
|
||||
|
||||
decls = tu.getDeclarations(name_pos2.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(name_pos2.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_pos);
|
||||
|
||||
decls = tu.getDeclarations(name_xy2.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(name_xy2.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_xy);
|
||||
}
|
||||
|
||||
public void testMoreGetDeclarations1() throws Exception {
|
||||
public void testMoregetDeclarationsInAST1() throws Exception {
|
||||
StringBuffer buffer = new StringBuffer(); //$NON-NLS-1$
|
||||
buffer.append("struct S {\n"); //$NON-NLS-1$
|
||||
buffer.append(" int a;\n"); //$NON-NLS-1$
|
||||
|
@ -1998,16 +1998,16 @@ public class AST2Tests extends AST2BaseTest {
|
|||
assertEquals(a1.resolveBinding(), a2.resolveBinding());
|
||||
assertEquals(b1.resolveBinding(), b2.resolveBinding());
|
||||
|
||||
IASTName[] decls = tu.getDeclarations(a1.resolveBinding());
|
||||
IASTName[] decls = tu.getDeclarationsInAST(a1.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(a1, decls[0]);
|
||||
|
||||
decls = tu.getDeclarations(b1.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(b1.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(b1, decls[0]);
|
||||
}
|
||||
|
||||
public void testMoreGetDeclarations2() throws Exception {
|
||||
public void testMoregetDeclarationsInAST2() throws Exception {
|
||||
StringBuffer buffer = new StringBuffer(); //$NON-NLS-1$
|
||||
buffer.append(" struct S { \n"); //$NON-NLS-1$
|
||||
buffer.append(" int a; \n"); //$NON-NLS-1$
|
||||
|
@ -2034,16 +2034,16 @@ public class AST2Tests extends AST2BaseTest {
|
|||
assertEquals(a1.resolveBinding(), a2.resolveBinding());
|
||||
assertEquals(b1.resolveBinding(), b2.resolveBinding());
|
||||
|
||||
IASTName[] decls = tu.getDeclarations(a1.resolveBinding());
|
||||
IASTName[] decls = tu.getDeclarationsInAST(a1.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(a1, decls[0]);
|
||||
|
||||
decls = tu.getDeclarations(b1.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(b1.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(b1, decls[0]);
|
||||
}
|
||||
|
||||
public void testMoreGetDeclarations3() throws Exception {
|
||||
public void testMoregetDeclarationsInAST3() throws Exception {
|
||||
StringBuffer buffer = new StringBuffer(); //$NON-NLS-1$
|
||||
buffer.append(" typedef struct S { \n"); //$NON-NLS-1$
|
||||
buffer.append(" int a; \n"); //$NON-NLS-1$
|
||||
|
@ -2075,11 +2075,11 @@ public class AST2Tests extends AST2BaseTest {
|
|||
assertEquals(a1.resolveBinding(), a2.resolveBinding());
|
||||
assertEquals(b1.resolveBinding(), b2.resolveBinding());
|
||||
|
||||
IASTName[] decls = tu.getDeclarations(a1.resolveBinding());
|
||||
IASTName[] decls = tu.getDeclarationsInAST(a1.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(a1, decls[0]);
|
||||
|
||||
decls = tu.getDeclarations(b1.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(b1.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(b1, decls[0]);
|
||||
}
|
||||
|
@ -2098,8 +2098,8 @@ public class AST2Tests extends AST2BaseTest {
|
|||
assertTrue(((IPointerType) ft.getReturnType()).getType() instanceof IFunctionType);
|
||||
assertEquals(ft.getParameterTypes().length, 1);
|
||||
|
||||
// test tu.getDeclarations(IBinding)
|
||||
IASTName[] decls = tu.getDeclarations(def.getDeclarator()
|
||||
// test tu.getDeclarationsInAST(IBinding)
|
||||
IASTName[] decls = tu.getDeclarationsInAST(def.getDeclarator()
|
||||
.getNestedDeclarator().getName().resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], def.getDeclarator().getNestedDeclarator()
|
||||
|
@ -2124,11 +2124,11 @@ public class AST2Tests extends AST2BaseTest {
|
|||
assertTrue(ft.getParameterTypes()[0] instanceof IPointerType);
|
||||
assertTrue(((IPointerType) ft.getParameterTypes()[0]).isConst());
|
||||
|
||||
// test tu.getDeclarations(IBinding)
|
||||
// test tu.getDeclarationsInAST(IBinding)
|
||||
IASTName name_parm = ((IASTStandardFunctionDeclarator) def
|
||||
.getDeclarators()[0]).getParameters()[0].getDeclarator()
|
||||
.getName();
|
||||
IASTName[] decls = tu.getDeclarations(name_parm.resolveBinding());
|
||||
IASTName[] decls = tu.getDeclarationsInAST(name_parm.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_parm);
|
||||
}
|
||||
|
@ -2164,18 +2164,18 @@ public class AST2Tests extends AST2BaseTest {
|
|||
assertTrue(((IFunctionType) ((IPointerType) ft3.getReturnType())
|
||||
.getType()).getReturnType() instanceof IBasicType);
|
||||
|
||||
// test tu.getDeclarations(IBinding)
|
||||
IASTName[] decls = tu.getDeclarations(def1.getDeclarator().getName()
|
||||
// test tu.getDeclarationsInAST(IBinding)
|
||||
IASTName[] decls = tu.getDeclarationsInAST(def1.getDeclarator().getName()
|
||||
.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], def1.getDeclarator().getName());
|
||||
|
||||
decls = tu.getDeclarations(def2.getDeclarator().getName()
|
||||
decls = tu.getDeclarationsInAST(def2.getDeclarator().getName()
|
||||
.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], def2.getDeclarator().getName());
|
||||
|
||||
decls = tu.getDeclarations(def3.getDeclarator().getNestedDeclarator()
|
||||
decls = tu.getDeclarationsInAST(def3.getDeclarator().getNestedDeclarator()
|
||||
.getName().resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], def3.getDeclarator().getNestedDeclarator()
|
||||
|
@ -2206,14 +2206,14 @@ public class AST2Tests extends AST2BaseTest {
|
|||
assertTrue(gt_parm instanceof IBasicType);
|
||||
assertEquals(((IBasicType) gt_parm).getType(), IBasicType.t_void);
|
||||
|
||||
// test tu.getDeclarations(IBinding)
|
||||
// test tu.getDeclarationsInAST(IBinding)
|
||||
assertTrue(def.getDeclarator() instanceof IASTStandardFunctionDeclarator);
|
||||
IASTName name_g = ((IASTStandardFunctionDeclarator) def.getDeclarator())
|
||||
.getParameters()[0].getDeclarator().getName();
|
||||
IASTName name_g_call = ((IASTIdExpression) ((IASTFunctionCallExpression) ((IASTReturnStatement) ((IASTCompoundStatement) def
|
||||
.getBody()).getStatements()[0]).getReturnValue())
|
||||
.getFunctionNameExpression()).getName();
|
||||
IASTName[] decls = tu.getDeclarations(name_g_call.resolveBinding());
|
||||
IASTName[] decls = tu.getDeclarationsInAST(name_g_call.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_g);
|
||||
}
|
||||
|
@ -2249,9 +2249,9 @@ public class AST2Tests extends AST2BaseTest {
|
|||
assertTrue(vpt_2_2 instanceof IBasicType);
|
||||
assertEquals(((IBasicType) vpt_2_2).getType(), IBasicType.t_int);
|
||||
|
||||
// test tu.getDeclarations(IBinding)
|
||||
// test tu.getDeclarationsInAST(IBinding)
|
||||
IASTName[] decls = tu
|
||||
.getDeclarations(((IASTStandardFunctionDeclarator) decl
|
||||
.getDeclarationsInAST(((IASTStandardFunctionDeclarator) decl
|
||||
.getDeclarators()[0]).getNestedDeclarator().getName()
|
||||
.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
|
@ -2296,20 +2296,20 @@ public class AST2Tests extends AST2BaseTest {
|
|||
assertTrue(signal_ret3 instanceof IBasicType);
|
||||
assertEquals(((IBasicType) signal_ret3).getType(), IBasicType.t_void);
|
||||
|
||||
// test tu.getDeclarations(IBinding)
|
||||
// test tu.getDeclarationsInAST(IBinding)
|
||||
IASTName name_DWORD = decl1.getDeclarators()[0].getName();
|
||||
IASTName name_v = decl2.getDeclarators()[0].getName();
|
||||
|
||||
IASTName[] decls = tu.getDeclarations(name_DWORD.resolveBinding());
|
||||
IASTName[] decls = tu.getDeclarationsInAST(name_DWORD.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_DWORD);
|
||||
|
||||
decls = tu.getDeclarations(((IASTNamedTypeSpecifier) decl2
|
||||
decls = tu.getDeclarationsInAST(((IASTNamedTypeSpecifier) decl2
|
||||
.getDeclSpecifier()).getName().resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_DWORD);
|
||||
|
||||
decls = tu.getDeclarations(((IASTNamedTypeSpecifier) decl3
|
||||
decls = tu.getDeclarationsInAST(((IASTNamedTypeSpecifier) decl3
|
||||
.getDeclSpecifier()).getName().resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_v);
|
||||
|
@ -2385,7 +2385,7 @@ public class AST2Tests extends AST2BaseTest {
|
|||
IBasicType.t_void);
|
||||
assertTrue(((ITypedef) signal_parm_t2_ret_1).getName().equals("DWORD")); //$NON-NLS-1$
|
||||
|
||||
// test tu.getDeclarations(IBinding)
|
||||
// test tu.getDeclarationsInAST(IBinding)
|
||||
IASTName name_pfv = decl2.getDeclarators()[0].getNestedDeclarator()
|
||||
.getName();
|
||||
IASTName name_pfv1 = ((IASTNamedTypeSpecifier) decl3.getDeclSpecifier())
|
||||
|
@ -2394,11 +2394,11 @@ public class AST2Tests extends AST2BaseTest {
|
|||
.getDeclarators()[0]).getParameters()[1].getDeclSpecifier())
|
||||
.getName();
|
||||
|
||||
IASTName[] decls = tu.getDeclarations(name_pfv1.resolveBinding());
|
||||
IASTName[] decls = tu.getDeclarationsInAST(name_pfv1.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_pfv);
|
||||
|
||||
decls = tu.getDeclarations(name_pfv2.resolveBinding());
|
||||
decls = tu.getDeclarationsInAST(name_pfv2.resolveBinding());
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals(decls[0], name_pfv);
|
||||
}
|
||||
|
@ -2895,7 +2895,7 @@ public class AST2Tests extends AST2BaseTest {
|
|||
assertInstances(col, x1, 1);
|
||||
assertInstances(col, x2, 2);
|
||||
|
||||
IASTName[] ds = tu.getDeclarations(x2);
|
||||
IASTName[] ds = tu.getDeclarationsInAST(x2);
|
||||
assertEquals(ds.length, 1);
|
||||
assertSame(ds[0], col.getName(11));
|
||||
}
|
||||
|
|
|
@ -283,7 +283,7 @@ public class DOMLocationMacroTests extends AST2BaseTest {
|
|||
assertNotNull( binding2 );
|
||||
assertNotSame( binding1, binding2 );
|
||||
IASTName [] firstReferences = tu.getReferences( binding1 );
|
||||
IASTName [] firstDeclarations = tu.getDeclarations( binding1 );
|
||||
IASTName [] firstDeclarations = tu.getDeclarationsInAST( binding1 );
|
||||
assertEquals( firstReferences.length, 2 );
|
||||
assertEquals( firstReferences[0].getPropertyInParent(), IASTTranslationUnit.EXPANSION_NAME );
|
||||
assertEquals( firstReferences[0].getParent(), tu );
|
||||
|
@ -292,7 +292,7 @@ public class DOMLocationMacroTests extends AST2BaseTest {
|
|||
assertEquals( firstDeclarations.length, 1 );
|
||||
assertSame( ABC1.getName(), firstDeclarations[0] );
|
||||
IASTName [] secondReferences = tu.getReferences(binding2);
|
||||
IASTName [] secondDeclarations = tu.getDeclarations( binding2 );
|
||||
IASTName [] secondDeclarations = tu.getDeclarationsInAST( binding2 );
|
||||
assertEquals( 1, secondReferences.length );
|
||||
assertEquals( secondReferences[0].getPropertyInParent(), IASTTranslationUnit.EXPANSION_NAME );
|
||||
assertEquals( secondReferences[0].getParent(), tu );
|
||||
|
|
|
@ -9,12 +9,15 @@
|
|||
* IBM Corporation - initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.dom;
|
||||
package org.eclipse.cdt.core.parser.tests.ast2;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.dom.IName;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||
|
@ -27,10 +30,8 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
|
|||
import org.eclipse.cdt.core.parser.ParserLanguage;
|
||||
import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMName;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.content.IContentType;
|
||||
|
||||
|
@ -152,8 +153,8 @@ public class DOMSearchUtil {
|
|||
* ( CSearchPattern.DECLARATION | CSearchPattern.REFERENCES | CSearchPattern.ALL_OCCURRENCES )
|
||||
* @return IASTName[] declarations, references, or both depending on limitTo that correspond to the IASTName searchName searched for
|
||||
*/
|
||||
public static IASTName[] getNamesFromDOM(IASTName searchName, int limitTo) {
|
||||
IASTName[] names = null;
|
||||
public static IName[] getNamesFromDOM(IASTName searchName, int limitTo) {
|
||||
IName[] names = null;
|
||||
IASTTranslationUnit tu = searchName.getTranslationUnit();
|
||||
|
||||
if (tu == null) {
|
||||
|
@ -162,24 +163,20 @@ public class DOMSearchUtil {
|
|||
|
||||
IBinding binding = searchName.resolveBinding();
|
||||
if (binding instanceof PDOMBinding) {
|
||||
try {
|
||||
ArrayList pdomNames = new ArrayList();
|
||||
// First decls
|
||||
PDOMName name = ((PDOMBinding)binding).getFirstDeclaration();
|
||||
while (name != null) {
|
||||
pdomNames.add(name);
|
||||
name = name.getNextInBinding();
|
||||
}
|
||||
// Next defs
|
||||
name = ((PDOMBinding)binding).getFirstDefinition();
|
||||
while (name != null) {
|
||||
pdomNames.add(name);
|
||||
name = name.getNextInBinding();
|
||||
}
|
||||
names = (IASTName[])pdomNames.toArray(new IASTName[pdomNames.size()]);
|
||||
} catch (CoreException e) {
|
||||
CCorePlugin.log(e);
|
||||
}
|
||||
Assert.fail("Not implemented");
|
||||
// try {
|
||||
// ArrayList pdomNames = new ArrayList();
|
||||
// IPDOMResolver pdom= ((PDOMBinding) binding).getPDOM();
|
||||
// // First decls
|
||||
// names= pdom.getDeclarations(binding);
|
||||
// pdomNames.addAll(Arrays.asList(names));
|
||||
// // Next defs
|
||||
// names= pdom.getDefinitions(binding);
|
||||
// pdomNames.addAll(Arrays.asList(names));
|
||||
// names = (IName[])pdomNames.toArray(new IName[pdomNames.size()]);
|
||||
// } catch (CoreException e) {
|
||||
// CCorePlugin.log(e);
|
||||
// }
|
||||
} else {
|
||||
names = getNames(tu, binding, limitTo);
|
||||
|
||||
|
@ -202,16 +199,16 @@ public class DOMSearchUtil {
|
|||
IASTName[] names = null;
|
||||
if (limitTo == DECLARATIONS ||
|
||||
limitTo == DECLARATIONS_DEFINITIONS) {
|
||||
names = tu.getDeclarations(binding);
|
||||
names = tu.getDeclarationsInAST(binding);
|
||||
} else if (limitTo == REFERENCES) {
|
||||
names = tu.getReferences(binding);
|
||||
} else if (limitTo == DEFINITIONS) {
|
||||
names = tu.getDefinitions(binding);
|
||||
names = tu.getDefinitionsInAST(binding);
|
||||
} else if (limitTo == ALL_OCCURRENCES){
|
||||
names = tu.getDeclarations(binding);
|
||||
names = tu.getDeclarationsInAST(binding);
|
||||
names = (IASTName[])ArrayUtil.addAll(IASTName.class, names, tu.getReferences(binding));
|
||||
} else { // assume ALL
|
||||
names = tu.getDeclarations(binding);
|
||||
names = tu.getDeclarationsInAST(binding);
|
||||
names = (IASTName[])ArrayUtil.addAll(IASTName.class, names, tu.getReferences(binding));
|
||||
}
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
package org.eclipse.cdt.core.parser.tests.ast2;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.dom.DOMSearchUtil;
|
||||
import org.eclipse.cdt.core.dom.IName;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||
|
@ -53,11 +53,11 @@ public class DOMSelectionParseBaseTest extends DOMFileBasePluginTest {
|
|||
return null;
|
||||
}
|
||||
|
||||
protected IASTName[] getDeclarationOffTU(IASTName name) {
|
||||
protected IName[] getDeclarationOffTU(IASTName name) {
|
||||
return DOMSearchUtil.getNamesFromDOM(name, DOMSearchUtil.DECLARATIONS);
|
||||
}
|
||||
|
||||
protected IASTName[] getReferencesOffTU(IASTName name) {
|
||||
protected IName[] getReferencesOffTU(IASTName name) {
|
||||
return DOMSearchUtil.getNamesFromDOM(name, DOMSearchUtil.REFERENCES);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ package org.eclipse.cdt.core.parser.tests.ast2;
|
|||
import java.io.StringWriter;
|
||||
import java.io.Writer;
|
||||
|
||||
import org.eclipse.cdt.core.dom.IName;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
|
@ -55,7 +56,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
|
|||
assertTrue( node instanceof IASTName );
|
||||
assertTrue( ((IASTName)node).resolveBinding() instanceof IVariable );
|
||||
assertEquals( ((IASTName)node).toString(), "x" ); //$NON-NLS-1$
|
||||
IASTName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
IName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals( decls[0].toString(), "x" ); //$NON-NLS-1$
|
||||
assertEquals( ((ASTNode)decls[0]).getOffset(), 15);
|
||||
|
@ -71,7 +72,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
|
|||
assertTrue( node instanceof IASTName );
|
||||
assertTrue( ((IASTName)node).resolveBinding() instanceof IFunction );
|
||||
assertEquals( ((IASTName)node).toString(), "x" ); //$NON-NLS-1$
|
||||
IASTName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
IName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals( decls[0].toString(), "x" ); //$NON-NLS-1$
|
||||
assertEquals( ((ASTNode)decls[0]).getOffset(), 4);
|
||||
|
@ -95,7 +96,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
|
|||
assertTrue( node instanceof IASTName );
|
||||
assertTrue( ((IASTName)node).resolveBinding() instanceof IFunction );
|
||||
assertEquals( ((IASTName)node).toString(), "x" ); //$NON-NLS-1$
|
||||
IASTName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
IName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals( decls[0].toString(), "x" ); //$NON-NLS-1$
|
||||
assertEquals( ((ASTNode)decls[0]).getOffset(), 4);
|
||||
|
@ -135,7 +136,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
|
|||
assertTrue( node instanceof IASTName );
|
||||
assertTrue( ((IASTName)node).resolveBinding() instanceof IParameter );
|
||||
assertEquals( ((IASTName)node).toString(), "argc" ); //$NON-NLS-1$
|
||||
IASTName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
IName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals( decls[0].toString(), "argc" ); //$NON-NLS-1$
|
||||
assertEquals( ((ASTNode)decls[0]).getOffset(), 14);
|
||||
|
@ -170,7 +171,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
|
|||
assertTrue( node instanceof IASTName );
|
||||
assertTrue( ((IASTName)node).resolveBinding() instanceof ICPPMethod );
|
||||
assertEquals( ((IASTName)node).toString(), "playHorn" ); //$NON-NLS-1$
|
||||
IASTName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
IName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
assertEquals(decls.length, 2);
|
||||
assertEquals( decls[0].toString(), "playHorn" ); //$NON-NLS-1$
|
||||
assertEquals( ((ASTNode)decls[0]).getOffset(), 28);
|
||||
|
@ -209,7 +210,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
|
|||
assertTrue( node instanceof IASTName );
|
||||
assertTrue( ((IASTName)node).resolveBinding() instanceof ICPPNamespace );
|
||||
assertEquals( ((IASTName)node).toString(), "Muppets" ); //$NON-NLS-1$
|
||||
IASTName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
IName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals( decls[0].toString(), "Muppets" ); //$NON-NLS-1$
|
||||
assertEquals( ((ASTNode)decls[0]).getOffset(), 10);
|
||||
|
@ -244,7 +245,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
|
|||
assertTrue( node instanceof IASTName );
|
||||
assertTrue( ((IASTName)node).resolveBinding() instanceof ICPPClassType );
|
||||
assertEquals( ((IASTName)node).toString(), "Foo" ); //$NON-NLS-1$
|
||||
IASTName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
IName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals( decls[0].toString(), "Foo" ); //$NON-NLS-1$
|
||||
assertEquals( ((ASTNode)decls[0]).getOffset(), 6);
|
||||
|
@ -288,7 +289,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
|
|||
assertTrue( node instanceof IASTName );
|
||||
assertTrue( ((IASTName)node).resolveBinding() instanceof ICPPMethod );
|
||||
IBinding binding = ((IASTName)node).resolveBinding();
|
||||
IASTName[] decls = null;
|
||||
IName[] decls = null;
|
||||
switch( i )
|
||||
{
|
||||
case 0:
|
||||
|
@ -339,7 +340,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
|
|||
assertTrue( node instanceof IASTName );
|
||||
assertTrue( ((IASTName)node).resolveBinding() instanceof ICPPMethod );
|
||||
assertEquals( ((IASTName)node).toString(), "getAnswer" ); //$NON-NLS-1$
|
||||
IASTName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
IName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals( decls[0].toString(), "getAnswer" ); //$NON-NLS-1$
|
||||
assertEquals( ((ASTNode)decls[0]).getOffset(), 29);
|
||||
|
@ -354,7 +355,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
|
|||
assertTrue( node instanceof IASTName );
|
||||
assertTrue( ((IASTName)node).resolveBinding() instanceof ICPPConstructor );
|
||||
assertEquals( ((IASTName)node).toString(), "ABC" ); //$NON-NLS-1$
|
||||
IASTName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
IName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
assertEquals(decls.length, 2);
|
||||
assertEquals( decls[0].toString(), "ABC" ); //$NON-NLS-1$
|
||||
assertEquals( ((ASTNode)decls[0]).getOffset(), 20);
|
||||
|
@ -427,7 +428,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
|
|||
assertTrue( node instanceof IASTName );
|
||||
assertTrue( ((IASTName)node).resolveBinding() instanceof ICPPField );
|
||||
assertEquals( ((IASTName)node).toString(), "stInt" ); //$NON-NLS-1$
|
||||
IASTName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
IName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
assertEquals(decls.length, 2);
|
||||
assertEquals( decls[0].toString(), "stInt" ); //$NON-NLS-1$
|
||||
assertEquals( ((ASTNode)decls[0]).getOffset(), 37);
|
||||
|
@ -466,7 +467,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
|
|||
assertTrue( ((IASTName)node).resolveBinding() instanceof ICPPClassType );
|
||||
assertEquals( ((IASTName)node).toString(), "Squaw" ); //$NON-NLS-1$
|
||||
assertEquals( ((ICPPClassType)((IASTName)node).resolveBinding()).getKey(), ICompositeType.k_union );
|
||||
IASTName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
IName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals( decls[0].toString(), "Squaw" ); //$NON-NLS-1$
|
||||
assertEquals( ((ASTNode)decls[0]).getOffset(), 6);
|
||||
|
@ -490,7 +491,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
|
|||
assertTrue( node instanceof IASTName );
|
||||
assertTrue( ((IASTName)node).resolveBinding() instanceof IVariable );
|
||||
assertEquals( ((IASTName)node).toString(), "FOUND_ME" ); //$NON-NLS-1$
|
||||
IASTName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
IName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals( decls[0].toString(), "FOUND_ME" ); //$NON-NLS-1$
|
||||
assertEquals( ((ASTNode)decls[0]).getOffset(), 10);
|
||||
|
@ -511,7 +512,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
|
|||
assertTrue( node instanceof IASTName );
|
||||
assertTrue( ((IASTName)node).resolveBinding() instanceof ICPPConstructor );
|
||||
assertEquals( ((IASTName)node).toString(), "ABC" ); //$NON-NLS-1$
|
||||
IASTName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
IName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals( decls[0].toString(), "ABC" ); //$NON-NLS-1$
|
||||
assertEquals( ((ASTNode)decls[0]).getOffset(), 21);
|
||||
|
@ -532,7 +533,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
|
|||
assertTrue( node instanceof IASTName );
|
||||
assertTrue( ((IASTName)node).resolveBinding() instanceof ICPPMethod );
|
||||
assertEquals( ((IASTName)node).toString(), "f_SD" ); //$NON-NLS-1$
|
||||
IASTName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
IName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
assertEquals(decls.length, 2);
|
||||
assertEquals( decls[0].toString(), "f_SD" ); //$NON-NLS-1$
|
||||
assertEquals( ((ASTNode)decls[0]).getOffset(), 71);
|
||||
|
@ -556,7 +557,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
|
|||
assertTrue( node instanceof IASTName );
|
||||
assertTrue( ((IASTName)node).resolveBinding() instanceof IFunction );
|
||||
assertEquals( ((IASTName)node).toString(), "f_SD" ); //$NON-NLS-1$
|
||||
IASTName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
IName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
assertEquals(decls.length, 2);
|
||||
assertEquals( decls[0].toString(), "f_SD" ); //$NON-NLS-1$
|
||||
assertEquals( ((ASTNode)decls[0]).getOffset(), 109);
|
||||
|
@ -574,7 +575,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
|
|||
assertTrue( node instanceof IASTName );
|
||||
assertTrue( ((IASTName)node).resolveBinding() instanceof ICPPMethod );
|
||||
assertEquals( ((IASTName)node).toString(), "initialize" ); //$NON-NLS-1$
|
||||
IASTName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
IName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
assertEquals(decls.length, 2);
|
||||
assertEquals( decls[0].toString(), "initialize" ); //$NON-NLS-1$
|
||||
assertEquals( ((ASTNode)decls[0]).getOffset(), 17);
|
||||
|
@ -592,7 +593,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
|
|||
assertTrue( node instanceof IASTName );
|
||||
assertTrue( ((IASTName)node).resolveBinding() instanceof ICPPConstructor );
|
||||
assertEquals( ((IASTName)node).toString(), "B" ); //$NON-NLS-1$
|
||||
IASTName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
IName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals( decls[0].toString(), "B" ); //$NON-NLS-1$
|
||||
assertEquals( ((ASTNode)decls[0]).getOffset(), 17);
|
||||
|
@ -612,7 +613,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
|
|||
assertTrue( node instanceof IASTName );
|
||||
assertTrue( ((IASTName)node).resolveBinding() instanceof ICPPClassType );
|
||||
assertEquals( ((IASTName)node).toString(), "A" ); //$NON-NLS-1$
|
||||
IASTName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
IName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals( decls[0].toString(), "A" ); //$NON-NLS-1$
|
||||
assertEquals( ((ASTNode)decls[0]).getOffset(), 6);
|
||||
|
@ -633,7 +634,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
|
|||
assertTrue( node instanceof IASTName );
|
||||
assertTrue( ((IASTName)node).resolveBinding() instanceof ICPPClassType );
|
||||
assertEquals( ((IASTName)node).toString(), "AAA" ); //$NON-NLS-1$
|
||||
IASTName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
IName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals( decls[0].toString(), "AAA" ); //$NON-NLS-1$
|
||||
assertEquals( ((ASTNode)decls[0]).getOffset(), 75);
|
||||
|
@ -668,7 +669,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
|
|||
assertTrue( node instanceof IASTName );
|
||||
assertTrue( ((IASTName)node).resolveBinding() instanceof ICPPField );
|
||||
assertEquals( ((IASTName)node).toString(), "rank" ); //$NON-NLS-1$
|
||||
IASTName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
IName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals( decls[0].toString(), "rank" ); //$NON-NLS-1$
|
||||
assertEquals( ((ASTNode)decls[0]).getOffset(), 36);
|
||||
|
@ -701,7 +702,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
|
|||
assertTrue( ((IASTName)node).resolveBinding() instanceof IFunction );
|
||||
assertEquals( ((IASTName)node).toString(), "rank" ); //$NON-NLS-1$
|
||||
assertEquals( ((ASTNode)node).getOffset(), index);
|
||||
IASTName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
IName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals( decls[0].toString(), "rank" ); //$NON-NLS-1$
|
||||
assertEquals( ((ASTNode)decls[0]).getOffset(), 4);
|
||||
|
@ -938,7 +939,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
|
|||
assertTrue( ((IASTName)node).resolveBinding() instanceof ICPPNamespace );
|
||||
assertEquals( ((IASTName)node).toString(), "N" ); //$NON-NLS-1$
|
||||
assertEquals( ((ASTNode)node).getOffset(), index);
|
||||
IASTName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
IName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals( decls[0].toString(), "N" ); //$NON-NLS-1$
|
||||
assertEquals( ((ASTNode)decls[0]).getOffset(), 10);
|
||||
|
@ -957,7 +958,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
|
|||
assertTrue( ((IASTName)node).resolveBinding() instanceof IParameter );
|
||||
assertEquals( ((IASTName)node).toString(), "itself" ); //$NON-NLS-1$
|
||||
assertEquals( ((ASTNode)node).getOffset(), index);
|
||||
IASTName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
IName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals( decls[0].toString(), "itself" ); //$NON-NLS-1$
|
||||
assertEquals( ((ASTNode)decls[0]).getOffset(), 36);
|
||||
|
@ -977,7 +978,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
|
|||
assertTrue( ((IASTName)node).resolveBinding() instanceof ICompositeType );
|
||||
assertEquals( ((IASTName)node).toString(), "Data" ); //$NON-NLS-1$
|
||||
assertEquals( ((ASTNode)node).getOffset(), index);
|
||||
IASTName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
IName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals( decls[0].toString(), "Data" ); //$NON-NLS-1$
|
||||
assertEquals( ((ASTNode)decls[0]).getOffset(), 36);
|
||||
|
@ -1019,7 +1020,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
|
|||
assertTrue( node instanceof IASTName );
|
||||
assertTrue( ((IASTName)node).resolveBinding() instanceof ICPPField );
|
||||
assertEquals( ((IASTName)node).toString(), "bar" ); //$NON-NLS-1$
|
||||
IASTName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
IName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals( decls[0].toString(), "bar" ); //$NON-NLS-1$
|
||||
assertEquals( ((ASTNode)decls[0]).getOffset(), 33);
|
||||
|
@ -1044,7 +1045,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
|
|||
assertTrue( ((IASTName)node).resolveBinding() instanceof IMacroBinding );
|
||||
assertEquals( ((IASTName)node).toString(), "UINT32" ); //$NON-NLS-1$
|
||||
|
||||
IASTName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
IName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals( decls[0].toString(), "UINT32" ); //$NON-NLS-1$
|
||||
assertEquals( ((ASTNode)decls[0]).getOffset(), 8);
|
||||
|
@ -1103,7 +1104,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
|
|||
assertTrue( ((IASTName)node).resolveBinding() instanceof ICPPConstructor );
|
||||
assertEquals( ((IASTName)node).toString(), "Point" ); //$NON-NLS-1$
|
||||
|
||||
IASTName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
IName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals( decls[0].toString(), "Point" ); //$NON-NLS-1$
|
||||
assertEquals( ((ASTNode)decls[0]).getOffset(), 53);
|
||||
|
@ -1126,7 +1127,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
|
|||
assertTrue( ((IASTName)node).resolveBinding() instanceof IMacroBinding );
|
||||
assertEquals( ((IASTName)node).toString(), "koo" ); //$NON-NLS-1$
|
||||
|
||||
IASTName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
IName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals( decls[0].toString(), "koo" ); //$NON-NLS-1$
|
||||
assertEquals( ((ASTNode)decls[0]).getOffset(), 19);
|
||||
|
@ -1157,7 +1158,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
|
|||
assertTrue( ((IASTName)node).resolveBinding() instanceof ICPPMethod );
|
||||
assertEquals( ((IASTName)node).toString(), "operator =" ); //$NON-NLS-1$
|
||||
|
||||
IASTName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
IName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals( decls[0].toString(), "operator =" ); //$NON-NLS-1$
|
||||
assertEquals( ((ASTNode)decls[0]).getOffset(), 51);
|
||||
|
@ -1183,7 +1184,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
|
|||
assertTrue( ((IASTName)node).resolveBinding() instanceof IMacroBinding );
|
||||
assertEquals( ((IASTName)node).toString(), "swap" ); //$NON-NLS-1$
|
||||
|
||||
IASTName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
IName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals( decls[0].toString(), "swap" ); //$NON-NLS-1$
|
||||
assertEquals( ((ASTNode)decls[0]).getOffset(), 58);
|
||||
|
@ -1209,7 +1210,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
|
|||
assertTrue( ((IASTName)node).resolveBinding() instanceof ICPPMethod );
|
||||
assertEquals( ((IASTName)node).toString(), "method1" ); //$NON-NLS-1$
|
||||
|
||||
IASTName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
IName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals( decls[0].toString(), "method1" ); //$NON-NLS-1$
|
||||
assertEquals( ((ASTNode)decls[0]).getOffset(), 41);
|
||||
|
@ -1233,7 +1234,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
|
|||
assertTrue( ((IASTName)node).resolveBinding() instanceof ICPPConstructor );
|
||||
assertEquals( ((IASTName)node).toString(), "A" ); //$NON-NLS-1$
|
||||
|
||||
IASTName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
IName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals( decls[0].toString(), "A" ); //$NON-NLS-1$
|
||||
assertEquals( ((ASTNode)decls[0]).getOffset(), 29);
|
||||
|
@ -1258,7 +1259,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
|
|||
assertTrue( ((IASTName)node).resolveBinding() instanceof ICPPMethod );
|
||||
assertEquals( ((IASTName)node).toString(), "method1" ); //$NON-NLS-1$
|
||||
|
||||
IASTName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
IName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals( decls[0].toString(), "method1" ); //$NON-NLS-1$
|
||||
assertEquals( ((ASTNode)decls[0]).getOffset(), 21);
|
||||
|
@ -1277,7 +1278,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
|
|||
assertTrue( ((IASTName)node).resolveBinding() instanceof IVariable );
|
||||
assertEquals( ((IASTName)node).toString(), "i" ); //$NON-NLS-1$
|
||||
|
||||
IASTName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
IName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals( decls[0].toString(), "i" ); //$NON-NLS-1$
|
||||
assertEquals( ((ASTNode)decls[0]).getOffset(), 4);
|
||||
|
@ -1305,7 +1306,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
|
|||
assertTrue( ((IASTName)node).resolveBinding() instanceof ICPPMethod );
|
||||
assertEquals( ((IASTName)node).toString(), "bar" ); //$NON-NLS-1$
|
||||
|
||||
IASTName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
IName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals( decls[0].toString(), "bar" ); //$NON-NLS-1$
|
||||
assertEquals( ((ASTNode)decls[0]).getOffset(), 34);
|
||||
|
@ -1333,7 +1334,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
|
|||
assertTrue( ((IASTName)node).resolveBinding() instanceof ICPPField );
|
||||
assertEquals( ((IASTName)node).toString(), "bar" ); //$NON-NLS-1$
|
||||
|
||||
IASTName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
IName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals( decls[0].toString(), "bar" ); //$NON-NLS-1$
|
||||
assertEquals( ((ASTNode)decls[0]).getOffset(), 33);
|
||||
|
@ -1357,7 +1358,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
|
|||
assertTrue( ((IASTName)node).resolveBinding() instanceof IVariable );
|
||||
assertEquals( ((IASTName)node).toString(), "x" ); //$NON-NLS-1$
|
||||
|
||||
IASTName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
IName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals( decls[0].toString(), "x" ); //$NON-NLS-1$
|
||||
assertEquals( ((ASTNode)decls[0]).getOffset(), 17);
|
||||
|
@ -1379,7 +1380,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
|
|||
assertTrue( ((IASTName)node).resolveBinding() instanceof IParameter );
|
||||
assertEquals( ((IASTName)node).toString(), "argc" ); //$NON-NLS-1$
|
||||
|
||||
IASTName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
IName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals( decls[0].toString(), "argc" ); //$NON-NLS-1$
|
||||
assertEquals( ((ASTNode)decls[0]).getOffset(), 13);
|
||||
|
@ -1405,7 +1406,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
|
|||
assertTrue( ((IASTName)node).resolveBinding() instanceof IVariable );
|
||||
assertEquals( ((IASTName)node).toString(), "x" ); //$NON-NLS-1$
|
||||
|
||||
IASTName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
IName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals( decls[0].toString(), "x" ); //$NON-NLS-1$
|
||||
assertEquals( ((ASTNode)decls[0]).getOffset(), 19);
|
||||
|
@ -1454,7 +1455,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
|
|||
assertTrue( ((IASTName)node).resolveBinding() instanceof ICPPFunction );
|
||||
assertEquals( ((IASTName)node).toString(), "g" ); //$NON-NLS-1$
|
||||
|
||||
IASTName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
IName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals( decls[0].toString(), "g" ); //$NON-NLS-1$
|
||||
assertEquals( ((ASTNode)decls[0]).getOffset(), 89);
|
||||
|
@ -1478,7 +1479,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
|
|||
assertTrue( ((IASTName)node).resolveBinding() instanceof IEnumeration );
|
||||
assertEquals( ((IASTName)node).toString(), "E" ); //$NON-NLS-1$
|
||||
|
||||
IASTName[] decls = getReferencesOffTU((IASTName)node);
|
||||
IName[] decls = getReferencesOffTU((IASTName)node);
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals( decls[0].toString(), "E" ); //$NON-NLS-1$
|
||||
assertEquals( ((ASTNode)decls[0]).getOffset(), 76);
|
||||
|
@ -1508,7 +1509,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
|
|||
assertTrue( ((IASTName)node).resolveBinding() instanceof IMacroBinding );
|
||||
assertEquals( ((IASTName)node).toString(), "HANDLE" ); //$NON-NLS-1$
|
||||
|
||||
IASTName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
IName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals( decls[0].toString(), "HANDLE" ); //$NON-NLS-1$
|
||||
assertEquals( ((ASTNode)decls[0]).getOffset(), 36);
|
||||
|
@ -1551,13 +1552,13 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
|
|||
assertTrue( ((IASTName)node).resolveBinding() instanceof ICPPMethod );
|
||||
assertEquals( ((IASTName)node).toString(), "setColor" ); //$NON-NLS-1$
|
||||
|
||||
IASTName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
IName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals( decls[0].toString(), "setColor" ); //$NON-NLS-1$
|
||||
assertEquals( ((ASTNode)decls[0]).getOffset(), 67);
|
||||
assertEquals( ((ASTNode)decls[0]).getLength(), 8);
|
||||
|
||||
IASTName[] refs = getReferencesOffTU((IASTName)node);
|
||||
IName[] refs = getReferencesOffTU((IASTName)node);
|
||||
assertEquals(refs.length, 1);
|
||||
assertEquals( refs[0].toString(), "setColor" ); //$NON-NLS-1$
|
||||
assertEquals( ((ASTNode)refs[0]).getOffset(), 162);
|
||||
|
@ -1581,7 +1582,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
|
|||
assertTrue( ((IASTName)node).resolveBinding() instanceof IVariable );
|
||||
assertEquals( ((IASTName)node).toString(), "c" ); //$NON-NLS-1$
|
||||
|
||||
IASTName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
IName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals( decls[0].toString(), "c" ); //$NON-NLS-1$
|
||||
assertEquals( ((ASTNode)decls[0]).getOffset(), 42);
|
||||
|
@ -1619,7 +1620,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
|
|||
assertTrue( ((IASTName)node).resolveBinding() instanceof ICPPField );
|
||||
assertEquals( ((IASTName)node).toString(), "i" ); //$NON-NLS-1$
|
||||
|
||||
IASTName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
IName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals( decls[0].toString(), "i" ); //$NON-NLS-1$
|
||||
assertEquals( ((ASTNode)decls[0]).getOffset(), 39);
|
||||
|
@ -1647,7 +1648,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
|
|||
assertTrue( node instanceof IASTName );
|
||||
assertTrue( ((IASTName)node).resolveBinding() instanceof ICPPNamespace );
|
||||
assertEquals( ((IASTName)node).toString(), "Foo" ); //$NON-NLS-1$
|
||||
IASTName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
IName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
assertEquals(decls.length, 2);
|
||||
assertEquals( decls[0].toString(), "Foo" ); //$NON-NLS-1$
|
||||
assertEquals( ((ASTNode)decls[0]).getOffset(), 10);
|
||||
|
@ -1670,7 +1671,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
|
|||
assertTrue( node instanceof IASTName );
|
||||
assertTrue( ((IASTName)node).resolveBinding() instanceof IMacroBinding );
|
||||
assertEquals( ((IASTName)node).toString(), "MyChicken" ); //$NON-NLS-1$
|
||||
IASTName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
IName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals( decls[0].toString(), "MyChicken" ); //$NON-NLS-1$
|
||||
assertEquals( ((ASTNode)decls[0]).getOffset(), 38);
|
||||
|
@ -1696,7 +1697,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
|
|||
assertTrue( node instanceof IASTName );
|
||||
assertTrue( ((IASTName)node).resolveBinding() instanceof ICPPVariable );
|
||||
assertEquals( ((IASTName)node).toString(), "c" ); //$NON-NLS-1$
|
||||
IASTName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
IName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals( decls[0].toString(), "c" ); //$NON-NLS-1$
|
||||
assertEquals( ((ASTNode)decls[0]).getOffset(), 86);
|
||||
|
@ -1707,7 +1708,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
|
|||
assertNotNull( node );
|
||||
assertTrue( node instanceof IASTName );
|
||||
assertTrue( ((IASTName)node).resolveBinding() instanceof ICPPVariable );
|
||||
IASTName[] refs = getReferencesOffTU((IASTName)node);
|
||||
IName[] refs = getReferencesOffTU((IASTName)node);
|
||||
assertEquals(refs.length, 1);
|
||||
assertEquals( refs[0].toString(), "c" ); //$NON-NLS-1$
|
||||
assertEquals( ((ASTNode)refs[0]).getOffset(), 168);
|
||||
|
@ -1729,7 +1730,7 @@ public class DOMSelectionParseTest extends DOMSelectionParseBaseTest {
|
|||
assertTrue( node instanceof IASTName );
|
||||
assertTrue( ((IASTName)node).resolveBinding() instanceof ICPPTemplateInstance );
|
||||
assertEquals( ((IASTName)node).toString(), "AAA" ); //$NON-NLS-1$
|
||||
IASTName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
IName[] decls = getDeclarationOffTU((IASTName)node);
|
||||
assertEquals(decls.length, 1);
|
||||
assertEquals( decls[0].toString(), "AAA" ); //$NON-NLS-1$
|
||||
assertEquals( ((ASTNode)decls[0]).getOffset(), 53);
|
||||
|
|
|
@ -13,8 +13,8 @@ package org.eclipse.cdt.internal.pdom.tests;
|
|||
import java.util.regex.Pattern;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.dom.IName;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.IField;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
||||
|
@ -53,7 +53,7 @@ public class ClassTests extends PDOMTestBase {
|
|||
assertEquals(1, Bmethods.length);
|
||||
ICPPMethod Bf = Bmethods[0];
|
||||
assertEquals("f", Bf.getName());
|
||||
IASTName [] Bf_refs = pdom.getReferences(Bf);
|
||||
IName [] Bf_refs = pdom.getReferences(Bf);
|
||||
assertEquals(1, Bf_refs.length);
|
||||
IASTFileLocation loc = Bf_refs[0].getFileLocation();
|
||||
assertEquals(offset(95, 84), loc.getNodeOffset());
|
||||
|
@ -71,7 +71,7 @@ public class ClassTests extends PDOMTestBase {
|
|||
assertEquals(1, fields.length);
|
||||
IField NestedB_x = fields[0];
|
||||
|
||||
IASTName[] refs = pdom.getReferences(NestedB);
|
||||
IName[] refs = pdom.getReferences(NestedB);
|
||||
assertEquals(1, refs.length);
|
||||
IASTFileLocation loc = refs[0].getFileLocation();
|
||||
assertEquals(offset(96, 87), loc.getNodeOffset());
|
||||
|
@ -88,7 +88,7 @@ public class ClassTests extends PDOMTestBase {
|
|||
ICPPNamespaceScope ns = ((ICPPNamespace)bindings[0]).getNamespaceScope();
|
||||
bindings = ns.find("testRef");
|
||||
assertEquals(1, bindings.length);
|
||||
IASTName[] refs = pdom.getReferences(bindings[0]);
|
||||
IName[] refs = pdom.getReferences(bindings[0]);
|
||||
for (int i = 0; i < refs.length; ++i)
|
||||
System.out.println(refs[i].getFileLocation().getNodeOffset());
|
||||
assertEquals(5, refs.length);
|
||||
|
|
|
@ -13,8 +13,8 @@ package org.eclipse.cdt.internal.pdom.tests;
|
|||
import java.util.regex.Pattern;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.dom.IName;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.IEnumeration;
|
||||
import org.eclipse.cdt.core.dom.ast.IEnumerator;
|
||||
|
@ -56,19 +56,19 @@ public class EnumerationTests extends PDOMTestBase {
|
|||
assertEquals("cc", enumerators[2].getName());
|
||||
|
||||
// Declaration of TestEnum
|
||||
IASTName[] enumDecls = pdom.getDeclarations(enumeration);
|
||||
IName[] enumDecls = pdom.getDeclarations(enumeration);
|
||||
assertEquals(1, enumDecls.length);
|
||||
IASTFileLocation loc = enumDecls[0].getFileLocation();
|
||||
assertEquals(5, loc.getNodeOffset());
|
||||
|
||||
// Reference to TestEnum
|
||||
IASTName[] enumRefs = pdom.getReferences(enumeration);
|
||||
IName[] enumRefs = pdom.getReferences(enumeration);
|
||||
assertEquals(1, enumRefs.length);
|
||||
loc = enumRefs[0].getFileLocation();
|
||||
assertEquals(offset(46, 40), loc.getNodeOffset());
|
||||
|
||||
// Reference to a
|
||||
IASTName[] aRefs = pdom.getReferences(enumerators[0]);
|
||||
IName[] aRefs = pdom.getReferences(enumerators[0]);
|
||||
assertEquals(1, aRefs.length);
|
||||
loc = aRefs[0].getFileLocation();
|
||||
assertEquals(offset(74, 67), loc.getNodeOffset());
|
||||
|
@ -88,19 +88,19 @@ public class EnumerationTests extends PDOMTestBase {
|
|||
assertEquals("cppc", enumerators[2].getName());
|
||||
|
||||
// Declaration of TestEnum
|
||||
IASTName[] enumDecls = pdom.getDeclarations(enumeration);
|
||||
IName[] enumDecls = pdom.getDeclarations(enumeration);
|
||||
assertEquals(1, enumDecls.length);
|
||||
IASTFileLocation loc = enumDecls[0].getFileLocation();
|
||||
assertEquals(5, loc.getNodeOffset());
|
||||
|
||||
// Reference to TestEnum
|
||||
IASTName[] enumRefs = pdom.getReferences(enumeration);
|
||||
IName[] enumRefs = pdom.getReferences(enumeration);
|
||||
assertEquals(1, enumRefs.length);
|
||||
loc = enumRefs[0].getFileLocation();
|
||||
assertEquals(offset(49, 43), loc.getNodeOffset());
|
||||
|
||||
// Reference to a
|
||||
IASTName[] aRefs = pdom.getReferences(enumerators[0]);
|
||||
IName[] aRefs = pdom.getReferences(enumerators[0]);
|
||||
assertEquals(1, aRefs.length);
|
||||
loc = aRefs[0].getFileLocation();
|
||||
assertEquals(offset(79, 72), loc.getNodeOffset());
|
||||
|
|
|
@ -13,8 +13,8 @@ package org.eclipse.cdt.internal.pdom.tests;
|
|||
import java.util.regex.Pattern;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.dom.IName;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.ICompositeType;
|
||||
import org.eclipse.cdt.core.dom.ast.IField;
|
||||
|
@ -56,7 +56,7 @@ public class TypesTests extends PDOMTestBase {
|
|||
assertEquals("x", x.getName());
|
||||
|
||||
// Make sure that there is a reference in g();
|
||||
IASTName[] xRefs = pdom.getReferences(x);
|
||||
IName[] xRefs = pdom.getReferences(x);
|
||||
assertEquals(1, xRefs.length);
|
||||
IASTFileLocation loc = xRefs[0].getFileLocation();
|
||||
assertEquals(offset(85, 77), loc.getNodeOffset());
|
||||
|
@ -73,7 +73,7 @@ public class TypesTests extends PDOMTestBase {
|
|||
assertEquals("f", f.getName());
|
||||
|
||||
// Make sure that there is a reference in g();
|
||||
IASTName[] fRefs = pdom.getReferences(f);
|
||||
IName[] fRefs = pdom.getReferences(f);
|
||||
assertEquals(1, fRefs.length);
|
||||
IASTFileLocation loc = fRefs[0].getFileLocation();
|
||||
assertEquals(offset(84, 74), loc.getNodeOffset());
|
||||
|
@ -83,7 +83,7 @@ public class TypesTests extends PDOMTestBase {
|
|||
IBinding [] bindings = pdom.findBindings(Pattern.compile("spinlock_t"), new NullProgressMonitor());
|
||||
assertEquals(1, bindings.length);
|
||||
ITypedef spinlock_t = (ITypedef)bindings[0];
|
||||
IASTName [] refs = pdom.getReferences(spinlock_t);
|
||||
IName [] refs = pdom.getReferences(spinlock_t);
|
||||
assertEquals(1, refs.length);
|
||||
IASTFileLocation loc = refs[0].getFileLocation();
|
||||
assertEquals(offset(44, 40), loc.getNodeOffset());
|
||||
|
|
|
@ -16,6 +16,7 @@ Export-Package: org.eclipse.cdt.core,
|
|||
org.eclipse.cdt.core.dom.ast.gnu.c,
|
||||
org.eclipse.cdt.core.dom.ast.gnu.cpp,
|
||||
org.eclipse.cdt.core.formatter,
|
||||
org.eclipse.cdt.core.index,
|
||||
org.eclipse.cdt.core.model,
|
||||
org.eclipse.cdt.core.model.util,
|
||||
org.eclipse.cdt.core.parser,
|
||||
|
|
|
@ -13,10 +13,10 @@
|
|||
package org.eclipse.cdt.core.browser;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.dom.IName;
|
||||
import org.eclipse.cdt.core.dom.IPDOM;
|
||||
import org.eclipse.cdt.core.dom.IPDOMResolver;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding;
|
||||
import org.eclipse.cdt.core.model.ICProject;
|
||||
|
@ -122,7 +122,7 @@ public class PDOMTypeInfo implements ITypeInfo {
|
|||
try {
|
||||
IPDOM pdom = CCorePlugin.getPDOMManager().getPDOM(project);
|
||||
IPDOMResolver resolver = (IPDOMResolver) pdom.getAdapter(IPDOMResolver.class);
|
||||
IASTName[] names= resolver.getDefinitions(binding);
|
||||
IName[] names= resolver.getDefinitions(binding);
|
||||
return names != null && names.length > 0 ? new PDOMTypeReference(names[0], project) : null;
|
||||
} catch (CoreException e) {
|
||||
CCorePlugin.log(e);
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
package org.eclipse.cdt.core.browser;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
import org.eclipse.cdt.core.dom.IName;
|
||||
import org.eclipse.cdt.core.model.CoreModel;
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.cdt.core.model.ICProject;
|
||||
|
@ -29,11 +29,11 @@ import org.eclipse.core.runtime.Path;
|
|||
*/
|
||||
public class PDOMTypeReference implements ITypeReference {
|
||||
|
||||
private final IASTName name;
|
||||
private final IName name;
|
||||
private final ICProject project;
|
||||
private final IPath path;
|
||||
|
||||
public PDOMTypeReference(IASTName name, ICProject project) {
|
||||
public PDOMTypeReference(IName name, ICProject project) {
|
||||
this.name = name;
|
||||
this.project = project;
|
||||
this.path = new Path(name.getFileLocation().getFileName());
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2005 QNX Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* QNX - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.core.dom;
|
||||
|
||||
/**
|
||||
* @author Doug Schaefer
|
||||
*
|
||||
*/
|
||||
public interface IIndex {
|
||||
|
||||
/**
|
||||
* Get the index reader. This is used by clients to get at the
|
||||
* contents of the index.
|
||||
*
|
||||
* @return index reader
|
||||
*/
|
||||
public IIndexReader getReader();
|
||||
|
||||
/**
|
||||
* Get the index writer. This is used by indexers to populate
|
||||
* the index.
|
||||
*
|
||||
* @return index writer
|
||||
*/
|
||||
public IIndexWriter getWriter();
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2005 QNX Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* QNX - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.core.dom;
|
||||
|
||||
/**
|
||||
* @author Doug Schaefer
|
||||
*
|
||||
*/
|
||||
public interface IIndexReader {
|
||||
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2005 QNX Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* QNX - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.core.dom;
|
||||
|
||||
/**
|
||||
* @author Doug Schaefer
|
||||
*
|
||||
*/
|
||||
public interface IIndexWriter {
|
||||
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2006 Wind River Systems, Inc. and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Markus Schorn - initial API and implementation
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.core.dom;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
|
||||
/**
|
||||
* Common interface for names in the index and the AST
|
||||
* @since 4.0
|
||||
*/
|
||||
public interface IName {
|
||||
|
||||
public static final IName[] EMPTY_NAME_ARRAY = new IName[0];
|
||||
|
||||
/**
|
||||
* Return a char array representation of the name.
|
||||
*
|
||||
* @return ~ toString().toCharArray()
|
||||
*/
|
||||
public char[] toCharArray();
|
||||
|
||||
/**
|
||||
* Resolve the semantic object this name is referring to.
|
||||
*
|
||||
* @return <code>IBinding</code> binding
|
||||
*/
|
||||
public IBinding resolveBinding();
|
||||
|
||||
/**
|
||||
* Is this name being used in the AST as the introduction of a declaration?
|
||||
* @return boolean
|
||||
*/
|
||||
public boolean isDeclaration();
|
||||
|
||||
/**
|
||||
* Is this name being used in the AST as a reference rather than a declaration?
|
||||
* @return boolean
|
||||
*/
|
||||
|
||||
public boolean isReference();
|
||||
|
||||
/**
|
||||
* Is this name being used in the AST as a reference rather than a declaration?
|
||||
* @return boolean
|
||||
*/
|
||||
public boolean isDefinition();
|
||||
|
||||
/**
|
||||
* Same as {@link IASTNode#getFileLocation()}
|
||||
* @return the file location of this name.
|
||||
*/
|
||||
public IASTFileLocation getFileLocation();
|
||||
}
|
|
@ -26,10 +26,10 @@ public interface IPDOMResolver extends IAdaptable {
|
|||
|
||||
public IBinding resolveBinding(IASTName name);
|
||||
|
||||
public IASTName[] getDeclarations(IBinding binding) throws CoreException;
|
||||
public IName[] getDeclarations(IBinding binding) throws CoreException;
|
||||
|
||||
public IASTName[] getDefinitions(IBinding binding) throws CoreException;
|
||||
public IName[] getDefinitions(IBinding binding) throws CoreException;
|
||||
|
||||
public IASTName[] getReferences(IBinding binding) throws CoreException;
|
||||
public IName[] getReferences(IBinding binding) throws CoreException;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2005 IBM Corporation and others.
|
||||
* Copyright (c) 2004, 2006 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -25,16 +25,18 @@ public interface IASTFileLocation extends IASTNodeLocation {
|
|||
public String getFileName();
|
||||
|
||||
/**
|
||||
* Get the starting line number.
|
||||
* Get the starting line number. Locations obtained via the index do not have line numbers
|
||||
* and return <code>0</code>.
|
||||
*
|
||||
* @return in representing line number
|
||||
* @return int representing line number or <code>0</code> if not applicable
|
||||
*/
|
||||
public int getStartingLineNumber();
|
||||
|
||||
/**
|
||||
* Get the ending line number.
|
||||
* Get the ending line number. Locations obtained via the index do not have line numbers
|
||||
* and return <code>0</code>.
|
||||
*
|
||||
* @return int representing line number
|
||||
* @return int representing line number or <code>0</code> if not applicable
|
||||
*/
|
||||
public int getEndingLineNumber();
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2005 IBM Corporation and others.
|
||||
* Copyright (c) 2004, 2006 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -7,9 +7,12 @@
|
|||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
import org.eclipse.cdt.core.dom.IName;
|
||||
|
||||
/**
|
||||
* This class represents a name in the program that represents a semantic object
|
||||
* in the program.
|
||||
|
@ -19,27 +22,20 @@ package org.eclipse.cdt.core.dom.ast;
|
|||
*
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface IASTName extends IASTNode {
|
||||
public interface IASTName extends IASTNode, IName {
|
||||
|
||||
/**
|
||||
* Constant sentinel.
|
||||
*/
|
||||
public static final IASTName[] EMPTY_NAME_ARRAY = new IASTName[0];
|
||||
|
||||
/**
|
||||
* Resolve the semantic object this name is referring to.
|
||||
*
|
||||
* @return <code>IBinding</code> binding
|
||||
*/
|
||||
public IBinding resolveBinding();
|
||||
|
||||
/**
|
||||
* Get the semantic object attached to this name. May be null if this name
|
||||
* has not yet been semantically resolved (@see resolveBinding)
|
||||
* @return <code>IBinding</code> if it has been resolved, otherwise null
|
||||
*/
|
||||
public IBinding getBinding();
|
||||
|
||||
|
||||
/**
|
||||
* Set the semantic object for this name to be the given binding
|
||||
* @param binding
|
||||
|
@ -53,30 +49,4 @@ public interface IASTName extends IASTNode {
|
|||
* @return <code>IBinding []</code> bindings that start with this name
|
||||
*/
|
||||
public IBinding[] resolvePrefix();
|
||||
|
||||
/**
|
||||
* Return a char array representation of the name.
|
||||
*
|
||||
* @return ~ toString().toCharArray()
|
||||
*/
|
||||
public char[] toCharArray();
|
||||
|
||||
/**
|
||||
* Is this name being used in the AST as the introduction of a declaration?
|
||||
* @return boolean
|
||||
*/
|
||||
public boolean isDeclaration();
|
||||
|
||||
/**
|
||||
* Is this name being used in the AST as a reference rather than a declaration?
|
||||
* @return boolean
|
||||
*/
|
||||
|
||||
public boolean isReference();
|
||||
|
||||
/**
|
||||
* Is this name being used in the AST as a reference rather than a declaration?
|
||||
* @return boolean
|
||||
*/
|
||||
public boolean isDefinition();
|
||||
}
|
||||
|
|
|
@ -7,9 +7,11 @@
|
|||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
import org.eclipse.cdt.core.dom.IName;
|
||||
import org.eclipse.cdt.core.dom.IPDOM;
|
||||
import org.eclipse.cdt.core.model.ILanguage;
|
||||
import org.eclipse.cdt.core.parser.ParserLanguage;
|
||||
|
@ -65,26 +67,48 @@ public interface IASTTranslationUnit extends IASTNode {
|
|||
|
||||
/**
|
||||
* Returns the list of declarations in this translation unit for the given
|
||||
* binding. The list contains the IASTName nodes that declare the binding.
|
||||
* binding. The list contains the IName nodes that declare the binding.
|
||||
* These may be part of the AST or are pulled in from the index.
|
||||
*
|
||||
* @param binding
|
||||
* @return List of IASTName nodes for the binding's declaration
|
||||
* @return Array of IName nodes for the binding's declaration
|
||||
*/
|
||||
public IASTName[] getDeclarations(IBinding binding);
|
||||
public IName[] getDeclarations(IBinding binding);
|
||||
|
||||
/**
|
||||
/**
|
||||
* Returns the list of declarations in this translation unit for the given
|
||||
* binding. The list contains the IASTName nodes that declare the binding.
|
||||
* These are part of the AST no declarations are pulled in from the index.
|
||||
*
|
||||
* @param binding
|
||||
* @return Array of IASTName nodes for the binding's declaration
|
||||
*/
|
||||
public IASTName[] getDeclarationsInAST(IBinding binding);
|
||||
|
||||
/**
|
||||
* Returns the array of definitions in this translation unit for the given binding.
|
||||
* The array contains the IASTName nodes that define the binding.
|
||||
* The array contains the IName nodes that define the binding.
|
||||
* These may be part of the AST or are pulled in from the index.
|
||||
*
|
||||
* @param binding
|
||||
* @return the definition of the IBinding
|
||||
*/
|
||||
public IASTName[] getDefinitions(IBinding binding);
|
||||
public IName[] getDefinitions(IBinding binding);
|
||||
|
||||
/**
|
||||
* Returns the array of definitions in this translation unit for the given binding.
|
||||
* The array contains the IASTName nodes that define the binding.
|
||||
* These are part of the AST no definitions are pulled in from the index.
|
||||
*
|
||||
* @param binding
|
||||
* @return Array of IASTName nodes for the binding's declaration
|
||||
*/
|
||||
public IASTName[] getDefinitionsInAST(IBinding binding);
|
||||
|
||||
/**
|
||||
* Returns the list of references in this translation unit to the given
|
||||
* binding. This list contains the IASTName nodes that represent a use of
|
||||
* the binding.
|
||||
* binding. This list contains the IName nodes that represent a use of
|
||||
* the binding. They may be part of the AST or pulled in from the index.
|
||||
*
|
||||
* @param binding
|
||||
* @return List of IASTName nodes representing uses of the binding
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2005 IBM Corporation and others.
|
||||
* Copyright (c) 2004, 2006 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -7,9 +7,12 @@
|
|||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
import org.eclipse.cdt.core.dom.IName;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -18,11 +21,11 @@ package org.eclipse.cdt.core.dom.ast;
|
|||
public interface IScope {
|
||||
|
||||
/**
|
||||
* Get the IASTName for this scope, may be null
|
||||
* Get the IName for this scope, may be null
|
||||
* @return
|
||||
* @throws DOMException
|
||||
*/
|
||||
public IASTName getScopeName() throws DOMException;
|
||||
public IName getScopeName() throws DOMException;
|
||||
|
||||
/**
|
||||
* Scopes are arranged hierarchically. Lookups will generally
|
||||
|
@ -42,14 +45,13 @@ public interface IScope {
|
|||
* @return List of IBinding
|
||||
*/
|
||||
public IBinding[] find(String name) throws DOMException;
|
||||
|
||||
|
||||
/**
|
||||
* Return the physical IASTNode that this scope was created for
|
||||
* @return
|
||||
*/
|
||||
public IASTNode getPhysicalNode() throws DOMException;
|
||||
|
||||
|
||||
/**
|
||||
* The IScope serves as a mechanism for caching IASTNames and bindings to
|
||||
* speed up resolution.
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2006 Wind River Systems, Inc. and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Markus Schorn - initial API and implementation
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.core.index;
|
||||
|
||||
import org.eclipse.cdt.core.dom.IName;
|
||||
|
||||
|
||||
/**
|
||||
* Interface for all the names in the index. These constitute either a
|
||||
* declaration or a reference.
|
||||
* @since 4.0
|
||||
*/
|
||||
public interface IIndexName extends IName {
|
||||
|
||||
public static final IIndexName[] EMPTY_NAME_ARRAY = new IIndexName[0];
|
||||
|
||||
/**
|
||||
* Returns the location of the file the name resides in.
|
||||
* @since 4.0
|
||||
*/
|
||||
public String getFileName();
|
||||
|
||||
/**
|
||||
* Returns the character offset of the location of the name.
|
||||
* @since 4.0
|
||||
*/
|
||||
public int getNodeOffset();
|
||||
|
||||
/**
|
||||
* Returns the length of the name.
|
||||
* @since 4.0
|
||||
*/
|
||||
public int getNodeLength();
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2005 IBM Corporation and others.
|
||||
* Copyright (c) 2004, 2006 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -7,6 +7,7 @@
|
|||
*
|
||||
* Contributors:
|
||||
* IBM Corporation - initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
|
||||
/*
|
||||
|
@ -16,6 +17,7 @@ package org.eclipse.cdt.internal.core.dom.parser;
|
|||
|
||||
import java.text.MessageFormat;
|
||||
|
||||
import org.eclipse.cdt.core.dom.IName;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
|
@ -140,7 +142,7 @@ public class ProblemBinding extends PlatformObject implements IProblemBinding, I
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IScope#getScopeName()
|
||||
*/
|
||||
public IASTName getScopeName() {
|
||||
public IName getScopeName() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,10 +7,12 @@
|
|||
*
|
||||
* Contributors:
|
||||
* IBM Rational Software - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.dom.IName;
|
||||
import org.eclipse.cdt.core.dom.IPDOM;
|
||||
import org.eclipse.cdt.core.dom.IPDOMResolver;
|
||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||
|
@ -121,15 +123,8 @@ public class CASTTranslationUnit extends CASTNode implements
|
|||
*
|
||||
* @see org.eclipse.cdt.core.dom.ast.IASTTranslationUnit#getDeclarations(org.eclipse.cdt.core.dom.ast.IBinding)
|
||||
*/
|
||||
public IASTName[] getDeclarations(IBinding binding) {
|
||||
if( binding instanceof IMacroBinding )
|
||||
{
|
||||
if( resolver == null )
|
||||
return EMPTY_NAME_ARRAY;
|
||||
return resolver.getDeclarations( (IMacroBinding)binding );
|
||||
}
|
||||
IASTName[] names = CVisitor.getDeclarations(this, binding);
|
||||
|
||||
public IName[] getDeclarations(IBinding binding) {
|
||||
IName[] names= getDeclarationsInAST(binding);
|
||||
if (names.length == 0 && pdom != null) {
|
||||
try {
|
||||
binding = ((PDOM)pdom).getLinkage(getLanguage()).adaptBinding(binding);
|
||||
|
@ -143,26 +138,24 @@ public class CASTTranslationUnit extends CASTNode implements
|
|||
|
||||
return names;
|
||||
}
|
||||
|
||||
|
||||
public IASTName[] getDeclarationsInAST(IBinding binding) {
|
||||
if( binding instanceof IMacroBinding )
|
||||
{
|
||||
if( resolver == null )
|
||||
return EMPTY_NAME_ARRAY;
|
||||
return resolver.getDeclarations( (IMacroBinding)binding );
|
||||
}
|
||||
return CVisitor.getDeclarations(this, binding);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.cdt.core.dom.ast.IASTTranslationUnit#getDefinitions(org.eclipse.cdt.core.dom.ast.IBinding)
|
||||
*/
|
||||
public IASTName[] getDefinitions(IBinding binding) {
|
||||
if (binding instanceof IMacroBinding) {
|
||||
if( resolver == null )
|
||||
return EMPTY_NAME_ARRAY;
|
||||
return resolver.getDeclarations((IMacroBinding)binding);
|
||||
}
|
||||
|
||||
IASTName[] names = CVisitor.getDeclarations(this, binding);
|
||||
for (int i = 0; i < names.length; i++) {
|
||||
if (!names[i].isDefinition())
|
||||
names[i] = null;
|
||||
}
|
||||
names = (IASTName[])ArrayUtil.removeNulls(IASTName.class, names);
|
||||
|
||||
public IName[] getDefinitions(IBinding binding) {
|
||||
IName[] names= getDefinitionsInAST(binding);
|
||||
if (names.length == 0 && pdom != null) {
|
||||
try {
|
||||
binding = ((PDOM)pdom).getLinkage(getLanguage()).adaptBinding(binding);
|
||||
|
@ -173,20 +166,34 @@ public class CASTTranslationUnit extends CASTNode implements
|
|||
return names;
|
||||
}
|
||||
}
|
||||
|
||||
return names;
|
||||
}
|
||||
|
||||
public IASTName[] getDefinitionsInAST(IBinding binding) {
|
||||
if (binding instanceof IMacroBinding) {
|
||||
if (resolver != null) {
|
||||
return resolver.getDeclarations((IMacroBinding)binding);
|
||||
}
|
||||
return IASTName.EMPTY_NAME_ARRAY;
|
||||
}
|
||||
IName[] names = CVisitor.getDeclarations(this, binding);
|
||||
for (int i = 0; i < names.length; i++) {
|
||||
if (!names[i].isDefinition())
|
||||
names[i] = null;
|
||||
}
|
||||
return (IASTName[])ArrayUtil.removeNulls(IASTName.class, names);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.cdt.core.dom.ast.IASTTranslationUnit#getReferences(org.eclipse.cdt.core.dom.ast.IBinding)
|
||||
*/
|
||||
public IASTName[] getReferences(IBinding binding) {
|
||||
if( binding instanceof IMacroBinding )
|
||||
if (binding instanceof IMacroBinding)
|
||||
{
|
||||
if( resolver == null )
|
||||
return EMPTY_NAME_ARRAY;
|
||||
return EMPTY_NAME_ARRAY;
|
||||
return resolver.getReferences( (IMacroBinding)binding );
|
||||
}
|
||||
return CVisitor.getReferences(this, binding);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2005 IBM Corporation and others.
|
||||
* Copyright (c) 2004, 2006 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -7,6 +7,7 @@
|
|||
*
|
||||
* Contributors:
|
||||
* IBM Corporation - initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
|
||||
/*
|
||||
|
@ -14,6 +15,7 @@
|
|||
*/
|
||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||
|
||||
import org.eclipse.cdt.core.dom.IName;
|
||||
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier;
|
||||
|
@ -192,7 +194,7 @@ public class CScope implements ICScope {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IScope#getScopeName()
|
||||
*/
|
||||
public IASTName getScopeName() {
|
||||
public IName getScopeName() {
|
||||
if( physicalNode instanceof IASTCompositeTypeSpecifier ){
|
||||
return ((IASTCompositeTypeSpecifier) physicalNode).getName();
|
||||
}
|
||||
|
|
|
@ -7,10 +7,12 @@
|
|||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.dom.IName;
|
||||
import org.eclipse.cdt.core.dom.IPDOM;
|
||||
import org.eclipse.cdt.core.dom.IPDOMResolver;
|
||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||
|
@ -175,19 +177,18 @@ public class CPPASTTranslationUnit extends CPPASTNode implements
|
|||
} catch (DOMException de) {}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.cdt.core.dom.ast.IASTTranslationUnit#getDeclarations(org.eclipse.cdt.core.dom.ast.IBinding)
|
||||
*/
|
||||
public IASTName[] getDeclarations(IBinding b) {
|
||||
public IASTName[] getDeclarationsInAST(IBinding b) {
|
||||
if( b instanceof IMacroBinding )
|
||||
{
|
||||
if( resolver == null )
|
||||
return EMPTY_NAME_ARRAY;
|
||||
return resolver.getDeclarations( (IMacroBinding)b );
|
||||
}
|
||||
IASTName[] names = CPPVisitor.getDeclarations( this, b );
|
||||
return CPPVisitor.getDeclarations( this, b );
|
||||
}
|
||||
|
||||
public IName[] getDeclarations(IBinding b) {
|
||||
IName[] names = getDeclarationsInAST(b);
|
||||
if (names.length == 0 && pdom != null) {
|
||||
try {
|
||||
b = ((PDOM)pdom).getLinkage(getLanguage()).adaptBinding(b);
|
||||
|
@ -202,25 +203,23 @@ public class CPPASTTranslationUnit extends CPPASTNode implements
|
|||
return names;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.cdt.core.dom.ast.IASTTranslationUnit#getDefinitions(org.eclipse.cdt.core.dom.ast.IBinding)
|
||||
*/
|
||||
public IASTName[] getDefinitions(IBinding binding) {
|
||||
public IASTName[] getDefinitionsInAST(IBinding binding) {
|
||||
if (binding instanceof IMacroBinding) {
|
||||
if( resolver == null )
|
||||
return EMPTY_NAME_ARRAY;
|
||||
return resolver.getDeclarations((IMacroBinding)binding);
|
||||
}
|
||||
|
||||
IASTName[] names = CPPVisitor.getDeclarations(this, binding);
|
||||
IASTName[] names = CPPVisitor.getDeclarations(this, binding);
|
||||
for (int i = 0; i < names.length; i++) {
|
||||
if (!names[i].isDefinition())
|
||||
names[i] = null;
|
||||
}
|
||||
names = (IASTName[])ArrayUtil.removeNulls(IASTName.class, names);
|
||||
|
||||
return (IASTName[])ArrayUtil.removeNulls(IASTName.class, names);
|
||||
}
|
||||
|
||||
public IName[] getDefinitions(IBinding binding) {
|
||||
IName[] names = getDefinitionsInAST(binding);
|
||||
if (names.length == 0 && pdom != null) {
|
||||
try {
|
||||
binding = ((PDOM)pdom).getLinkage(getLanguage()).adaptBinding(binding);
|
||||
|
@ -234,7 +233,7 @@ public class CPPASTTranslationUnit extends CPPASTNode implements
|
|||
|
||||
return names;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
@ -244,10 +243,10 @@ public class CPPASTTranslationUnit extends CPPASTNode implements
|
|||
if( b instanceof IMacroBinding )
|
||||
{
|
||||
if( resolver == null )
|
||||
return EMPTY_NAME_ARRAY;
|
||||
return EMPTY_NAME_ARRAY;
|
||||
return resolver.getReferences( (IMacroBinding)b );
|
||||
}
|
||||
return CPPVisitor.getReferences(this, b);
|
||||
return CPPVisitor.getReferences(this, b);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2005 IBM Corporation and others.
|
||||
* Copyright (c) 2004, 2006 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -7,15 +7,17 @@
|
|||
*
|
||||
* Contributors:
|
||||
* IBM Corporation - initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
|
||||
/*
|
||||
* Created on Nov 29, 2004
|
||||
*/
|
||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.IName;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBlockScope;
|
||||
|
||||
|
@ -27,7 +29,7 @@ public class CPPBlockScope extends CPPNamespaceScope implements ICPPBlockScope {
|
|||
super( physicalNode );
|
||||
}
|
||||
|
||||
public IASTName getScopeName(){
|
||||
public IName getScopeName(){
|
||||
IASTNode node = getPhysicalNode();
|
||||
if( node instanceof IASTCompoundStatement && node.getParent() instanceof IASTFunctionDefinition ){
|
||||
return ((IASTFunctionDefinition)node.getParent()).getDeclarator().getName();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2005 IBM Corporation and others.
|
||||
* Copyright (c) 2005, 2006 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -7,12 +7,14 @@
|
|||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
/*
|
||||
* Created on Mar 28, 2005
|
||||
*/
|
||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.IName;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
|
@ -151,7 +153,7 @@ public class CPPClassInstanceScope implements ICPPClassScope {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPScope#getScopeName()
|
||||
*/
|
||||
public IASTName getScopeName() {
|
||||
public IName getScopeName() {
|
||||
return (IASTName) ((ICPPInternalBinding)instance).getDefinition();
|
||||
}
|
||||
|
||||
|
|
|
@ -7,12 +7,14 @@
|
|||
*
|
||||
* Contributors:
|
||||
* IBM Corporation - initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
/*
|
||||
* Created on Nov 29, 2004
|
||||
*/
|
||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.IName;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTArrayDeclarator;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
|
||||
|
@ -107,7 +109,7 @@ public class CPPClassScope extends CPPScope implements ICPPClassScope {
|
|||
|
||||
//copy assignment operator: A& operator = ( const A & )
|
||||
IType refType = new CPPReferenceType( clsType );
|
||||
m = new CPPImplicitMethod( this, ICPPASTOperatorName.OPERATOR_ASSIGN, refType, ps ); //$NON-NLS-1$
|
||||
m = new CPPImplicitMethod( this, ICPPASTOperatorName.OPERATOR_ASSIGN, refType, ps );
|
||||
implicits[2] = m;
|
||||
addBinding( m );
|
||||
|
||||
|
@ -343,7 +345,7 @@ public class CPPClassScope extends CPPScope implements ICPPClassScope {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPScope#getScopeName()
|
||||
*/
|
||||
public IASTName getScopeName() {
|
||||
public IName getScopeName() {
|
||||
IASTNode node = getPhysicalNode();
|
||||
if( node instanceof ICPPASTCompositeTypeSpecifier ){
|
||||
return ((ICPPASTCompositeTypeSpecifier)node).getName();
|
||||
|
|
|
@ -7,12 +7,14 @@
|
|||
*
|
||||
* Contributors:
|
||||
* IBM Corporation - initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
/*
|
||||
* Created on Dec 1, 2004
|
||||
*/
|
||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.IName;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator;
|
||||
|
@ -121,7 +123,7 @@ public class CPPFunctionScope extends CPPScope implements ICPPFunctionScope {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPScope#getScopeName()
|
||||
*/
|
||||
public IASTName getScopeName() {
|
||||
public IName getScopeName() {
|
||||
IASTNode node = getPhysicalNode();
|
||||
if( node instanceof ICPPASTFunctionDeclarator ){
|
||||
return ((ICPPASTFunctionDeclarator)node).getName();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2005 IBM Corporation and others.
|
||||
* Copyright (c) 2004, 2006 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -7,13 +7,14 @@
|
|||
*
|
||||
* Contributors:
|
||||
* IBM Corporation - initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
/*
|
||||
* Created on Nov 29, 2004
|
||||
*/
|
||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
import org.eclipse.cdt.core.dom.IName;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamespaceDefinition;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceScope;
|
||||
|
@ -45,7 +46,7 @@ public class CPPNamespaceScope extends CPPScope implements ICPPNamespaceScope{
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPScope#getScopeName()
|
||||
*/
|
||||
public IASTName getScopeName() {
|
||||
public IName getScopeName() {
|
||||
IASTNode node = getPhysicalNode();
|
||||
if( node instanceof ICPPASTNamespaceDefinition ){
|
||||
return ((ICPPASTNamespaceDefinition)node).getName();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2005 IBM Corporation and others.
|
||||
* Copyright (c) 2005, 2006 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -7,12 +7,14 @@
|
|||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
/*
|
||||
* Created on Mar 11, 2005
|
||||
*/
|
||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.IName;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||
|
@ -57,7 +59,7 @@ public class CPPTemplateScope extends CPPScope implements ICPPTemplateScope {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPScope#getScopeName()
|
||||
*/
|
||||
public IASTName getScopeName() {
|
||||
public IName getScopeName() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2005 IBM Corporation and others.
|
||||
* Copyright (c) 2004, 2006 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -7,6 +7,7 @@
|
|||
*
|
||||
* Contributors:
|
||||
* IBM Corporation - initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
|
||||
/*
|
||||
|
@ -14,6 +15,7 @@
|
|||
*/
|
||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.IName;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||
|
@ -41,7 +43,7 @@ public class CPPUnknownScope implements ICPPScope {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IScope#getScopeName()
|
||||
*/
|
||||
public IASTName getScopeName() {
|
||||
public IName getScopeName() {
|
||||
return scopeName;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
*
|
||||
* Contributors:
|
||||
* IBM Corporation - initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
/*
|
||||
* Created on Nov 29, 2004
|
||||
|
@ -14,6 +15,7 @@
|
|||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||
|
||||
|
||||
import org.eclipse.cdt.core.dom.IName;
|
||||
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTArrayDeclarator;
|
||||
|
@ -2009,7 +2011,7 @@ public class CPPVisitor {
|
|||
if( scope instanceof ICPPTemplateScope )
|
||||
scope = (ICPPScope) scope.getParent();
|
||||
|
||||
IASTName n = scope.getScopeName();
|
||||
IName n = scope.getScopeName();
|
||||
if( n == null )
|
||||
break;
|
||||
if( scope instanceof ICPPBlockScope || scope instanceof ICPPFunctionScope )
|
||||
|
@ -2039,7 +2041,7 @@ public class CPPVisitor {
|
|||
if( scope instanceof ICPPTemplateScope )
|
||||
scope = (ICPPScope) scope.getParent();
|
||||
|
||||
IASTName n = scope.getScopeName();
|
||||
IName n = scope.getScopeName();
|
||||
if( n == null )
|
||||
break;
|
||||
if( scope instanceof ICPPBlockScope || scope instanceof ICPPFunctionScope )
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
*
|
||||
* Contributors:
|
||||
* QNX - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.pdom;
|
||||
|
||||
|
@ -21,6 +22,7 @@ import java.util.regex.Pattern;
|
|||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.dom.ICodeReaderFactory;
|
||||
import org.eclipse.cdt.core.dom.IName;
|
||||
import org.eclipse.cdt.core.dom.IPDOM;
|
||||
import org.eclipse.cdt.core.dom.IPDOMNode;
|
||||
import org.eclipse.cdt.core.dom.IPDOMResolver;
|
||||
|
@ -52,8 +54,7 @@ import org.eclipse.core.runtime.Status;
|
|||
*
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public class PDOM extends PlatformObject
|
||||
implements IPDOM, IPDOMResolver, IPDOMWriter {
|
||||
public class PDOM extends PlatformObject implements IPDOM, IPDOMResolver, IPDOMWriter {
|
||||
|
||||
private Database db;
|
||||
|
||||
|
@ -201,7 +202,7 @@ public class PDOM extends PlatformObject
|
|||
return new PDOMCodeReaderFactory(this, root);
|
||||
}
|
||||
|
||||
public IASTName[] getDeclarations(IBinding binding) throws CoreException {
|
||||
public IName[] getDeclarations(IBinding binding) throws CoreException {
|
||||
if (binding instanceof PDOMBinding) {
|
||||
List names = new ArrayList();
|
||||
for (PDOMName name = ((PDOMBinding)binding).getFirstDeclaration();
|
||||
|
@ -213,33 +214,33 @@ public class PDOM extends PlatformObject
|
|||
name != null;
|
||||
name = name.getNextInBinding())
|
||||
names.add(name);
|
||||
return (IASTName[])names.toArray(new IASTName[names.size()]);
|
||||
return (IName[])names.toArray(new IName[names.size()]);
|
||||
}
|
||||
return new IASTName[0];
|
||||
return IName.EMPTY_NAME_ARRAY;
|
||||
}
|
||||
|
||||
public IASTName[] getDefinitions(IBinding binding) throws CoreException {
|
||||
public IName[] getDefinitions(IBinding binding) throws CoreException {
|
||||
if (binding instanceof PDOMBinding) {
|
||||
List names = new ArrayList();
|
||||
for (PDOMName name = ((PDOMBinding)binding).getFirstDefinition();
|
||||
name != null;
|
||||
name = name.getNextInBinding())
|
||||
names.add(name);
|
||||
return (IASTName[])names.toArray(new IASTName[names.size()]);
|
||||
return (IName[])names.toArray(new IName[names.size()]);
|
||||
}
|
||||
return new IASTName[0];
|
||||
return IName.EMPTY_NAME_ARRAY;
|
||||
}
|
||||
|
||||
public IASTName[] getReferences(IBinding binding) throws CoreException {
|
||||
public IName[] getReferences(IBinding binding) throws CoreException {
|
||||
if (binding instanceof PDOMBinding) {
|
||||
List names = new ArrayList();
|
||||
for (PDOMName name = ((PDOMBinding)binding).getFirstReference();
|
||||
name != null;
|
||||
name = name.getNextInBinding())
|
||||
names.add(name);
|
||||
return (IASTName[])names.toArray(new IASTName[names.size()]);
|
||||
return (IName[])names.toArray(new IName[names.size()]);
|
||||
}
|
||||
return new IASTName[0];
|
||||
return IName.EMPTY_NAME_ARRAY;
|
||||
}
|
||||
|
||||
public IBinding resolveBinding(IASTName name) {
|
||||
|
@ -377,7 +378,7 @@ public class PDOM extends PlatformObject
|
|||
if (record == 0)
|
||||
return null;
|
||||
else {
|
||||
PDOMNode node = PDOMLinkage.getLinkage(this, record).getNode(record);
|
||||
PDOMNode node = PDOMNode.getLinkage(this, record).getNode(record);
|
||||
return node instanceof PDOMBinding ? (PDOMBinding)node : null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,18 +7,15 @@
|
|||
*
|
||||
* Contributors:
|
||||
* QNX - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.pdom.dom;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTNodeLocation;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
import org.eclipse.cdt.core.index.IIndexName;
|
||||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||
import org.eclipse.cdt.internal.core.pdom.db.Database;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
@ -27,7 +24,7 @@ import org.eclipse.core.runtime.CoreException;
|
|||
* @author Doug Schaefer
|
||||
*
|
||||
*/
|
||||
public class PDOMName implements IASTName, IASTFileLocation {
|
||||
public class PDOMName implements IIndexName, IASTFileLocation {
|
||||
|
||||
private final PDOM pdom;
|
||||
private final int record;
|
||||
|
@ -175,18 +172,6 @@ public class PDOMName implements IASTName, IASTFileLocation {
|
|||
}
|
||||
}
|
||||
|
||||
public IBinding getBinding() {
|
||||
throw new PDOMNotImplementedError();
|
||||
}
|
||||
|
||||
public void setBinding(IBinding binding) {
|
||||
throw new PDOMNotImplementedError();
|
||||
}
|
||||
|
||||
public IBinding[] resolvePrefix() {
|
||||
throw new PDOMNotImplementedError();
|
||||
}
|
||||
|
||||
public char[] toCharArray() {
|
||||
try {
|
||||
Database db = pdom.getDB();
|
||||
|
@ -233,51 +218,10 @@ public class PDOMName implements IASTName, IASTFileLocation {
|
|||
}
|
||||
}
|
||||
|
||||
public IASTTranslationUnit getTranslationUnit() {
|
||||
// TODO Bug 115367 this is dumb - only need for validation checks
|
||||
return new PDOMTranslationUnit();
|
||||
}
|
||||
|
||||
public IASTNodeLocation[] getNodeLocations() {
|
||||
throw new PDOMNotImplementedError();
|
||||
}
|
||||
|
||||
public IASTFileLocation getFileLocation() {
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getContainingFilename() {
|
||||
throw new PDOMNotImplementedError();
|
||||
}
|
||||
|
||||
public IASTNode getParent() {
|
||||
throw new PDOMNotImplementedError();
|
||||
}
|
||||
|
||||
public void setParent(IASTNode node) {
|
||||
throw new PDOMNotImplementedError();
|
||||
}
|
||||
|
||||
public ASTNodeProperty getPropertyInParent() {
|
||||
throw new PDOMNotImplementedError();
|
||||
}
|
||||
|
||||
public void setPropertyInParent(ASTNodeProperty property) {
|
||||
throw new PDOMNotImplementedError();
|
||||
}
|
||||
|
||||
public boolean accept(ASTVisitor visitor) {
|
||||
throw new PDOMNotImplementedError();
|
||||
}
|
||||
|
||||
public String getRawSignature() {
|
||||
throw new PDOMNotImplementedError();
|
||||
}
|
||||
|
||||
public int getEndingLineNumber() {
|
||||
throw new PDOMNotImplementedError();
|
||||
}
|
||||
|
||||
public String getFileName() {
|
||||
try {
|
||||
PDOMFile file = getFile();
|
||||
|
@ -289,11 +233,15 @@ public class PDOMName implements IASTName, IASTFileLocation {
|
|||
}
|
||||
|
||||
public int getStartingLineNumber() {
|
||||
throw new PDOMNotImplementedError();
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int getEndingLineNumber() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public IASTFileLocation asFileLocation() {
|
||||
throw new PDOMNotImplementedError();
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getNodeLength() {
|
||||
|
|
|
@ -1,164 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2005, 2006 QNX Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* QNX - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.pdom.dom;
|
||||
|
||||
import org.eclipse.cdt.core.dom.IPDOM;
|
||||
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTNodeLocation;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTPreprocessorIncludeStatement;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTPreprocessorMacroDefinition;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTPreprocessorStatement;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTProblem;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||
import org.eclipse.cdt.core.model.ILanguage;
|
||||
import org.eclipse.cdt.core.parser.ParserLanguage;
|
||||
|
||||
/**
|
||||
* @author Doug Schaefer
|
||||
*
|
||||
* This is really a dummy translation unit that is necessary for names
|
||||
* to be valid.
|
||||
*/
|
||||
public class PDOMTranslationUnit implements IASTTranslationUnit {
|
||||
|
||||
public IASTDeclaration[] getDeclarations() {
|
||||
throw new PDOMNotImplementedError();
|
||||
}
|
||||
|
||||
public void addDeclaration(IASTDeclaration declaration) {
|
||||
throw new PDOMNotImplementedError();
|
||||
}
|
||||
|
||||
public IScope getScope() {
|
||||
throw new PDOMNotImplementedError();
|
||||
}
|
||||
|
||||
public IASTName[] getDeclarations(IBinding binding) {
|
||||
throw new PDOMNotImplementedError();
|
||||
}
|
||||
|
||||
public IASTName[] getDefinitions(IBinding binding) {
|
||||
throw new PDOMNotImplementedError();
|
||||
}
|
||||
|
||||
public IASTName[] getReferences(IBinding binding) {
|
||||
throw new PDOMNotImplementedError();
|
||||
}
|
||||
|
||||
public IASTNodeLocation[] getLocationInfo(int offset, int length) {
|
||||
throw new PDOMNotImplementedError();
|
||||
}
|
||||
|
||||
public IASTNode selectNodeForLocation(String path, int offset, int length) {
|
||||
throw new PDOMNotImplementedError();
|
||||
}
|
||||
|
||||
public IASTPreprocessorMacroDefinition[] getMacroDefinitions() {
|
||||
throw new PDOMNotImplementedError();
|
||||
}
|
||||
|
||||
public IASTPreprocessorIncludeStatement[] getIncludeDirectives() {
|
||||
throw new PDOMNotImplementedError();
|
||||
}
|
||||
|
||||
public IASTPreprocessorStatement[] getAllPreprocessorStatements() {
|
||||
throw new PDOMNotImplementedError();
|
||||
}
|
||||
|
||||
public IASTProblem[] getPreprocessorProblems() {
|
||||
throw new PDOMNotImplementedError();
|
||||
}
|
||||
|
||||
public String getUnpreprocessedSignature(IASTNodeLocation[] locations) {
|
||||
throw new PDOMNotImplementedError();
|
||||
}
|
||||
|
||||
public String getFilePath() {
|
||||
throw new PDOMNotImplementedError();
|
||||
}
|
||||
|
||||
public IASTFileLocation flattenLocationsToFile(
|
||||
IASTNodeLocation[] nodeLocations) {
|
||||
throw new PDOMNotImplementedError();
|
||||
}
|
||||
|
||||
public IDependencyTree getDependencyTree() {
|
||||
throw new PDOMNotImplementedError();
|
||||
}
|
||||
|
||||
public String getContainingFilename(int offset) {
|
||||
throw new PDOMNotImplementedError();
|
||||
}
|
||||
|
||||
public ParserLanguage getParserLanguage() {
|
||||
throw new PDOMNotImplementedError();
|
||||
}
|
||||
|
||||
public IPDOM getIndex() {
|
||||
throw new PDOMNotImplementedError();
|
||||
}
|
||||
|
||||
public void setIndex(IPDOM pdom) {
|
||||
throw new PDOMNotImplementedError();
|
||||
}
|
||||
|
||||
public IASTTranslationUnit getTranslationUnit() {
|
||||
throw new PDOMNotImplementedError();
|
||||
}
|
||||
|
||||
public IASTNodeLocation[] getNodeLocations() {
|
||||
throw new PDOMNotImplementedError();
|
||||
}
|
||||
|
||||
public IASTFileLocation getFileLocation() {
|
||||
throw new PDOMNotImplementedError();
|
||||
}
|
||||
|
||||
public String getContainingFilename() {
|
||||
throw new PDOMNotImplementedError();
|
||||
}
|
||||
|
||||
public IASTNode getParent() {
|
||||
throw new PDOMNotImplementedError();
|
||||
}
|
||||
|
||||
public void setParent(IASTNode node) {
|
||||
throw new PDOMNotImplementedError();
|
||||
}
|
||||
|
||||
public ASTNodeProperty getPropertyInParent() {
|
||||
throw new PDOMNotImplementedError();
|
||||
}
|
||||
|
||||
public void setPropertyInParent(ASTNodeProperty property) {
|
||||
throw new PDOMNotImplementedError();
|
||||
}
|
||||
|
||||
public boolean accept(ASTVisitor visitor) {
|
||||
throw new PDOMNotImplementedError();
|
||||
}
|
||||
|
||||
public String getRawSignature() {
|
||||
throw new PDOMNotImplementedError();
|
||||
}
|
||||
|
||||
public ILanguage getLanguage() {
|
||||
throw new PDOMNotImplementedError();
|
||||
}
|
||||
|
||||
}
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
package org.eclipse.cdt.internal.core.pdom.dom.c;
|
||||
|
||||
import org.eclipse.cdt.core.dom.IName;
|
||||
import org.eclipse.cdt.core.dom.IPDOMNode;
|
||||
import org.eclipse.cdt.core.dom.IPDOMVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement;
|
||||
|
@ -86,7 +87,7 @@ class PDOMCLinkage extends PDOMLinkage {
|
|||
else if (scopeNode instanceof IASTTranslationUnit)
|
||||
return this;
|
||||
else {
|
||||
IASTName scopeName = scope.getScopeName();
|
||||
IName scopeName = scope.getScopeName();
|
||||
if (scopeName != null) {
|
||||
IBinding scopeBinding = scopeName.resolveBinding();
|
||||
PDOMBinding scopePDOMBinding = adaptBinding(scopeBinding);
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
*
|
||||
* Contributors:
|
||||
* QNX - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
||||
|
@ -17,6 +18,7 @@ import java.util.List;
|
|||
import java.util.Set;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.dom.IName;
|
||||
import org.eclipse.cdt.core.dom.IPDOMNode;
|
||||
import org.eclipse.cdt.core.dom.IPDOMVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
|
@ -39,6 +41,7 @@ import org.eclipse.cdt.internal.core.pdom.dom.IPDOMMemberOwner;
|
|||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMCPPBinding;
|
||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMLinkage;
|
||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMName;
|
||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNotImplementedError;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
@ -322,9 +325,9 @@ class PDOMCPPClassType extends PDOMCPPBinding implements ICPPClassType,
|
|||
throw new PDOMNotImplementedError();
|
||||
}
|
||||
|
||||
public IASTName getScopeName() throws DOMException {
|
||||
public IName getScopeName() throws DOMException {
|
||||
try {
|
||||
IASTName name = getFirstDefinition();
|
||||
PDOMName name = getFirstDefinition();
|
||||
if (name == null)
|
||||
name = getFirstDefinition();
|
||||
return name;
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.IName;
|
||||
import org.eclipse.cdt.core.dom.IPDOMNode;
|
||||
import org.eclipse.cdt.core.dom.IPDOMVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTFunctionCallExpression;
|
||||
|
@ -100,7 +101,7 @@ class PDOMCPPLinkage extends PDOMLinkage {
|
|||
PDOMNode parent = this;
|
||||
IScope scope = binding.getScope();
|
||||
if (scope != null) {
|
||||
IASTName scopeName = scope.getScopeName();
|
||||
IName scopeName = scope.getScopeName();
|
||||
if (scopeName != null) {
|
||||
IBinding scopeBinding = scopeName.resolveBinding();
|
||||
PDOMBinding scopePDOMBinding = adaptBinding(scopeBinding);
|
||||
|
|
|
@ -7,11 +7,13 @@
|
|||
*
|
||||
* Contributors:
|
||||
* QNX - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.dom.IName;
|
||||
import org.eclipse.cdt.core.dom.IPDOMVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTFunctionCallExpression;
|
||||
|
@ -201,7 +203,7 @@ class PDOMCPPNamespace extends PDOMCPPBinding
|
|||
throw new PDOMNotImplementedError();
|
||||
}
|
||||
|
||||
public IASTName getScopeName() throws DOMException {
|
||||
public IName getScopeName() throws DOMException {
|
||||
throw new PDOMNotImplementedError();
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
* Contributors:
|
||||
* IBM Corporation - initial API and implementation
|
||||
* QNX Software Systems
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.ui.editor;
|
||||
|
||||
|
@ -44,12 +45,14 @@ import org.eclipse.cdt.core.CCorePlugin;
|
|||
import org.eclipse.cdt.core.browser.IQualifiedTypeName;
|
||||
import org.eclipse.cdt.core.browser.PathUtil;
|
||||
import org.eclipse.cdt.core.browser.QualifiedTypeName;
|
||||
import org.eclipse.cdt.core.dom.IName;
|
||||
import org.eclipse.cdt.core.dom.IPDOMManager;
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.IEnumeration;
|
||||
import org.eclipse.cdt.core.dom.ast.IFunction;
|
||||
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding;
|
||||
import org.eclipse.cdt.core.index.IIndexName;
|
||||
import org.eclipse.cdt.core.model.CModelException;
|
||||
import org.eclipse.cdt.core.model.CoreModel;
|
||||
import org.eclipse.cdt.core.model.ICProject;
|
||||
|
@ -65,7 +68,6 @@ import org.eclipse.cdt.ui.text.ICHelpInvocationContext;
|
|||
import org.eclipse.cdt.internal.core.pdom.PDOM;
|
||||
import org.eclipse.cdt.internal.core.pdom.dom.IPDOMMemberOwner;
|
||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMName;
|
||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
||||
|
||||
import org.eclipse.cdt.internal.ui.CHelpProviderManager;
|
||||
|
@ -164,9 +166,9 @@ public class AddIncludeOnSelectionAction extends Action implements IUpdate {
|
|||
*/
|
||||
private class DisplayName extends Object
|
||||
{
|
||||
private PDOMName name;
|
||||
private IIndexName name;
|
||||
|
||||
public DisplayName(PDOMName name) {
|
||||
public DisplayName(IIndexName name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
@ -186,7 +188,7 @@ public class AddIncludeOnSelectionAction extends Action implements IUpdate {
|
|||
}
|
||||
}
|
||||
|
||||
public PDOMName getPDOMName()
|
||||
public IIndexName getPDOMName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
@ -268,7 +270,7 @@ public class AddIncludeOnSelectionAction extends Action implements IUpdate {
|
|||
|
||||
cProjectsToSearch.add(cProj); //current project
|
||||
Pattern pattern = Pattern.compile(name);
|
||||
List pdomBindings = new ArrayList();
|
||||
List pdomNames = new ArrayList();
|
||||
//search the projects and get name matching bindings
|
||||
for (int n = 0; n < cProjectsToSearch.size(); n++)
|
||||
{
|
||||
|
@ -278,38 +280,25 @@ public class AddIncludeOnSelectionAction extends Action implements IUpdate {
|
|||
for (int i = 0; i < bindings.length; ++i) {
|
||||
PDOMBinding binding = (PDOMBinding)bindings[i];
|
||||
PDOMBinding pdomBinding = pdom.getLinkage(getTranslationUnit().getLanguage()).adaptBinding(binding);
|
||||
pdomBindings.add(pdomBinding);
|
||||
|
||||
IName[] defs= null;
|
||||
if (pdomBinding instanceof IPDOMMemberOwner //class or struct
|
||||
|| pdomBinding instanceof IEnumeration)
|
||||
{
|
||||
defs= pdom.getDefinitions(pdomBinding);
|
||||
}
|
||||
else if (pdomBinding instanceof ITypedef || pdomBinding instanceof IFunction)
|
||||
{
|
||||
defs= pdom.getDeclarations(pdomBinding);
|
||||
}
|
||||
if (defs != null) {
|
||||
for (int j = 0; j < defs.length; j++) {
|
||||
pdomNames.add(new DisplayName((IIndexName)defs[j]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List pdomNames = new ArrayList();
|
||||
|
||||
//get all the declarations/definitions of the pdomBindings found
|
||||
for (int i = 0; i < pdomBindings.size(); ++i)
|
||||
{
|
||||
PDOMBinding pdomBinding = (PDOMBinding) pdomBindings.get(i);
|
||||
|
||||
if (pdomBinding instanceof IPDOMMemberOwner //class or struct
|
||||
|| pdomBinding instanceof IEnumeration)
|
||||
{
|
||||
PDOMName currentDef = pdomBinding.getFirstDefinition();
|
||||
while(currentDef != null) //get all the definitions of the file to include
|
||||
{
|
||||
pdomNames.add(new DisplayName(currentDef));
|
||||
currentDef = currentDef.getNextInBinding();
|
||||
}
|
||||
}
|
||||
if (pdomBinding instanceof ITypedef || pdomBinding instanceof IFunction)
|
||||
{
|
||||
PDOMName currentDec = pdomBinding.getFirstDeclaration();
|
||||
while(currentDec != null) //get all the declarations of the file to include
|
||||
{
|
||||
pdomNames.add(new DisplayName(currentDec));
|
||||
currentDec = currentDec.getNextInBinding();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (pdomNames.size() > 1)
|
||||
{
|
||||
ElementListSelectionDialog dialog= new ElementListSelectionDialog(getShell(), new TypeInfoLabelProvider(TypeInfoLabelProvider.SHOW_TYPE_ONLY));
|
||||
|
|
|
@ -27,6 +27,7 @@ import org.eclipse.jface.text.Region;
|
|||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.IPositionConverter;
|
||||
import org.eclipse.cdt.core.dom.IName;
|
||||
import org.eclipse.cdt.core.dom.IPDOM;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
|
@ -36,6 +37,7 @@ import org.eclipse.cdt.core.dom.ast.IEnumerator;
|
|||
import org.eclipse.cdt.core.dom.ast.IFunction;
|
||||
import org.eclipse.cdt.core.dom.ast.IVariable;
|
||||
import org.eclipse.cdt.core.dom.ast.c.ICExternalBinding;
|
||||
import org.eclipse.cdt.core.index.IIndexName;
|
||||
import org.eclipse.cdt.core.model.CModelException;
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.cdt.core.model.ICProject;
|
||||
|
@ -50,7 +52,6 @@ import org.eclipse.cdt.internal.core.pdom.PDOM;
|
|||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMFile;
|
||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMInclude;
|
||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMLinkage;
|
||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMName;
|
||||
import org.eclipse.cdt.internal.corext.util.CModelUtil;
|
||||
|
||||
/**
|
||||
|
@ -289,9 +290,9 @@ public class CIndexQueries {
|
|||
try {
|
||||
IBinding binding= getPDOMBinding(pdom, name);
|
||||
if (binding != null) {
|
||||
IASTName[] names= pdom.getReferences(binding);
|
||||
IName[] names= pdom.getReferences(binding);
|
||||
for (int i = 0; i < names.length; i++) {
|
||||
IASTName rname = names[i];
|
||||
IName rname = names[i];
|
||||
ITranslationUnit tu= getTranslationUnit(project, rname);
|
||||
CIndexReference ref= new CIndexReference(tu, rname);
|
||||
ICElement elem = findCalledBy(ref);
|
||||
|
@ -367,7 +368,7 @@ public class CIndexQueries {
|
|||
}
|
||||
|
||||
|
||||
private ITranslationUnit getTranslationUnit(ICProject cproject, IASTName name) {
|
||||
private ITranslationUnit getTranslationUnit(ICProject cproject, IName name) {
|
||||
IPath path= Path.fromOSString(name.getFileLocation().getFileName());
|
||||
try {
|
||||
return CModelUtil.findTranslationUnitForLocation(path, cproject);
|
||||
|
@ -475,11 +476,11 @@ public class CIndexQueries {
|
|||
return EMPTY_ELEMENTS;
|
||||
}
|
||||
|
||||
private ICElement[] getCElementsForNames(ICProject project, IASTName[] defs) {
|
||||
private ICElement[] getCElementsForNames(ICProject project, IName[] defs) {
|
||||
if (defs != null && defs.length > 0) {
|
||||
HashSet result= new HashSet(defs.length);
|
||||
for (int i = 0; i < defs.length; i++) {
|
||||
IASTName defName = defs[i];
|
||||
IName defName = defs[i];
|
||||
assert !defName.isReference();
|
||||
ICElement elem= getCElementForName(project, defName);
|
||||
if (elem != null) {
|
||||
|
@ -491,13 +492,13 @@ public class CIndexQueries {
|
|||
return EMPTY_ELEMENTS;
|
||||
}
|
||||
|
||||
private ICElement getCElementForName(ICProject project, IASTName declName) {
|
||||
private ICElement getCElementForName(ICProject project, IName declName) {
|
||||
assert !declName.isReference();
|
||||
ITranslationUnit tu= getTranslationUnit(project, declName);
|
||||
if (tu != null) {
|
||||
IRegion region= null;
|
||||
if (declName instanceof PDOMName) {
|
||||
PDOMName pname= (PDOMName) declName;
|
||||
if (declName instanceof IIndexName) {
|
||||
IIndexName pname= (IIndexName) declName;
|
||||
region= new Region(pname.getNodeOffset(), pname.getNodeLength());
|
||||
// mstodo use correct timestamp
|
||||
// PDOMFile file= pname.getFile();
|
||||
|
@ -599,10 +600,10 @@ public class CIndexQueries {
|
|||
return null;
|
||||
}
|
||||
|
||||
private ICElement getFirstCElementForNames(ICProject project, IASTName[] defs) {
|
||||
private ICElement getFirstCElementForNames(ICProject project, IName[] defs) {
|
||||
if (defs != null) {
|
||||
for (int i = 0; i < defs.length; i++) {
|
||||
IASTName defName = defs[i];
|
||||
IName defName = defs[i];
|
||||
ICElement elem= getCElementForName(project, defName);
|
||||
if (elem != null) {
|
||||
return elem;
|
||||
|
|
|
@ -13,7 +13,7 @@ package org.eclipse.cdt.internal.ui.missingapi;
|
|||
|
||||
import java.util.Comparator;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
import org.eclipse.cdt.core.dom.IName;
|
||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||
|
||||
public class CIndexReference {
|
||||
|
@ -28,7 +28,7 @@ public class CIndexReference {
|
|||
private int fLength;
|
||||
private ITranslationUnit fTranslationUnit;
|
||||
|
||||
public CIndexReference(ITranslationUnit tu, IASTName name) {
|
||||
public CIndexReference(ITranslationUnit tu, IName name) {
|
||||
fTranslationUnit= tu;
|
||||
fOffset= name.getFileLocation().getNodeOffset();
|
||||
fLength= name.getFileLocation().getNodeLength();
|
||||
|
|
|
@ -12,15 +12,6 @@
|
|||
|
||||
package org.eclipse.cdt.internal.ui.search.actions;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.IProblemBinding;
|
||||
import org.eclipse.cdt.core.model.IWorkingCopy;
|
||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
||||
import org.eclipse.cdt.internal.ui.editor.CEditor;
|
||||
import org.eclipse.cdt.internal.ui.editor.CEditorMessages;
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
|
@ -30,6 +21,19 @@ import org.eclipse.core.runtime.jobs.Job;
|
|||
import org.eclipse.jface.text.ITextSelection;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
|
||||
import org.eclipse.cdt.core.dom.IName;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.IProblemBinding;
|
||||
import org.eclipse.cdt.core.model.IWorkingCopy;
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
|
||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
||||
|
||||
import org.eclipse.cdt.internal.ui.editor.CEditor;
|
||||
import org.eclipse.cdt.internal.ui.editor.CEditorMessages;
|
||||
|
||||
public class OpenDeclarationsAction extends SelectionParseAction {
|
||||
public static final IASTName[] BLANK_NAME_ARRAY = new IASTName[0];
|
||||
ITextSelection selNode;
|
||||
|
@ -70,7 +74,7 @@ public class OpenDeclarationsAction extends SelectionParseAction {
|
|||
|
||||
IBinding binding = searchName.resolveBinding();
|
||||
if (binding != null && !(binding instanceof IProblemBinding)) {
|
||||
final IASTName[] declNames = ast.getDeclarations(binding);
|
||||
final IName[] declNames = ast.getDeclarations(binding);
|
||||
if (declNames.length > 0) {
|
||||
runInUIThread(new Runnable() {
|
||||
public void run() {
|
||||
|
@ -83,11 +87,11 @@ public class OpenDeclarationsAction extends SelectionParseAction {
|
|||
});
|
||||
} else if (binding instanceof PDOMBinding) {
|
||||
PDOMBinding pdomBinding = (PDOMBinding)binding;
|
||||
IASTName name = pdomBinding.getFirstDefinition();
|
||||
IName name = pdomBinding.getFirstDefinition();
|
||||
if (name == null)
|
||||
name = pdomBinding.getFirstDeclaration();
|
||||
if (name != null) {
|
||||
final IASTName dname = name;
|
||||
final IName dname = name;
|
||||
Display.getDefault().asyncExec(new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
|
|
|
@ -20,6 +20,7 @@ import org.eclipse.core.runtime.jobs.Job;
|
|||
import org.eclipse.jface.text.ITextSelection;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
|
||||
import org.eclipse.cdt.core.dom.IName;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
|
@ -72,7 +73,7 @@ public class OpenDefinitionAction extends SelectionParseAction {
|
|||
|
||||
IBinding binding = searchName.resolveBinding();
|
||||
if (binding != null) {
|
||||
final IASTName[] declNames = ast.getDefinitions(binding);
|
||||
final IName[] declNames = ast.getDefinitions(binding);
|
||||
if (declNames.length > 0) {
|
||||
runInUIThread(new Runnable() {
|
||||
public void run() {
|
||||
|
|
|
@ -36,8 +36,8 @@ import org.eclipse.ui.ide.IDE;
|
|||
import org.eclipse.ui.texteditor.IDocumentProvider;
|
||||
import org.eclipse.ui.texteditor.ITextEditor;
|
||||
|
||||
import org.eclipse.cdt.core.dom.IName;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
import org.eclipse.cdt.core.model.CoreModel;
|
||||
import org.eclipse.cdt.core.parser.Keywords;
|
||||
import org.eclipse.cdt.core.resources.FileStorage;
|
||||
|
@ -454,7 +454,7 @@ public class SelectionParseAction extends Action {
|
|||
*
|
||||
* @param name
|
||||
*/
|
||||
protected void open(IASTName name) throws CoreException {
|
||||
protected void open(IName name) throws CoreException {
|
||||
IASTFileLocation fileloc = name.getFileLocation();
|
||||
if (fileloc == null)
|
||||
// no source location - TODO spit out an error in the status bar
|
||||
|
|
Loading…
Add table
Reference in a new issue