mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-09 01:05:38 +02:00
Change visiting of AST tree.
-> added IASTNode.accept( ASTVisitor ) -> old BaseVisitorAction is now ASTVisitor -> old CBaseVisitorAction is now CASTVisitor (extends ASTVisitor) -> old CPPBaseVisitorAction is now CPPASTVisitor (extends ASTVisitor) -> old IASTVisitor, ICASTVisitor, ICPPASTVisitor are gone -> CVisitor.visit* and CPPVisitor.visit* are gone, replaced by accept on each ast node. now, instead of tu.getVisitor().visitTranslationUnit( action ) do tu.accept( action )
This commit is contained in:
parent
0afd9dc95c
commit
623eeb6f1d
159 changed files with 3207 additions and 1502 deletions
|
@ -32,7 +32,9 @@ import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTypeIdExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTTypeIdExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.c.CASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.c.ICASTTypeIdInitializerExpression;
|
import org.eclipse.cdt.core.dom.ast.c.ICASTTypeIdInitializerExpression;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.CPPASTVisitor;
|
||||||
import org.eclipse.cdt.core.parser.CodeReader;
|
import org.eclipse.cdt.core.parser.CodeReader;
|
||||||
import org.eclipse.cdt.core.parser.IParserLogService;
|
import org.eclipse.cdt.core.parser.IParserLogService;
|
||||||
import org.eclipse.cdt.core.parser.IScanner;
|
import org.eclipse.cdt.core.parser.IScanner;
|
||||||
|
@ -222,12 +224,12 @@ public class AST2BaseTest extends TestCase {
|
||||||
return s.getExpression();
|
return s.getExpression();
|
||||||
}
|
}
|
||||||
|
|
||||||
static protected class CNameCollector extends CVisitor.CBaseVisitorAction {
|
static protected class CNameCollector extends CASTVisitor {
|
||||||
{
|
{
|
||||||
processNames = true;
|
shouldVisitNames = true;
|
||||||
}
|
}
|
||||||
public List nameList = new ArrayList();
|
public List nameList = new ArrayList();
|
||||||
public int processName( IASTName name ){
|
public int visit( IASTName name ){
|
||||||
nameList.add( name );
|
nameList.add( name );
|
||||||
return PROCESS_CONTINUE;
|
return PROCESS_CONTINUE;
|
||||||
}
|
}
|
||||||
|
@ -251,12 +253,12 @@ public class AST2BaseTest extends TestCase {
|
||||||
assertEquals( count, num );
|
assertEquals( count, num );
|
||||||
}
|
}
|
||||||
|
|
||||||
static protected class CPPNameCollector extends CPPVisitor.CPPBaseVisitorAction {
|
static protected class CPPNameCollector extends CPPASTVisitor {
|
||||||
{
|
{
|
||||||
processNames = true;
|
shouldVisitNames = true;
|
||||||
}
|
}
|
||||||
public List nameList = new ArrayList();
|
public List nameList = new ArrayList();
|
||||||
public int processName( IASTName name ){
|
public int visit( IASTName name ){
|
||||||
nameList.add( name );
|
nameList.add( name );
|
||||||
return PROCESS_CONTINUE;
|
return PROCESS_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -379,7 +379,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
|
|
||||||
CPPNameCollector collector = new CPPNameCollector();
|
CPPNameCollector collector = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( collector);
|
tu.accept( collector);
|
||||||
|
|
||||||
assertEquals(collector.size(), 13);
|
assertEquals(collector.size(), 13);
|
||||||
ICPPNamespace A = (ICPPNamespace) collector.getName(0).resolveBinding();
|
ICPPNamespace A = (ICPPNamespace) collector.getName(0).resolveBinding();
|
||||||
|
@ -409,7 +409,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
|
|
||||||
CPPNameCollector collector = new CPPNameCollector();
|
CPPNameCollector collector = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( collector);
|
tu.accept( collector);
|
||||||
|
|
||||||
assertEquals(collector.size(), 6);
|
assertEquals(collector.size(), 6);
|
||||||
IVariable vA = (IVariable) collector.getName(0).resolveBinding();
|
IVariable vA = (IVariable) collector.getName(0).resolveBinding();
|
||||||
|
@ -423,7 +423,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
tu = parse(buffer.toString(), ParserLanguage.CPP);
|
tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
collector = new CPPNameCollector();
|
collector = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( collector);
|
tu.accept( collector);
|
||||||
|
|
||||||
cA = (ICompositeType) collector.getName(1).resolveBinding();
|
cA = (ICompositeType) collector.getName(1).resolveBinding();
|
||||||
IBinding A = collector.getName(3).resolveBinding();
|
IBinding A = collector.getName(3).resolveBinding();
|
||||||
|
@ -442,7 +442,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector collector = new CPPNameCollector();
|
CPPNameCollector collector = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( collector);
|
tu.accept( collector);
|
||||||
|
|
||||||
assertEquals(collector.size(), 9);
|
assertEquals(collector.size(), 9);
|
||||||
ICompositeType A = (ICompositeType) collector.getName(0)
|
ICompositeType A = (ICompositeType) collector.getName(0)
|
||||||
|
@ -472,7 +472,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector collector = new CPPNameCollector();
|
CPPNameCollector collector = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( collector);
|
tu.accept( collector);
|
||||||
IFunction f1 = (IFunction) collector.getName(0).resolveBinding();
|
IFunction f1 = (IFunction) collector.getName(0).resolveBinding();
|
||||||
IFunction f2 = (IFunction) collector.getName(2).resolveBinding();
|
IFunction f2 = (IFunction) collector.getName(2).resolveBinding();
|
||||||
|
|
||||||
|
@ -492,7 +492,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buff.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buff.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector collector = new CPPNameCollector();
|
CPPNameCollector collector = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( collector);
|
tu.accept( collector);
|
||||||
ICPPClassType anonStruct = (ICPPClassType) collector.getName(0)
|
ICPPClassType anonStruct = (ICPPClassType) collector.getName(0)
|
||||||
.resolveBinding();
|
.resolveBinding();
|
||||||
ICPPField x = (ICPPField) collector.getName(1).resolveBinding();
|
ICPPField x = (ICPPField) collector.getName(1).resolveBinding();
|
||||||
|
@ -517,7 +517,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector collector = new CPPNameCollector();
|
CPPNameCollector collector = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( collector);
|
tu.accept( collector);
|
||||||
|
|
||||||
ICPPClassType A1 = (ICPPClassType) collector.getName(0)
|
ICPPClassType A1 = (ICPPClassType) collector.getName(0)
|
||||||
.resolveBinding();
|
.resolveBinding();
|
||||||
|
@ -542,7 +542,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector collector = new CPPNameCollector();
|
CPPNameCollector collector = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( collector);
|
tu.accept( collector);
|
||||||
|
|
||||||
ICPPClassType A1 = (ICPPClassType) collector.getName(0)
|
ICPPClassType A1 = (ICPPClassType) collector.getName(0)
|
||||||
.resolveBinding();
|
.resolveBinding();
|
||||||
|
@ -568,7 +568,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector collector = new CPPNameCollector();
|
CPPNameCollector collector = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( collector);
|
tu.accept( collector);
|
||||||
|
|
||||||
ICPPClassType A1 = (ICPPClassType) collector.getName(0)
|
ICPPClassType A1 = (ICPPClassType) collector.getName(0)
|
||||||
.resolveBinding();
|
.resolveBinding();
|
||||||
|
@ -589,7 +589,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector collector = new CPPNameCollector();
|
CPPNameCollector collector = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( collector);
|
tu.accept( collector);
|
||||||
|
|
||||||
ICPPClassType x = (ICPPClassType) collector.getName(0).resolveBinding();
|
ICPPClassType x = (ICPPClassType) collector.getName(0).resolveBinding();
|
||||||
|
|
||||||
|
@ -605,7 +605,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector collector = new CPPNameCollector();
|
CPPNameCollector collector = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( collector);
|
tu.accept( collector);
|
||||||
|
|
||||||
IFunction f = (IFunction) collector.getName(0).resolveBinding();
|
IFunction f = (IFunction) collector.getName(0).resolveBinding();
|
||||||
IParameter a = (IParameter) collector.getName(1).resolveBinding();
|
IParameter a = (IParameter) collector.getName(1).resolveBinding();
|
||||||
|
@ -628,7 +628,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector collector = new CPPNameCollector();
|
CPPNameCollector collector = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( collector);
|
tu.accept( collector);
|
||||||
|
|
||||||
IFunction f = (IFunction) collector.getName(0).resolveBinding();
|
IFunction f = (IFunction) collector.getName(0).resolveBinding();
|
||||||
IFunction g = (IFunction) collector.getName(1).resolveBinding();
|
IFunction g = (IFunction) collector.getName(1).resolveBinding();
|
||||||
|
@ -647,7 +647,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector collector = new CPPNameCollector();
|
CPPNameCollector collector = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( collector);
|
tu.accept( collector);
|
||||||
|
|
||||||
IVariable i = (IVariable) collector.getName(1).resolveBinding();
|
IVariable i = (IVariable) collector.getName(1).resolveBinding();
|
||||||
|
|
||||||
|
@ -663,7 +663,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector collector = new CPPNameCollector();
|
CPPNameCollector collector = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( collector);
|
tu.accept( collector);
|
||||||
|
|
||||||
ICPPClassType A = (ICPPClassType) collector.getName(0).resolveBinding();
|
ICPPClassType A = (ICPPClassType) collector.getName(0).resolveBinding();
|
||||||
IField x = (IField) collector.getName(1).resolveBinding();
|
IField x = (IField) collector.getName(1).resolveBinding();
|
||||||
|
@ -685,7 +685,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector collector = new CPPNameCollector();
|
CPPNameCollector collector = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( collector);
|
tu.accept( collector);
|
||||||
|
|
||||||
IEnumeration hue = (IEnumeration) collector.getName(0).resolveBinding();
|
IEnumeration hue = (IEnumeration) collector.getName(0).resolveBinding();
|
||||||
IEnumerator red = (IEnumerator) collector.getName(1).resolveBinding();
|
IEnumerator red = (IEnumerator) collector.getName(1).resolveBinding();
|
||||||
|
@ -709,7 +709,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
public void testPointerToFunction() throws Exception {
|
public void testPointerToFunction() throws Exception {
|
||||||
IASTTranslationUnit tu = parse("int (*pfi)();", ParserLanguage.CPP); //$NON-NLS-1$
|
IASTTranslationUnit tu = parse("int (*pfi)();", ParserLanguage.CPP); //$NON-NLS-1$
|
||||||
CPPNameCollector collector = new CPPNameCollector();
|
CPPNameCollector collector = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( collector);
|
tu.accept( collector);
|
||||||
IVariable pf = (IVariable) collector.getName(0).resolveBinding();
|
IVariable pf = (IVariable) collector.getName(0).resolveBinding();
|
||||||
IPointerType pt = (IPointerType) pf.getType();
|
IPointerType pt = (IPointerType) pf.getType();
|
||||||
assertTrue(pt.getType() instanceof IFunctionType);
|
assertTrue(pt.getType() instanceof IFunctionType);
|
||||||
|
@ -717,7 +717,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
tu = parse(
|
tu = parse(
|
||||||
"struct A; int (*pfi)( int, struct A * );", ParserLanguage.CPP); //$NON-NLS-1$
|
"struct A; int (*pfi)( int, struct A * );", ParserLanguage.CPP); //$NON-NLS-1$
|
||||||
collector = new CPPNameCollector();
|
collector = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( collector);
|
tu.accept( collector);
|
||||||
ICPPClassType A = (ICPPClassType) collector.getName(0).resolveBinding();
|
ICPPClassType A = (ICPPClassType) collector.getName(0).resolveBinding();
|
||||||
pf = (IVariable) collector.getName(1).resolveBinding();
|
pf = (IVariable) collector.getName(1).resolveBinding();
|
||||||
pt = (IPointerType) pf.getType();
|
pt = (IPointerType) pf.getType();
|
||||||
|
@ -840,7 +840,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector collector = new CPPNameCollector();
|
CPPNameCollector collector = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( collector);
|
tu.accept( collector);
|
||||||
|
|
||||||
IFunction f = (IFunction) collector.getName(0).resolveBinding();
|
IFunction f = (IFunction) collector.getName(0).resolveBinding();
|
||||||
ICPPNamespace A = (ICPPNamespace) collector.getName(1).resolveBinding();
|
ICPPNamespace A = (ICPPNamespace) collector.getName(1).resolveBinding();
|
||||||
|
@ -866,7 +866,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector collector = new CPPNameCollector();
|
CPPNameCollector collector = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( collector);
|
tu.accept( collector);
|
||||||
|
|
||||||
IFunction f = (IFunction) collector.getName(1).resolveBinding();
|
IFunction f = (IFunction) collector.getName(1).resolveBinding();
|
||||||
IFunction g = (IFunction) collector.getName(8).resolveBinding();
|
IFunction g = (IFunction) collector.getName(8).resolveBinding();
|
||||||
|
@ -889,7 +889,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector collector = new CPPNameCollector();
|
CPPNameCollector collector = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( collector);
|
tu.accept( collector);
|
||||||
|
|
||||||
IProblemBinding x = (IProblemBinding) collector.getName(12)
|
IProblemBinding x = (IProblemBinding) collector.getName(12)
|
||||||
.resolveBinding();
|
.resolveBinding();
|
||||||
|
@ -909,7 +909,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector collector = new CPPNameCollector();
|
CPPNameCollector collector = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( collector);
|
tu.accept( collector);
|
||||||
|
|
||||||
assertEquals(collector.size(), 15);
|
assertEquals(collector.size(), 15);
|
||||||
|
|
||||||
|
@ -940,7 +940,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector collector = new CPPNameCollector();
|
CPPNameCollector collector = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( collector);
|
tu.accept( collector);
|
||||||
|
|
||||||
assertEquals(collector.size(), 15);
|
assertEquals(collector.size(), 15);
|
||||||
|
|
||||||
|
@ -974,7 +974,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector collector = new CPPNameCollector();
|
CPPNameCollector collector = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( collector);
|
tu.accept( collector);
|
||||||
|
|
||||||
assertEquals(collector.size(), 6);
|
assertEquals(collector.size(), 6);
|
||||||
|
|
||||||
|
@ -1049,7 +1049,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col);
|
tu.accept( col);
|
||||||
|
|
||||||
assertEquals(col.size(), 8);
|
assertEquals(col.size(), 8);
|
||||||
ICPPNamespace A = (ICPPNamespace) col.getName(0).resolveBinding();
|
ICPPNamespace A = (ICPPNamespace) col.getName(0).resolveBinding();
|
||||||
|
@ -1076,7 +1076,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col);
|
tu.accept( col);
|
||||||
|
|
||||||
assertEquals(col.size(), 3);
|
assertEquals(col.size(), 3);
|
||||||
IVariable p = (IVariable) col.getName(1).resolveBinding();
|
IVariable p = (IVariable) col.getName(1).resolveBinding();
|
||||||
|
@ -1097,7 +1097,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col);
|
tu.accept( col);
|
||||||
|
|
||||||
assertEquals(col.size(), 3);
|
assertEquals(col.size(), 3);
|
||||||
|
|
||||||
|
@ -1114,7 +1114,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col);
|
tu.accept( col);
|
||||||
|
|
||||||
assertEquals(col.size(), 7);
|
assertEquals(col.size(), 7);
|
||||||
|
|
||||||
|
@ -1128,7 +1128,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
public void testBug84266_2() throws Exception {
|
public void testBug84266_2() throws Exception {
|
||||||
IASTTranslationUnit tu = parse("struct s f(void);", ParserLanguage.CPP); //$NON-NLS-1$
|
IASTTranslationUnit tu = parse("struct s f(void);", ParserLanguage.CPP); //$NON-NLS-1$
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col);
|
tu.accept( col);
|
||||||
|
|
||||||
assertEquals(col.size(), 3);
|
assertEquals(col.size(), 3);
|
||||||
|
|
||||||
|
@ -1137,7 +1137,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
tu = parse("struct s f(void){}", ParserLanguage.CPP); //$NON-NLS-1$
|
tu = parse("struct s f(void){}", ParserLanguage.CPP); //$NON-NLS-1$
|
||||||
col = new CPPNameCollector();
|
col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col);
|
tu.accept( col);
|
||||||
|
|
||||||
assertEquals(col.size(), 3);
|
assertEquals(col.size(), 3);
|
||||||
|
|
||||||
|
@ -1155,7 +1155,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col);
|
tu.accept( col);
|
||||||
|
|
||||||
assertEquals(col.size(), 13);
|
assertEquals(col.size(), 13);
|
||||||
|
|
||||||
|
@ -1183,7 +1183,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col);
|
tu.accept( col);
|
||||||
|
|
||||||
assertEquals(col.size(), 9);
|
assertEquals(col.size(), 9);
|
||||||
|
|
||||||
|
@ -1231,7 +1231,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col);
|
tu.accept( col);
|
||||||
|
|
||||||
ICPPNamespace Y = (ICPPNamespace) col.getName(0).resolveBinding();
|
ICPPNamespace Y = (ICPPNamespace) col.getName(0).resolveBinding();
|
||||||
ICPPNamespace A = (ICPPNamespace) col.getName(3).resolveBinding();
|
ICPPNamespace A = (ICPPNamespace) col.getName(3).resolveBinding();
|
||||||
|
@ -1262,7 +1262,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col);
|
tu.accept( col);
|
||||||
|
|
||||||
assertEquals(col.size(), 9);
|
assertEquals(col.size(), 9);
|
||||||
|
|
||||||
|
@ -1283,7 +1283,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col);
|
tu.accept( col);
|
||||||
|
|
||||||
assertEquals(col.size(), 11);
|
assertEquals(col.size(), 11);
|
||||||
|
|
||||||
|
@ -1309,7 +1309,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col);
|
tu.accept( col);
|
||||||
|
|
||||||
assertEquals(col.size(), 17);
|
assertEquals(col.size(), 17);
|
||||||
|
|
||||||
|
@ -1368,7 +1368,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
public void testBug84710() throws Exception {
|
public void testBug84710() throws Exception {
|
||||||
IASTTranslationUnit tu = parse("class T { T(); };", ParserLanguage.CPP); //$NON-NLS-1$
|
IASTTranslationUnit tu = parse("class T { T(); };", ParserLanguage.CPP); //$NON-NLS-1$
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col);
|
tu.accept( col);
|
||||||
ICPPConstructor T = (ICPPConstructor) col.getName(1).resolveBinding();
|
ICPPConstructor T = (ICPPConstructor) col.getName(1).resolveBinding();
|
||||||
assertTrue(CharArrayUtils.equals(T.getNameCharArray(),
|
assertTrue(CharArrayUtils.equals(T.getNameCharArray(),
|
||||||
"T".toCharArray())); //$NON-NLS-1$
|
"T".toCharArray())); //$NON-NLS-1$
|
||||||
|
@ -1388,7 +1388,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP); //$NON-NLS-1$
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP); //$NON-NLS-1$
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col);
|
tu.accept( col);
|
||||||
|
|
||||||
ICPPNamespace NS = (ICPPNamespace) col.getName(0).resolveBinding();
|
ICPPNamespace NS = (ICPPNamespace) col.getName(0).resolveBinding();
|
||||||
ICPPClassType T = (ICPPClassType) col.getName(1).resolveBinding();
|
ICPPClassType T = (ICPPClassType) col.getName(1).resolveBinding();
|
||||||
|
@ -1418,7 +1418,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col);
|
tu.accept( col);
|
||||||
|
|
||||||
IFunction fref = (IFunction) col.getName(14).resolveBinding();
|
IFunction fref = (IFunction) col.getName(14).resolveBinding();
|
||||||
IFunction f1 = (IFunction) col.getName(1).resolveBinding();
|
IFunction f1 = (IFunction) col.getName(1).resolveBinding();
|
||||||
|
@ -1449,7 +1449,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col);
|
tu.accept( col);
|
||||||
|
|
||||||
assertEquals(17, col.size());
|
assertEquals(17, col.size());
|
||||||
|
|
||||||
|
@ -1478,7 +1478,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col);
|
tu.accept( col);
|
||||||
|
|
||||||
assertEquals(8, col.size());
|
assertEquals(8, col.size());
|
||||||
|
|
||||||
|
@ -1500,7 +1500,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col);
|
tu.accept( col);
|
||||||
|
|
||||||
assertEquals(9, col.size());
|
assertEquals(9, col.size());
|
||||||
}
|
}
|
||||||
|
@ -1509,7 +1509,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
IASTTranslationUnit tu = parse("struct S; int S::* pm;", //$NON-NLS-1$
|
IASTTranslationUnit tu = parse("struct S; int S::* pm;", //$NON-NLS-1$
|
||||||
ParserLanguage.CPP);
|
ParserLanguage.CPP);
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col);
|
tu.accept( col);
|
||||||
|
|
||||||
assertEquals(4, col.size());
|
assertEquals(4, col.size());
|
||||||
|
|
||||||
|
@ -1534,7 +1534,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col);
|
tu.accept( col);
|
||||||
|
|
||||||
IBinding ref = col.getName(11).resolveBinding();
|
IBinding ref = col.getName(11).resolveBinding();
|
||||||
IVariable pm = (IVariable) col.getName(5).resolveBinding();
|
IVariable pm = (IVariable) col.getName(5).resolveBinding();
|
||||||
|
@ -1555,7 +1555,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col);
|
tu.accept( col);
|
||||||
|
|
||||||
ICPPClassType S = (ICPPClassType) col.getName(0).resolveBinding();
|
ICPPClassType S = (ICPPClassType) col.getName(0).resolveBinding();
|
||||||
IVariable pm = (IVariable) col.getName(8).resolveBinding();
|
IVariable pm = (IVariable) col.getName(8).resolveBinding();
|
||||||
|
@ -1588,7 +1588,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col);
|
tu.accept( col);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testFindTypeBinding_1() throws Exception {
|
public void testFindTypeBinding_1() throws Exception {
|
||||||
|
@ -1651,7 +1651,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col);
|
tu.accept( col);
|
||||||
|
|
||||||
IFunction f = (IFunction) col.getName(15).resolveBinding();
|
IFunction f = (IFunction) col.getName(15).resolveBinding();
|
||||||
ICPPClassType A = (ICPPClassType) col.getName(0).resolveBinding();
|
ICPPClassType A = (ICPPClassType) col.getName(0).resolveBinding();
|
||||||
|
@ -1679,7 +1679,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col);
|
tu.accept( col);
|
||||||
|
|
||||||
IFunction f = (IFunction) col.getName(16).resolveBinding();
|
IFunction f = (IFunction) col.getName(16).resolveBinding();
|
||||||
ICPPNamespace N = (ICPPNamespace) col.getName(0).resolveBinding();
|
ICPPNamespace N = (ICPPNamespace) col.getName(0).resolveBinding();
|
||||||
|
@ -1707,7 +1707,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col);
|
tu.accept( col);
|
||||||
|
|
||||||
IFunction f = (IFunction) col.getName(27).resolveBinding();
|
IFunction f = (IFunction) col.getName(27).resolveBinding();
|
||||||
ICPPNamespace M = (ICPPNamespace) col.getName(0).resolveBinding();
|
ICPPNamespace M = (ICPPNamespace) col.getName(0).resolveBinding();
|
||||||
|
@ -1735,7 +1735,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col);
|
tu.accept( col);
|
||||||
|
|
||||||
ICPPClassType A = (ICPPClassType) col.getName(0).resolveBinding();
|
ICPPClassType A = (ICPPClassType) col.getName(0).resolveBinding();
|
||||||
IFunction set = (IFunction) col.getName(1).resolveBinding();
|
IFunction set = (IFunction) col.getName(1).resolveBinding();
|
||||||
|
@ -1757,7 +1757,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col);
|
tu.accept( col);
|
||||||
|
|
||||||
ICPPClassType B = (ICPPClassType) col.getName(2).resolveBinding();
|
ICPPClassType B = (ICPPClassType) col.getName(2).resolveBinding();
|
||||||
ICPPClassType A = (ICPPClassType) col.getName(0).resolveBinding();
|
ICPPClassType A = (ICPPClassType) col.getName(0).resolveBinding();
|
||||||
|
@ -1779,7 +1779,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col);
|
tu.accept( col);
|
||||||
|
|
||||||
ICPPClassType N = (ICPPClassType) col.getName(5).resolveBinding();
|
ICPPClassType N = (ICPPClassType) col.getName(5).resolveBinding();
|
||||||
ICPPClassType A = (ICPPClassType) col.getName(0).resolveBinding();
|
ICPPClassType A = (ICPPClassType) col.getName(0).resolveBinding();
|
||||||
|
@ -1802,7 +1802,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col);
|
tu.accept( col);
|
||||||
|
|
||||||
IFunction helper = (IFunction) col.getName(2).resolveBinding();
|
IFunction helper = (IFunction) col.getName(2).resolveBinding();
|
||||||
assertSame( helper.getScope(), tu.getScope() );
|
assertSame( helper.getScope(), tu.getScope() );
|
||||||
|
@ -1827,7 +1827,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col);
|
tu.accept( col);
|
||||||
|
|
||||||
IFunction f1 = (IFunction) col.getName(0).resolveBinding();
|
IFunction f1 = (IFunction) col.getName(0).resolveBinding();
|
||||||
IFunction f2 = (IFunction) col.getName(2).resolveBinding();
|
IFunction f2 = (IFunction) col.getName(2).resolveBinding();
|
||||||
|
@ -1851,7 +1851,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col);
|
tu.accept( col);
|
||||||
|
|
||||||
IFunction f1 = (IFunction) col.getName(0).resolveBinding();
|
IFunction f1 = (IFunction) col.getName(0).resolveBinding();
|
||||||
IFunction f2 = (IFunction) col.getName(2).resolveBinding();
|
IFunction f2 = (IFunction) col.getName(2).resolveBinding();
|
||||||
|
@ -1874,7 +1874,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col);
|
tu.accept( col);
|
||||||
|
|
||||||
IFunction f1 = (IFunction) col.getName(0).resolveBinding();
|
IFunction f1 = (IFunction) col.getName(0).resolveBinding();
|
||||||
IFunction f2 = (IFunction) col.getName(2).resolveBinding();
|
IFunction f2 = (IFunction) col.getName(2).resolveBinding();
|
||||||
|
@ -1894,7 +1894,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col);
|
tu.accept( col);
|
||||||
|
|
||||||
IFunction f1 = (IFunction) col.getName(0).resolveBinding();
|
IFunction f1 = (IFunction) col.getName(0).resolveBinding();
|
||||||
IFunction f2 = (IFunction) col.getName(2).resolveBinding();
|
IFunction f2 = (IFunction) col.getName(2).resolveBinding();
|
||||||
|
@ -1913,7 +1913,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col);
|
tu.accept( col);
|
||||||
|
|
||||||
IVariable g = (IVariable) col.getName(3).resolveBinding();
|
IVariable g = (IVariable) col.getName(3).resolveBinding();
|
||||||
assertInstances( col, g, 3 );
|
assertInstances( col, g, 3 );
|
||||||
|
@ -1936,7 +1936,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col);
|
tu.accept( col);
|
||||||
|
|
||||||
IASTName name = col.getName(11);
|
IASTName name = col.getName(11);
|
||||||
IBinding [] bs = CPPSemantics.prefixLookup( name );
|
IBinding [] bs = CPPSemantics.prefixLookup( name );
|
||||||
|
@ -1950,7 +1950,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col);
|
tu.accept( col);
|
||||||
|
|
||||||
IFunction f = (IFunction) col.getName(1).resolveBinding();
|
IFunction f = (IFunction) col.getName(1).resolveBinding();
|
||||||
assertTrue( f.isStatic() );
|
assertTrue( f.isStatic() );
|
||||||
|
@ -1988,7 +1988,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col);
|
tu.accept( col);
|
||||||
|
|
||||||
ICPPClassType D1 = (ICPPClassType) col.getName(2).resolveBinding();
|
ICPPClassType D1 = (ICPPClassType) col.getName(2).resolveBinding();
|
||||||
ICPPClassType D2 = (ICPPClassType) col.getName(4).resolveBinding();
|
ICPPClassType D2 = (ICPPClassType) col.getName(4).resolveBinding();
|
||||||
|
@ -2020,7 +2020,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col);
|
tu.accept( col);
|
||||||
|
|
||||||
ICPPClassType C = (ICPPClassType) col.getName(0).resolveBinding();
|
ICPPClassType C = (ICPPClassType) col.getName(0).resolveBinding();
|
||||||
ICPPMethod f = (ICPPMethod) col.getName(1).resolveBinding();
|
ICPPMethod f = (ICPPMethod) col.getName(1).resolveBinding();
|
||||||
|
@ -2049,7 +2049,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col);
|
tu.accept( col);
|
||||||
|
|
||||||
IFunction r1 = (IFunction) col.getName(6).resolveBinding();
|
IFunction r1 = (IFunction) col.getName(6).resolveBinding();
|
||||||
IFunction r2 = (IFunction) col.getName(8).resolveBinding();
|
IFunction r2 = (IFunction) col.getName(8).resolveBinding();
|
||||||
|
@ -2070,7 +2070,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit(col);
|
tu.accept(col);
|
||||||
|
|
||||||
ICPPClassType S = (ICPPClassType) col.getName(0).resolveBinding();
|
ICPPClassType S = (ICPPClassType) col.getName(0).resolveBinding();
|
||||||
IFunction g = (IFunction) col.getName(3).resolveBinding();
|
IFunction g = (IFunction) col.getName(3).resolveBinding();
|
||||||
|
@ -2119,7 +2119,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit(col);
|
tu.accept(col);
|
||||||
|
|
||||||
ICPPConstructor T1_ctor = (ICPPConstructor) col.getName(6).resolveBinding();
|
ICPPConstructor T1_ctor = (ICPPConstructor) col.getName(6).resolveBinding();
|
||||||
ICPPClassType T1 = (ICPPClassType) col.getName(0).resolveBinding();
|
ICPPClassType T1 = (ICPPClassType) col.getName(0).resolveBinding();
|
||||||
|
@ -2137,7 +2137,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit(col);
|
tu.accept(col);
|
||||||
|
|
||||||
ICPPClassType S = (ICPPClassType) col.getName(0).resolveBinding();
|
ICPPClassType S = (ICPPClassType) col.getName(0).resolveBinding();
|
||||||
|
|
||||||
|
@ -2164,7 +2164,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit(col);
|
tu.accept(col);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testBug86319() throws Exception {
|
public void testBug86319() throws Exception {
|
||||||
|
@ -2179,7 +2179,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit(col);
|
tu.accept(col);
|
||||||
|
|
||||||
IVariable i1 = (IVariable) col.getName(1).resolveBinding();
|
IVariable i1 = (IVariable) col.getName(1).resolveBinding();
|
||||||
IVariable i2 = (IVariable) col.getName(3).resolveBinding();
|
IVariable i2 = (IVariable) col.getName(3).resolveBinding();
|
||||||
|
@ -2204,7 +2204,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit(col);
|
tu.accept(col);
|
||||||
|
|
||||||
ICPPField i = (ICPPField) col.getName(1).resolveBinding();
|
ICPPField i = (ICPPField) col.getName(1).resolveBinding();
|
||||||
ICPPField j = (ICPPField) col.getName(2).resolveBinding();
|
ICPPField j = (ICPPField) col.getName(2).resolveBinding();
|
||||||
|
@ -2244,7 +2244,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit(col);
|
tu.accept(col);
|
||||||
|
|
||||||
IEnumerator enum_x = (IEnumerator) col.getName(3).resolveBinding();
|
IEnumerator enum_x = (IEnumerator) col.getName(3).resolveBinding();
|
||||||
IBinding x_ref = col.getName(4).resolveBinding();
|
IBinding x_ref = col.getName(4).resolveBinding();
|
||||||
|
@ -2275,7 +2275,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit(col);
|
tu.accept(col);
|
||||||
assertEquals( col.size(), 10 );
|
assertEquals( col.size(), 10 );
|
||||||
|
|
||||||
IVariable d1 = (IVariable) col.getName(6).resolveBinding();
|
IVariable d1 = (IVariable) col.getName(6).resolveBinding();
|
||||||
|
@ -2298,7 +2298,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit(col);
|
tu.accept(col);
|
||||||
|
|
||||||
IFunction point = (IFunction) col.getName(0).resolveBinding();
|
IFunction point = (IFunction) col.getName(0).resolveBinding();
|
||||||
|
|
||||||
|
@ -2318,7 +2318,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit(col);
|
tu.accept(col);
|
||||||
|
|
||||||
IVariable i = (IVariable) col.getName(4).resolveBinding();
|
IVariable i = (IVariable) col.getName(4).resolveBinding();
|
||||||
IVariable i2 = (IVariable) col.getName(7).resolveBinding();
|
IVariable i2 = (IVariable) col.getName(7).resolveBinding();
|
||||||
|
@ -2340,7 +2340,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit(col);
|
tu.accept(col);
|
||||||
|
|
||||||
IFunction f1 = (IFunction) col.getName(2).resolveBinding();
|
IFunction f1 = (IFunction) col.getName(2).resolveBinding();
|
||||||
IFunction f2 = (IFunction) col.getName(5).resolveBinding();
|
IFunction f2 = (IFunction) col.getName(5).resolveBinding();
|
||||||
|
@ -2366,7 +2366,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit(col);
|
tu.accept(col);
|
||||||
|
|
||||||
IFunction f_ref = (IFunction) col.getName(12).resolveBinding();
|
IFunction f_ref = (IFunction) col.getName(12).resolveBinding();
|
||||||
IFunction g_ref = (IFunction) col.getName(15).resolveBinding();
|
IFunction g_ref = (IFunction) col.getName(15).resolveBinding();
|
||||||
|
@ -2390,7 +2390,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit(col);
|
tu.accept(col);
|
||||||
|
|
||||||
ICPPNamespace ns = (ICPPNamespace) col.getName(0).resolveBinding();
|
ICPPNamespace ns = (ICPPNamespace) col.getName(0).resolveBinding();
|
||||||
IASTName [] refs = tu.getReferences( ns );
|
IASTName [] refs = tu.getReferences( ns );
|
||||||
|
@ -2416,7 +2416,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit(col);
|
tu.accept(col);
|
||||||
|
|
||||||
IBinding b = col.getName(7).resolveBinding();
|
IBinding b = col.getName(7).resolveBinding();
|
||||||
IASTName [] decls = tu.getDeclarations( b );
|
IASTName [] decls = tu.getDeclarations( b );
|
||||||
|
@ -2444,7 +2444,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit(col);
|
tu.accept(col);
|
||||||
|
|
||||||
IFunction f_decl = (IFunction) col.getName(10).resolveBinding();
|
IFunction f_decl = (IFunction) col.getName(10).resolveBinding();
|
||||||
IFunction f_ref = (IFunction) col.getName(19).resolveBinding();
|
IFunction f_ref = (IFunction) col.getName(19).resolveBinding();
|
||||||
|
@ -2466,7 +2466,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit(col);
|
tu.accept(col);
|
||||||
|
|
||||||
IBinding ref1 = col.getName(8).resolveBinding();
|
IBinding ref1 = col.getName(8).resolveBinding();
|
||||||
IBinding ref2 = col.getName(9).resolveBinding();
|
IBinding ref2 = col.getName(9).resolveBinding();
|
||||||
|
@ -2501,7 +2501,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit(col);
|
tu.accept(col);
|
||||||
|
|
||||||
IBinding ref1 = col.getName(11).resolveBinding();
|
IBinding ref1 = col.getName(11).resolveBinding();
|
||||||
IBinding ref2 = col.getName(12).resolveBinding();
|
IBinding ref2 = col.getName(12).resolveBinding();
|
||||||
|
@ -2527,7 +2527,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit(col);
|
tu.accept(col);
|
||||||
|
|
||||||
IFunction f = (IFunction) col.getName(3).resolveBinding();
|
IFunction f = (IFunction) col.getName(3).resolveBinding();
|
||||||
|
|
||||||
|
@ -2548,7 +2548,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit(col);
|
tu.accept(col);
|
||||||
|
|
||||||
ICPPClassType B = (ICPPClassType) col.getName(6).resolveBinding();
|
ICPPClassType B = (ICPPClassType) col.getName(6).resolveBinding();
|
||||||
ICPPField i = (ICPPField) col.getName(12).resolveBinding();
|
ICPPField i = (ICPPField) col.getName(12).resolveBinding();
|
||||||
|
@ -2570,7 +2570,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit(col);
|
tu.accept(col);
|
||||||
|
|
||||||
IFunction printf = (IFunction) col.getName(6).resolveBinding();
|
IFunction printf = (IFunction) col.getName(6).resolveBinding();
|
||||||
assertInstances( col, printf, 3 );
|
assertInstances( col, printf, 3 );
|
||||||
|
@ -2585,7 +2585,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit(col);
|
tu.accept(col);
|
||||||
|
|
||||||
IVariable m = (IVariable) col.getName(11).resolveBinding();
|
IVariable m = (IVariable) col.getName(11).resolveBinding();
|
||||||
IParameter a = (IParameter) col.getName(1).resolveBinding();
|
IParameter a = (IParameter) col.getName(1).resolveBinding();
|
||||||
|
@ -2607,7 +2607,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit(col);
|
tu.accept(col);
|
||||||
|
|
||||||
IFunction g1 = (IFunction) col.getName(0).resolveBinding();
|
IFunction g1 = (IFunction) col.getName(0).resolveBinding();
|
||||||
ICPPMethod g2 = (ICPPMethod) col.getName(9).resolveBinding();
|
ICPPMethod g2 = (ICPPMethod) col.getName(9).resolveBinding();
|
||||||
|
@ -2637,7 +2637,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit(col);
|
tu.accept(col);
|
||||||
|
|
||||||
ICPPField x = (ICPPField) col.getName(23).resolveBinding();
|
ICPPField x = (ICPPField) col.getName(23).resolveBinding();
|
||||||
ICPPMethod f = (ICPPMethod) col.getName(24).resolveBinding();
|
ICPPMethod f = (ICPPMethod) col.getName(24).resolveBinding();
|
||||||
|
@ -2661,7 +2661,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit(col);
|
tu.accept(col);
|
||||||
|
|
||||||
IVariable c = (IVariable) col.getName(1).resolveBinding();
|
IVariable c = (IVariable) col.getName(1).resolveBinding();
|
||||||
|
|
||||||
|
|
|
@ -1136,7 +1136,7 @@ public class AST2Tests extends AST2BaseTest {
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.C);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.C);
|
||||||
|
|
||||||
CNameCollector collector = new CNameCollector();
|
CNameCollector collector = new CNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( collector);
|
tu.accept( collector);
|
||||||
|
|
||||||
assertEquals(collector.size(), 3);
|
assertEquals(collector.size(), 3);
|
||||||
IFunction function = (IFunction) collector.getName(0).resolveBinding();
|
IFunction function = (IFunction) collector.getName(0).resolveBinding();
|
||||||
|
@ -2502,7 +2502,7 @@ public class AST2Tests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.C);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.C);
|
||||||
CNameCollector col = new CNameCollector();
|
CNameCollector col = new CNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col);
|
tu.accept( col);
|
||||||
|
|
||||||
IVariable a = (IVariable) col.getName(1).resolveBinding();
|
IVariable a = (IVariable) col.getName(1).resolveBinding();
|
||||||
assertNotNull(a);
|
assertNotNull(a);
|
||||||
|
@ -2523,7 +2523,7 @@ public class AST2Tests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.C);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.C);
|
||||||
CNameCollector col = new CNameCollector();
|
CNameCollector col = new CNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col);
|
tu.accept( col);
|
||||||
|
|
||||||
IVariable a = (IVariable) col.getName(1).resolveBinding();
|
IVariable a = (IVariable) col.getName(1).resolveBinding();
|
||||||
IFunction g = (IFunction) col.getName(2).resolveBinding();
|
IFunction g = (IFunction) col.getName(2).resolveBinding();
|
||||||
|
@ -2546,7 +2546,7 @@ public class AST2Tests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.C);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.C);
|
||||||
CNameCollector col = new CNameCollector();
|
CNameCollector col = new CNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col);
|
tu.accept( col);
|
||||||
|
|
||||||
assertEquals(col.size(), 9);
|
assertEquals(col.size(), 9);
|
||||||
IField x = (IField) col.getName(1).resolveBinding();
|
IField x = (IField) col.getName(1).resolveBinding();
|
||||||
|
@ -2568,7 +2568,7 @@ public class AST2Tests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.C);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.C);
|
||||||
CNameCollector col = new CNameCollector();
|
CNameCollector col = new CNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col);
|
tu.accept( col);
|
||||||
|
|
||||||
assertEquals(col.size(), 6);
|
assertEquals(col.size(), 6);
|
||||||
IEnumerator one = (IEnumerator) col.getName(1).resolveBinding();
|
IEnumerator one = (IEnumerator) col.getName(1).resolveBinding();
|
||||||
|
@ -2615,7 +2615,7 @@ public class AST2Tests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.C);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.C);
|
||||||
CNameCollector col = new CNameCollector();
|
CNameCollector col = new CNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col);
|
tu.accept( col);
|
||||||
|
|
||||||
assertEquals(col.size(), 3);
|
assertEquals(col.size(), 3);
|
||||||
ILabel end = (ILabel) col.getName(1).resolveBinding();
|
ILabel end = (ILabel) col.getName(1).resolveBinding();
|
||||||
|
@ -2632,7 +2632,7 @@ public class AST2Tests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.C);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.C);
|
||||||
CNameCollector collector = new CNameCollector();
|
CNameCollector collector = new CNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( collector);
|
tu.accept( collector);
|
||||||
|
|
||||||
assertEquals(collector.size(), 5);
|
assertEquals(collector.size(), 5);
|
||||||
IEnumeration col = (IEnumeration) collector.getName(0).resolveBinding();
|
IEnumeration col = (IEnumeration) collector.getName(0).resolveBinding();
|
||||||
|
@ -2646,7 +2646,7 @@ public class AST2Tests extends AST2BaseTest {
|
||||||
IASTTranslationUnit tu = parse(
|
IASTTranslationUnit tu = parse(
|
||||||
"struct s { int a; } ss = { .a = 1 }; \n", ParserLanguage.C); //$NON-NLS-1$
|
"struct s { int a; } ss = { .a = 1 }; \n", ParserLanguage.C); //$NON-NLS-1$
|
||||||
CNameCollector collector = new CNameCollector();
|
CNameCollector collector = new CNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( collector);
|
tu.accept( collector);
|
||||||
|
|
||||||
assertEquals(collector.size(), 4);
|
assertEquals(collector.size(), 4);
|
||||||
IField a = (IField) collector.getName(1).resolveBinding();
|
IField a = (IField) collector.getName(1).resolveBinding();
|
||||||
|
@ -2672,7 +2672,7 @@ public class AST2Tests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.C);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.C);
|
||||||
CNameCollector col = new CNameCollector();
|
CNameCollector col = new CNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col);
|
tu.accept( col);
|
||||||
|
|
||||||
assertEquals(col.size(), 3);
|
assertEquals(col.size(), 3);
|
||||||
IEnumeration e = (IEnumeration) col.getName(0).resolveBinding();
|
IEnumeration e = (IEnumeration) col.getName(0).resolveBinding();
|
||||||
|
@ -2692,7 +2692,7 @@ public class AST2Tests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.C);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.C);
|
||||||
CNameCollector col = new CNameCollector();
|
CNameCollector col = new CNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col);
|
tu.accept( col);
|
||||||
|
|
||||||
assertEquals(col.size(), 3);
|
assertEquals(col.size(), 3);
|
||||||
IVariable p = (IVariable) col.getName(1).resolveBinding();
|
IVariable p = (IVariable) col.getName(1).resolveBinding();
|
||||||
|
@ -2713,7 +2713,7 @@ public class AST2Tests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.C);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.C);
|
||||||
CNameCollector col = new CNameCollector();
|
CNameCollector col = new CNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col);
|
tu.accept( col);
|
||||||
|
|
||||||
assertEquals(col.size(), 3);
|
assertEquals(col.size(), 3);
|
||||||
|
|
||||||
|
@ -2744,7 +2744,7 @@ public class AST2Tests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.C);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.C);
|
||||||
CNameCollector col = new CNameCollector();
|
CNameCollector col = new CNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col);
|
tu.accept( col);
|
||||||
|
|
||||||
assertEquals(col.size(), 7);
|
assertEquals(col.size(), 7);
|
||||||
|
|
||||||
|
@ -2764,7 +2764,7 @@ public class AST2Tests extends AST2BaseTest {
|
||||||
public void testBug84266_2() throws Exception {
|
public void testBug84266_2() throws Exception {
|
||||||
IASTTranslationUnit tu = parse("struct s f(void);", ParserLanguage.C); //$NON-NLS-1$
|
IASTTranslationUnit tu = parse("struct s f(void);", ParserLanguage.C); //$NON-NLS-1$
|
||||||
CNameCollector col = new CNameCollector();
|
CNameCollector col = new CNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col);
|
tu.accept( col);
|
||||||
|
|
||||||
assertEquals(col.size(), 3);
|
assertEquals(col.size(), 3);
|
||||||
|
|
||||||
|
@ -2773,7 +2773,7 @@ public class AST2Tests extends AST2BaseTest {
|
||||||
|
|
||||||
tu = parse("struct s f(void){}", ParserLanguage.C); //$NON-NLS-1$
|
tu = parse("struct s f(void){}", ParserLanguage.C); //$NON-NLS-1$
|
||||||
col = new CNameCollector();
|
col = new CNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col);
|
tu.accept( col);
|
||||||
|
|
||||||
assertEquals(col.size(), 3);
|
assertEquals(col.size(), 3);
|
||||||
|
|
||||||
|
@ -2793,7 +2793,7 @@ public class AST2Tests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.C);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.C);
|
||||||
CNameCollector col = new CNameCollector();
|
CNameCollector col = new CNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col);
|
tu.accept( col);
|
||||||
|
|
||||||
assertEquals(col.size(), 6);
|
assertEquals(col.size(), 6);
|
||||||
|
|
||||||
|
@ -2820,7 +2820,7 @@ public class AST2Tests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.C);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.C);
|
||||||
CNameCollector col = new CNameCollector();
|
CNameCollector col = new CNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col);
|
tu.accept( col);
|
||||||
|
|
||||||
assertEquals(col.size(), 11);
|
assertEquals(col.size(), 11);
|
||||||
|
|
||||||
|
@ -2849,7 +2849,7 @@ public class AST2Tests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.C);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.C);
|
||||||
CNameCollector col = new CNameCollector();
|
CNameCollector col = new CNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col);
|
tu.accept( col);
|
||||||
|
|
||||||
assertEquals(col.size(), 13);
|
assertEquals(col.size(), 13);
|
||||||
|
|
||||||
|
@ -2899,7 +2899,7 @@ public class AST2Tests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col);
|
tu.accept( col);
|
||||||
|
|
||||||
assertEquals(col.size(), 26);
|
assertEquals(col.size(), 26);
|
||||||
|
|
||||||
|
@ -2945,7 +2945,7 @@ public class AST2Tests extends AST2BaseTest {
|
||||||
public void testBug86766() throws Exception {
|
public void testBug86766() throws Exception {
|
||||||
IASTTranslationUnit tu = parse("char foo; void foo(){}", ParserLanguage.C); //$NON-NLS-1$
|
IASTTranslationUnit tu = parse("char foo; void foo(){}", ParserLanguage.C); //$NON-NLS-1$
|
||||||
CNameCollector col = new CNameCollector();
|
CNameCollector col = new CNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col);
|
tu.accept( col);
|
||||||
|
|
||||||
IVariable foo = (IVariable) col.getName(0).resolveBinding();
|
IVariable foo = (IVariable) col.getName(0).resolveBinding();
|
||||||
IProblemBinding prob = (IProblemBinding) col.getName(1).resolveBinding();
|
IProblemBinding prob = (IProblemBinding) col.getName(1).resolveBinding();
|
||||||
|
|
|
@ -46,6 +46,8 @@ import org.eclipse.cdt.core.dom.ast.IQualifierType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
||||||
import org.eclipse.cdt.core.dom.ast.IVariable;
|
import org.eclipse.cdt.core.dom.ast.IVariable;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.c.CASTVisitor;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.CPPASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBase;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBase;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
|
||||||
|
@ -85,12 +87,12 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
|
|
||||||
private static final NullLogService NULL_LOG = new NullLogService();
|
private static final NullLogService NULL_LOG = new NullLogService();
|
||||||
|
|
||||||
static private class CPPNameCollector extends CPPVisitor.CPPBaseVisitorAction {
|
static private class CPPNameCollector extends CPPASTVisitor {
|
||||||
{
|
{
|
||||||
processNames = true;
|
shouldVisitNames = true;
|
||||||
}
|
}
|
||||||
public List nameList = new ArrayList();
|
public List nameList = new ArrayList();
|
||||||
public int processName( IASTName name ){
|
public int visit( IASTName name ){
|
||||||
nameList.add( name );
|
nameList.add( name );
|
||||||
return PROCESS_CONTINUE;
|
return PROCESS_CONTINUE;
|
||||||
}
|
}
|
||||||
|
@ -101,12 +103,12 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
}
|
}
|
||||||
public int size() { return nameList.size(); }
|
public int size() { return nameList.size(); }
|
||||||
}
|
}
|
||||||
static protected class CNameCollector extends CVisitor.CBaseVisitorAction {
|
static protected class CNameCollector extends CASTVisitor {
|
||||||
{
|
{
|
||||||
processNames = true;
|
shouldVisitNames = true;
|
||||||
}
|
}
|
||||||
public List nameList = new ArrayList();
|
public List nameList = new ArrayList();
|
||||||
public int processName( IASTName name ){
|
public int visit( IASTName name ){
|
||||||
nameList.add( name );
|
nameList.add( name );
|
||||||
return PROCESS_CONTINUE;
|
return PROCESS_CONTINUE;
|
||||||
}
|
}
|
||||||
|
@ -215,7 +217,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
{
|
{
|
||||||
IASTTranslationUnit tu = parse( "namespace A { }"); //$NON-NLS-1$
|
IASTTranslationUnit tu = parse( "namespace A { }"); //$NON-NLS-1$
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 1 );
|
assertEquals( col.size(), 1 );
|
||||||
assertTrue( col.getName(0).resolveBinding() instanceof ICPPNamespace );
|
assertTrue( col.getName(0).resolveBinding() instanceof ICPPNamespace );
|
||||||
|
@ -225,7 +227,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
{
|
{
|
||||||
IASTTranslationUnit tu = parse( "namespace A { } namespace A { }"); //$NON-NLS-1$
|
IASTTranslationUnit tu = parse( "namespace A { } namespace A { }"); //$NON-NLS-1$
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 2 );
|
assertEquals( col.size(), 2 );
|
||||||
ICPPNamespace A = (ICPPNamespace) col.getName(0).resolveBinding();
|
ICPPNamespace A = (ICPPNamespace) col.getName(0).resolveBinding();
|
||||||
|
@ -236,7 +238,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
{
|
{
|
||||||
IASTTranslationUnit tu = parse( "namespace A { namespace B { } }"); //$NON-NLS-1$
|
IASTTranslationUnit tu = parse( "namespace A { namespace B { } }"); //$NON-NLS-1$
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 2 );
|
assertEquals( col.size(), 2 );
|
||||||
ICPPNamespace A = (ICPPNamespace) col.getName(0).resolveBinding();
|
ICPPNamespace A = (ICPPNamespace) col.getName(0).resolveBinding();
|
||||||
|
@ -249,7 +251,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
{
|
{
|
||||||
IASTTranslationUnit tu = parse( "class A { };"); //$NON-NLS-1$
|
IASTTranslationUnit tu = parse( "class A { };"); //$NON-NLS-1$
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 1 );
|
assertEquals( col.size(), 1 );
|
||||||
assertTrue( col.getName(0).resolveBinding() instanceof ICPPClassType );
|
assertTrue( col.getName(0).resolveBinding() instanceof ICPPClassType );
|
||||||
|
@ -259,7 +261,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
{
|
{
|
||||||
IASTTranslationUnit tu = parse( "class A { }; class B : public A { };"); //$NON-NLS-1$
|
IASTTranslationUnit tu = parse( "class A { }; class B : public A { };"); //$NON-NLS-1$
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 3 );
|
assertEquals( col.size(), 3 );
|
||||||
ICPPClassType A = (ICPPClassType) col.getName(0).resolveBinding();
|
ICPPClassType A = (ICPPClassType) col.getName(0).resolveBinding();
|
||||||
|
@ -278,7 +280,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
{
|
{
|
||||||
IASTTranslationUnit tu = parse( "namespace N { class A { }; } class B : protected virtual N::A { };"); //$NON-NLS-1$
|
IASTTranslationUnit tu = parse( "namespace N { class A { }; } class B : protected virtual N::A { };"); //$NON-NLS-1$
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 6 );
|
assertEquals( col.size(), 6 );
|
||||||
ICPPNamespace N = (ICPPNamespace) col.getName(0).resolveBinding();
|
ICPPNamespace N = (ICPPNamespace) col.getName(0).resolveBinding();
|
||||||
|
@ -301,7 +303,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
{
|
{
|
||||||
IASTTranslationUnit tu = parse( "int x;"); //$NON-NLS-1$
|
IASTTranslationUnit tu = parse( "int x;"); //$NON-NLS-1$
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 1 );
|
assertEquals( col.size(), 1 );
|
||||||
IVariable x = (IVariable) col.getName(0).resolveBinding();
|
IVariable x = (IVariable) col.getName(0).resolveBinding();
|
||||||
|
@ -315,7 +317,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
{
|
{
|
||||||
IASTTranslationUnit tu = parse( "class A { }; A x;"); //$NON-NLS-1$
|
IASTTranslationUnit tu = parse( "class A { }; A x;"); //$NON-NLS-1$
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 3 );
|
assertEquals( col.size(), 3 );
|
||||||
ICPPClassType A = (ICPPClassType) col.getName(0).resolveBinding();
|
ICPPClassType A = (ICPPClassType) col.getName(0).resolveBinding();
|
||||||
|
@ -329,7 +331,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
{
|
{
|
||||||
IASTTranslationUnit tu = parse( "namespace N { class A { }; } N::A x;"); //$NON-NLS-1$
|
IASTTranslationUnit tu = parse( "namespace N { class A { }; } N::A x;"); //$NON-NLS-1$
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 6 );
|
assertEquals( col.size(), 6 );
|
||||||
ICPPNamespace N = (ICPPNamespace) col.getName(0).resolveBinding();
|
ICPPNamespace N = (ICPPNamespace) col.getName(0).resolveBinding();
|
||||||
|
@ -346,7 +348,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
{
|
{
|
||||||
IASTTranslationUnit tu = parse( "class A { }; A x, y, z;"); //$NON-NLS-1$
|
IASTTranslationUnit tu = parse( "class A { }; A x, y, z;"); //$NON-NLS-1$
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 5 );
|
assertEquals( col.size(), 5 );
|
||||||
ICPPClassType A = (ICPPClassType) col.getName(0).resolveBinding();
|
ICPPClassType A = (ICPPClassType) col.getName(0).resolveBinding();
|
||||||
|
@ -364,7 +366,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
{
|
{
|
||||||
IASTTranslationUnit tu = parse( "class A { double x; };"); //$NON-NLS-1$
|
IASTTranslationUnit tu = parse( "class A { double x; };"); //$NON-NLS-1$
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 2 );
|
assertEquals( col.size(), 2 );
|
||||||
ICPPClassType A = (ICPPClassType) col.getName(0).resolveBinding();
|
ICPPClassType A = (ICPPClassType) col.getName(0).resolveBinding();
|
||||||
|
@ -380,7 +382,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
{
|
{
|
||||||
IASTTranslationUnit tu = parse( "namespace A { namespace B { int x; class C { static int y = 5; }; } } \n using namespace A::B;\n using A::B::x;using A::B::C;using A::B::C::y;"); //$NON-NLS-1$
|
IASTTranslationUnit tu = parse( "namespace A { namespace B { int x; class C { static int y = 5; }; } } \n using namespace A::B;\n using A::B::x;using A::B::C;using A::B::C::y;"); //$NON-NLS-1$
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 21 );
|
assertEquals( col.size(), 21 );
|
||||||
ICPPNamespace A = (ICPPNamespace) col.getName(0).resolveBinding();
|
ICPPNamespace A = (ICPPNamespace) col.getName(0).resolveBinding();
|
||||||
|
@ -400,7 +402,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
{
|
{
|
||||||
IASTTranslationUnit tu = parse( "namespace A { enum E { e1, e2, e3 }; E varE;}"); //$NON-NLS-1$
|
IASTTranslationUnit tu = parse( "namespace A { enum E { e1, e2, e3 }; E varE;}"); //$NON-NLS-1$
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 7 );
|
assertEquals( col.size(), 7 );
|
||||||
ICPPNamespace A = (ICPPNamespace) col.getName(0).resolveBinding();
|
ICPPNamespace A = (ICPPNamespace) col.getName(0).resolveBinding();
|
||||||
|
@ -422,7 +424,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
{
|
{
|
||||||
IASTTranslationUnit tu = parse( "void foo( void );"); //$NON-NLS-1$
|
IASTTranslationUnit tu = parse( "void foo( void );"); //$NON-NLS-1$
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 2 );
|
assertEquals( col.size(), 2 );
|
||||||
IFunction foo = (IFunction) col.getName(0).resolveBinding();
|
IFunction foo = (IFunction) col.getName(0).resolveBinding();
|
||||||
|
@ -437,7 +439,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
{
|
{
|
||||||
IASTTranslationUnit tu = parse( "class A { public: \n class B { }; }; const A::B & foo( A * myParam );"); //$NON-NLS-1$
|
IASTTranslationUnit tu = parse( "class A { public: \n class B { }; }; const A::B & foo( A * myParam );"); //$NON-NLS-1$
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 8 );
|
assertEquals( col.size(), 8 );
|
||||||
ICPPClassType A = (ICPPClassType) col.getName(0).resolveBinding();
|
ICPPClassType A = (ICPPClassType) col.getName(0).resolveBinding();
|
||||||
|
@ -464,7 +466,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
{
|
{
|
||||||
IASTTranslationUnit tu = parse( "class A { void foo(); };"); //$NON-NLS-1$
|
IASTTranslationUnit tu = parse( "class A { void foo(); };"); //$NON-NLS-1$
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 2 );
|
assertEquals( col.size(), 2 );
|
||||||
ICPPClassType A = (ICPPClassType) col.getName(0).resolveBinding();
|
ICPPClassType A = (ICPPClassType) col.getName(0).resolveBinding();
|
||||||
|
@ -477,7 +479,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
{
|
{
|
||||||
IASTTranslationUnit tu = parse( "class U { }; class A { U foo( U areDumb ); };"); //$NON-NLS-1$
|
IASTTranslationUnit tu = parse( "class U { }; class A { U foo( U areDumb ); };"); //$NON-NLS-1$
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 6 );
|
assertEquals( col.size(), 6 );
|
||||||
ICPPClassType U = (ICPPClassType) col.getName(0).resolveBinding();
|
ICPPClassType U = (ICPPClassType) col.getName(0).resolveBinding();
|
||||||
|
@ -496,7 +498,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
{
|
{
|
||||||
IASTTranslationUnit tu = parse( "namespace N { int foo(void); } class A { static int bar(void); }; using N::foo; using ::A::bar;" ); //$NON-NLS-1$
|
IASTTranslationUnit tu = parse( "namespace N { int foo(void); } class A { static int bar(void); }; using N::foo; using ::A::bar;" ); //$NON-NLS-1$
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 12 );
|
assertEquals( col.size(), 12 );
|
||||||
ICPPNamespace N = (ICPPNamespace) col.getName(0).resolveBinding();
|
ICPPNamespace N = (ICPPNamespace) col.getName(0).resolveBinding();
|
||||||
|
@ -514,7 +516,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
{
|
{
|
||||||
IASTTranslationUnit tu = parse( "extern \"C\" { int foo(); }"); //$NON-NLS-1$
|
IASTTranslationUnit tu = parse( "extern \"C\" { int foo(); }"); //$NON-NLS-1$
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 1 );
|
assertEquals( col.size(), 1 );
|
||||||
IFunction foo = (IFunction) col.getName(0).resolveBinding();
|
IFunction foo = (IFunction) col.getName(0).resolveBinding();
|
||||||
|
@ -526,7 +528,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
{
|
{
|
||||||
IASTTranslationUnit tu = parse( "namespace A { namespace B { enum e1{e_1,e_2}; int x; class C { static int y = 5; }; }} "); //$NON-NLS-1$
|
IASTTranslationUnit tu = parse( "namespace A { namespace B { enum e1{e_1,e_2}; int x; class C { static int y = 5; }; }} "); //$NON-NLS-1$
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 8 );
|
assertEquals( col.size(), 8 );
|
||||||
ICPPNamespace A = (ICPPNamespace) col.getName(0).resolveBinding();
|
ICPPNamespace A = (ICPPNamespace) col.getName(0).resolveBinding();
|
||||||
|
@ -551,7 +553,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
{
|
{
|
||||||
IASTTranslationUnit tu = parse( "namespace N{ class A {}; } using namespace N; class B: public A{};"); //$NON-NLS-1$
|
IASTTranslationUnit tu = parse( "namespace N{ class A {}; } using namespace N; class B: public A{};"); //$NON-NLS-1$
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 5 );
|
assertEquals( col.size(), 5 );
|
||||||
ICPPNamespace N = (ICPPNamespace) col.getName(0).resolveBinding();
|
ICPPNamespace N = (ICPPNamespace) col.getName(0).resolveBinding();
|
||||||
|
@ -569,7 +571,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
{
|
{
|
||||||
IASTTranslationUnit tu = parse( "typedef int myInt;\n myInt var;"); //$NON-NLS-1$
|
IASTTranslationUnit tu = parse( "typedef int myInt;\n myInt var;"); //$NON-NLS-1$
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 3 );
|
assertEquals( col.size(), 3 );
|
||||||
ITypedef myInt = (ITypedef) col.getName(0).resolveBinding();
|
ITypedef myInt = (ITypedef) col.getName(0).resolveBinding();
|
||||||
|
@ -584,7 +586,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
{
|
{
|
||||||
IASTTranslationUnit tu = parse( "class A{ }; typedef A ** A_DOUBLEPTR;"); //$NON-NLS-1$
|
IASTTranslationUnit tu = parse( "class A{ }; typedef A ** A_DOUBLEPTR;"); //$NON-NLS-1$
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 3 );
|
assertEquals( col.size(), 3 );
|
||||||
ICPPClassType A = (ICPPClassType) col.getName(0).resolveBinding();
|
ICPPClassType A = (ICPPClassType) col.getName(0).resolveBinding();
|
||||||
|
@ -626,7 +628,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
{
|
{
|
||||||
IASTTranslationUnit tu = parse( "namespace A { } \n class A::B { };"); //$NON-NLS-1$
|
IASTTranslationUnit tu = parse( "namespace A { } \n class A::B { };"); //$NON-NLS-1$
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
ICPPNamespace A = (ICPPNamespace) col.getName(0).resolveBinding();
|
ICPPNamespace A = (ICPPNamespace) col.getName(0).resolveBinding();
|
||||||
ICPPClassType B = (ICPPClassType) col.getName(1).resolveBinding();
|
ICPPClassType B = (ICPPClassType) col.getName(1).resolveBinding();
|
||||||
|
@ -649,7 +651,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
{
|
{
|
||||||
IASTTranslationUnit tu = parse( "class A; class A * a;"); //$NON-NLS-1$
|
IASTTranslationUnit tu = parse( "class A; class A * a;"); //$NON-NLS-1$
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 3 );
|
assertEquals( col.size(), 3 );
|
||||||
ICPPClassType A = (ICPPClassType) col.getName(0).resolveBinding();
|
ICPPClassType A = (ICPPClassType) col.getName(0).resolveBinding();
|
||||||
|
@ -663,7 +665,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
{
|
{
|
||||||
IASTTranslationUnit tu = parse( "class A; A * anA;class A { };"); //$NON-NLS-1$
|
IASTTranslationUnit tu = parse( "class A; A * anA;class A { };"); //$NON-NLS-1$
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 4 );
|
assertEquals( col.size(), 4 );
|
||||||
ICPPClassType A = (ICPPClassType) col.getName(0).resolveBinding();
|
ICPPClassType A = (ICPPClassType) col.getName(0).resolveBinding();
|
||||||
|
@ -683,7 +685,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
{
|
{
|
||||||
IASTTranslationUnit tu = parse( "void foo();\n void foo( int );\n"); //$NON-NLS-1$
|
IASTTranslationUnit tu = parse( "void foo();\n void foo( int );\n"); //$NON-NLS-1$
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 3 );
|
assertEquals( col.size(), 3 );
|
||||||
IFunction foo1 = (IFunction) col.getName(0).resolveBinding();
|
IFunction foo1 = (IFunction) col.getName(0).resolveBinding();
|
||||||
|
@ -696,7 +698,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
{
|
{
|
||||||
IASTTranslationUnit tu = parse( "int x; int y = x;"); //$NON-NLS-1$
|
IASTTranslationUnit tu = parse( "int x; int y = x;"); //$NON-NLS-1$
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 3 );
|
assertEquals( col.size(), 3 );
|
||||||
IVariable x = (IVariable) col.getName(0).resolveBinding();
|
IVariable x = (IVariable) col.getName(0).resolveBinding();
|
||||||
|
@ -709,7 +711,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
{
|
{
|
||||||
IASTTranslationUnit tu = parse( "int x = 5; void foo( int sub = x ) { }"); //$NON-NLS-1$
|
IASTTranslationUnit tu = parse( "int x = 5; void foo( int sub = x ) { }"); //$NON-NLS-1$
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 4 );
|
assertEquals( col.size(), 4 );
|
||||||
IVariable x = (IVariable) col.getName(0).resolveBinding();
|
IVariable x = (IVariable) col.getName(0).resolveBinding();
|
||||||
|
@ -720,7 +722,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
{
|
{
|
||||||
IASTTranslationUnit tu = parse( "namespace A { int x = 666; } int y = A::x;"); //$NON-NLS-1$
|
IASTTranslationUnit tu = parse( "namespace A { int x = 666; } int y = A::x;"); //$NON-NLS-1$
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 6 );
|
assertEquals( col.size(), 6 );
|
||||||
ICPPNamespace A = (ICPPNamespace) col.getName(0).resolveBinding();
|
ICPPNamespace A = (ICPPNamespace) col.getName(0).resolveBinding();
|
||||||
|
@ -733,7 +735,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
{
|
{
|
||||||
IASTTranslationUnit tu = parse( "int x = 5;\n class A \n{ public : \n int a; \n A() : a( x ) { } };"); //$NON-NLS-1$
|
IASTTranslationUnit tu = parse( "int x = 5;\n class A \n{ public : \n int a; \n A() : a( x ) { } };"); //$NON-NLS-1$
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 6 );
|
assertEquals( col.size(), 6 );
|
||||||
IVariable x = (IVariable) col.getName(0).resolveBinding();
|
IVariable x = (IVariable) col.getName(0).resolveBinding();
|
||||||
|
@ -748,7 +750,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
{
|
{
|
||||||
IASTTranslationUnit tu = parse( "const int x = 5; int y [ x ]; "); //$NON-NLS-1$
|
IASTTranslationUnit tu = parse( "const int x = 5; int y [ x ]; "); //$NON-NLS-1$
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 3 );
|
assertEquals( col.size(), 3 );
|
||||||
IVariable x = (IVariable) col.getName(0).resolveBinding();
|
IVariable x = (IVariable) col.getName(0).resolveBinding();
|
||||||
|
@ -763,7 +765,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
{
|
{
|
||||||
IASTTranslationUnit tu = parse( "class A { }; A * anA;"); //$NON-NLS-1$
|
IASTTranslationUnit tu = parse( "class A { }; A * anA;"); //$NON-NLS-1$
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 3 );
|
assertEquals( col.size(), 3 );
|
||||||
ICPPClassType A = (ICPPClassType) col.getName(0).resolveBinding();
|
ICPPClassType A = (ICPPClassType) col.getName(0).resolveBinding();
|
||||||
|
@ -777,7 +779,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
{
|
{
|
||||||
IASTTranslationUnit tu = parse( "class A { }; void foo( void ) throw ( A );"); //$NON-NLS-1$
|
IASTTranslationUnit tu = parse( "class A { }; void foo( void ) throw ( A );"); //$NON-NLS-1$
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 4 );
|
assertEquals( col.size(), 4 );
|
||||||
ICPPClassType A = (ICPPClassType) col.getName(0).resolveBinding();
|
ICPPClassType A = (ICPPClassType) col.getName(0).resolveBinding();
|
||||||
|
@ -788,7 +790,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
{
|
{
|
||||||
IASTTranslationUnit tu = parse( "typedef int A; int B; int C; int D; int P; int*p = new (P) (A)[B][C][D];" ); //$NON-NLS-1$
|
IASTTranslationUnit tu = parse( "typedef int A; int B; int C; int D; int P; int*p = new (P) (A)[B][C][D];" ); //$NON-NLS-1$
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 11 );
|
assertEquals( col.size(), 11 );
|
||||||
ITypedef A = (ITypedef) col.getName(0).resolveBinding();
|
ITypedef A = (ITypedef) col.getName(0).resolveBinding();
|
||||||
|
@ -817,7 +819,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
// assertNotNull( dtor.getInitializer() );
|
// assertNotNull( dtor.getInitializer() );
|
||||||
//
|
//
|
||||||
// CPPNameCollector col = new CPPNameCollector();
|
// CPPNameCollector col = new CPPNameCollector();
|
||||||
// tu.getVisitor().visitTranslationUnit( col );
|
// tu.accept( col );
|
||||||
//
|
//
|
||||||
// assertEquals( col.size(), 3 );
|
// assertEquals( col.size(), 3 );
|
||||||
// IVariable x = (IVariable) col.getName(0).resolveBinding();
|
// IVariable x = (IVariable) col.getName(0).resolveBinding();
|
||||||
|
@ -830,7 +832,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
{
|
{
|
||||||
IASTTranslationUnit tu = parse( "const int max = 5;\n int * x = new int[max];"); //$NON-NLS-1$
|
IASTTranslationUnit tu = parse( "const int max = 5;\n int * x = new int[max];"); //$NON-NLS-1$
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 3 );
|
assertEquals( col.size(), 3 );
|
||||||
IVariable max = (IVariable) col.getName(0).resolveBinding();
|
IVariable max = (IVariable) col.getName(0).resolveBinding();
|
||||||
|
@ -842,7 +844,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
// Used to cause AST Semantic exception
|
// Used to cause AST Semantic exception
|
||||||
IASTTranslationUnit tu = parse( "class A{ class B{ class C { public: int cMethod(); }; }; }; \n int A::B::C::cMethod() {}; \n" ); //$NON-NLS-1$
|
IASTTranslationUnit tu = parse( "class A{ class B{ class C { public: int cMethod(); }; }; }; \n int A::B::C::cMethod() {}; \n" ); //$NON-NLS-1$
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 9 );
|
assertEquals( col.size(), 9 );
|
||||||
ICPPClassType A = (ICPPClassType) col.getName(0).resolveBinding();
|
ICPPClassType A = (ICPPClassType) col.getName(0).resolveBinding();
|
||||||
|
@ -864,7 +866,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
{
|
{
|
||||||
IASTTranslationUnit tu = parse( "class A{ public: A(); }; \n A::A() {}; \n" ); //$NON-NLS-1$
|
IASTTranslationUnit tu = parse( "class A{ public: A(); }; \n A::A() {}; \n" ); //$NON-NLS-1$
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 5 );
|
assertEquals( col.size(), 5 );
|
||||||
ICPPClassType A = (ICPPClassType) col.getName(0).resolveBinding();
|
ICPPClassType A = (ICPPClassType) col.getName(0).resolveBinding();
|
||||||
|
@ -878,7 +880,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
{
|
{
|
||||||
IASTTranslationUnit tu = parse( "class A{ public: ~A(); }; \n A::~A() {}; \n" ); //$NON-NLS-1$
|
IASTTranslationUnit tu = parse( "class A{ public: ~A(); }; \n A::~A() {}; \n" ); //$NON-NLS-1$
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 5 );
|
assertEquals( col.size(), 5 );
|
||||||
ICPPClassType A = (ICPPClassType) col.getName(0).resolveBinding();
|
ICPPClassType A = (ICPPClassType) col.getName(0).resolveBinding();
|
||||||
|
@ -892,7 +894,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
{
|
{
|
||||||
IASTTranslationUnit tu = parse( "class A { }; namespace N { class B : public A { struct A {}; }; }"); //$NON-NLS-1$
|
IASTTranslationUnit tu = parse( "class A { }; namespace N { class B : public A { struct A {}; }; }"); //$NON-NLS-1$
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 5 );
|
assertEquals( col.size(), 5 );
|
||||||
ICPPClassType A = (ICPPClassType) col.getName(0).resolveBinding();
|
ICPPClassType A = (ICPPClassType) col.getName(0).resolveBinding();
|
||||||
|
@ -912,7 +914,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
{
|
{
|
||||||
IASTTranslationUnit tu = parse( "class A { int f1(); }; const int x = 4; int f() { return x; } int A::f1() { return x; }"); //$NON-NLS-1$
|
IASTTranslationUnit tu = parse( "class A { int f1(); }; const int x = 4; int f() { return x; } int A::f1() { return x; }"); //$NON-NLS-1$
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 9 );
|
assertEquals( col.size(), 9 );
|
||||||
ICPPClassType A = (ICPPClassType) col.getName(0).resolveBinding();
|
ICPPClassType A = (ICPPClassType) col.getName(0).resolveBinding();
|
||||||
|
@ -929,7 +931,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
{
|
{
|
||||||
IASTTranslationUnit tu = parse( "const int FIVE = 5; void f() { int x = 0; for( int i = 0; i < FIVE; ++i ) { x += i; } }"); //$NON-NLS-1$
|
IASTTranslationUnit tu = parse( "const int FIVE = 5; void f() { int x = 0; for( int i = 0; i < FIVE; ++i ) { x += i; } }"); //$NON-NLS-1$
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 9 );
|
assertEquals( col.size(), 9 );
|
||||||
IVariable FIVE = (IVariable) col.getName(0).resolveBinding();
|
IVariable FIVE = (IVariable) col.getName(0).resolveBinding();
|
||||||
|
@ -945,7 +947,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
{
|
{
|
||||||
IASTTranslationUnit tu = parse( "union{ int v; char a; } id;" ); //$NON-NLS-1$
|
IASTTranslationUnit tu = parse( "union{ int v; char a; } id;" ); //$NON-NLS-1$
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 4 );
|
assertEquals( col.size(), 4 );
|
||||||
|
|
||||||
|
@ -978,7 +980,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
assertTrue( ifstmt.getElseClause() instanceof IASTCompoundStatement );
|
assertTrue( ifstmt.getElseClause() instanceof IASTCompoundStatement );
|
||||||
|
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 4 );
|
assertEquals( col.size(), 4 );
|
||||||
|
|
||||||
|
@ -990,7 +992,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
{
|
{
|
||||||
IASTTranslationUnit tu = parse( "const bool T = true; void foo() { int x = 0; while( T ) { ++x; if( x == 100 ) break; } }"); //$NON-NLS-1$
|
IASTTranslationUnit tu = parse( "const bool T = true; void foo() { int x = 0; while( T ) { ++x; if( x == 100 ) break; } }"); //$NON-NLS-1$
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 6 );
|
assertEquals( col.size(), 6 );
|
||||||
IVariable T = (IVariable) col.getName(0).resolveBinding();
|
IVariable T = (IVariable) col.getName(0).resolveBinding();
|
||||||
|
@ -1014,7 +1016,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
" blah : ; " + //$NON-NLS-1$
|
" blah : ; " + //$NON-NLS-1$
|
||||||
"} "); //$NON-NLS-1$
|
"} "); //$NON-NLS-1$
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 7 );
|
assertEquals( col.size(), 7 );
|
||||||
IVariable x = (IVariable) col.getName(0).resolveBinding();
|
IVariable x = (IVariable) col.getName(0).resolveBinding();
|
||||||
|
@ -1030,7 +1032,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
{
|
{
|
||||||
IASTTranslationUnit tu = parse( "const int x = 3; int counter = 0; void foo() { do { ++counter; } while( counter != x ); } "); //$NON-NLS-1$
|
IASTTranslationUnit tu = parse( "const int x = 3; int counter = 0; void foo() { do { ++counter; } while( counter != x ); } "); //$NON-NLS-1$
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 6 );
|
assertEquals( col.size(), 6 );
|
||||||
IVariable x = (IVariable) col.getName(0).resolveBinding();
|
IVariable x = (IVariable) col.getName(0).resolveBinding();
|
||||||
|
@ -1043,7 +1045,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
{
|
{
|
||||||
IASTTranslationUnit tu = parse( "class A { }; void foo() throw ( A ) { throw A; throw; } "); //$NON-NLS-1$
|
IASTTranslationUnit tu = parse( "class A { }; void foo() throw ( A ) { throw A; throw; } "); //$NON-NLS-1$
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 4 );
|
assertEquals( col.size(), 4 );
|
||||||
ICompositeType A = (ICompositeType) col.getName(0).resolveBinding();
|
ICompositeType A = (ICompositeType) col.getName(0).resolveBinding();
|
||||||
|
@ -1055,7 +1057,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
{
|
{
|
||||||
IASTTranslationUnit tu = parse( "void foo() { int x = 3; if( x == 1 ) { int x = 4; } else int x = 2; }"); //$NON-NLS-1$
|
IASTTranslationUnit tu = parse( "void foo() { int x = 3; if( x == 1 ) { int x = 4; } else int x = 2; }"); //$NON-NLS-1$
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 5 );
|
assertEquals( col.size(), 5 );
|
||||||
IVariable x1 = (IVariable) col.getName(1).resolveBinding();
|
IVariable x1 = (IVariable) col.getName(1).resolveBinding();
|
||||||
|
@ -1071,7 +1073,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
{
|
{
|
||||||
IASTTranslationUnit tu = parse( "enum E { e1, e2, e3 }; E anE = e1;"); //$NON-NLS-1$
|
IASTTranslationUnit tu = parse( "enum E { e1, e2, e3 }; E anE = e1;"); //$NON-NLS-1$
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 7 );
|
assertEquals( col.size(), 7 );
|
||||||
IEnumeration E = (IEnumeration) col.getName(0).resolveBinding();
|
IEnumeration E = (IEnumeration) col.getName(0).resolveBinding();
|
||||||
|
@ -1091,7 +1093,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
{
|
{
|
||||||
IASTTranslationUnit tu = parse( "void foo(); void foo() { } class SearchMe { };"); //$NON-NLS-1$
|
IASTTranslationUnit tu = parse( "void foo(); void foo() { } class SearchMe { };"); //$NON-NLS-1$
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 3 );
|
assertEquals( col.size(), 3 );
|
||||||
IFunction foo = (IFunction) col.getName(0).resolveBinding();
|
IFunction foo = (IFunction) col.getName(0).resolveBinding();
|
||||||
|
@ -1103,7 +1105,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
{
|
{
|
||||||
IASTTranslationUnit tu = parse( "struct B {}; struct D : B {}; void foo(D* dp) { B* bp = dynamic_cast<B*>(dp); }" ); //$NON-NLS-1$
|
IASTTranslationUnit tu = parse( "struct B {}; struct D : B {}; void foo(D* dp) { B* bp = dynamic_cast<B*>(dp); }" ); //$NON-NLS-1$
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 10 );
|
assertEquals( col.size(), 10 );
|
||||||
ICompositeType B = (ICompositeType) col.getName(0).resolveBinding();
|
ICompositeType B = (ICompositeType) col.getName(0).resolveBinding();
|
||||||
|
@ -1116,7 +1118,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
public void testBug43503A() throws Exception {
|
public void testBug43503A() throws Exception {
|
||||||
IASTTranslationUnit tu = parse("class SD_01 { void f_SD_01() {}}; int main(){ SD_01 * a = new SD_01(); a->f_SD_01(); } "); //$NON-NLS-1$
|
IASTTranslationUnit tu = parse("class SD_01 { void f_SD_01() {}}; int main(){ SD_01 * a = new SD_01(); a->f_SD_01(); } "); //$NON-NLS-1$
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 8 );
|
assertEquals( col.size(), 8 );
|
||||||
ICPPClassType SD_01 = (ICPPClassType) col.getName(0).resolveBinding();
|
ICPPClassType SD_01 = (ICPPClassType) col.getName(0).resolveBinding();
|
||||||
|
@ -1143,7 +1145,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse( code.toString() );
|
IASTTranslationUnit tu = parse( code.toString() );
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 12 );
|
assertEquals( col.size(), 12 );
|
||||||
ICompositeType OperatorOverload = (ICompositeType) col.getName(0).resolveBinding();
|
ICompositeType OperatorOverload = (ICompositeType) col.getName(0).resolveBinding();
|
||||||
|
@ -1161,7 +1163,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
{
|
{
|
||||||
IASTTranslationUnit tu = parse( "class A { static int x; }; int A::x = 5;" ); //$NON-NLS-1$
|
IASTTranslationUnit tu = parse( "class A { static int x; }; int A::x = 5;" ); //$NON-NLS-1$
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 5 );
|
assertEquals( col.size(), 5 );
|
||||||
ICompositeType A = (ICompositeType) col.getName(0).resolveBinding();
|
ICompositeType A = (ICompositeType) col.getName(0).resolveBinding();
|
||||||
|
@ -1175,7 +1177,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
{
|
{
|
||||||
IASTTranslationUnit tu = parse( "const int w = 2; int x[ 5 ]; int y = sizeof ( x[w] );" ); //$NON-NLS-1$
|
IASTTranslationUnit tu = parse( "const int w = 2; int x[ 5 ]; int y = sizeof ( x[w] );" ); //$NON-NLS-1$
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 5 );
|
assertEquals( col.size(), 5 );
|
||||||
IVariable w = (IVariable) col.getName(0).resolveBinding();
|
IVariable w = (IVariable) col.getName(0).resolveBinding();
|
||||||
|
@ -1214,7 +1216,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
IASTTranslationUnit tu = parse( buff.toString() );
|
IASTTranslationUnit tu = parse( buff.toString() );
|
||||||
|
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 17 );
|
assertEquals( col.size(), 17 );
|
||||||
ICompositeType SD_02 = (ICompositeType) col.getName(0).resolveBinding();
|
ICompositeType SD_02 = (ICompositeType) col.getName(0).resolveBinding();
|
||||||
|
@ -1236,7 +1238,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
{
|
{
|
||||||
IASTTranslationUnit tu = parse( "struct Sample { int size() const; }; extern const Sample * getSample(); int trouble() { return getSample()->size(); } " ); //$NON-NLS-1$
|
IASTTranslationUnit tu = parse( "struct Sample { int size() const; }; extern const Sample * getSample(); int trouble() { return getSample()->size(); } " ); //$NON-NLS-1$
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 7 );
|
assertEquals( col.size(), 7 );
|
||||||
ICompositeType sample = (ICompositeType) col.getName(0).resolveBinding();
|
ICompositeType sample = (ICompositeType) col.getName(0).resolveBinding();
|
||||||
|
@ -1252,7 +1254,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
{
|
{
|
||||||
IASTTranslationUnit tu = parse( "struct Sample{int size() const; }; struct Sample; " ); //$NON-NLS-1$
|
IASTTranslationUnit tu = parse( "struct Sample{int size() const; }; struct Sample; " ); //$NON-NLS-1$
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 3 );
|
assertEquals( col.size(), 3 );
|
||||||
ICompositeType sample = (ICompositeType) col.getName(0).resolveBinding();
|
ICompositeType sample = (ICompositeType) col.getName(0).resolveBinding();
|
||||||
|
@ -1266,7 +1268,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
{
|
{
|
||||||
IASTTranslationUnit tu = parse( "class B{ B(); ~B(); }; B::B(){} B::~B(){}" ); //$NON-NLS-1$
|
IASTTranslationUnit tu = parse( "class B{ B(); ~B(); }; B::B(){} B::~B(){}" ); //$NON-NLS-1$
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 9 );
|
assertEquals( col.size(), 9 );
|
||||||
ICPPClassType B = (ICPPClassType) col.getName(0).resolveBinding();
|
ICPPClassType B = (ICPPClassType) col.getName(0).resolveBinding();
|
||||||
|
@ -1281,7 +1283,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
public void testBug44342() throws Exception {
|
public void testBug44342() throws Exception {
|
||||||
IASTTranslationUnit tu = parse("class A { void f(){} void f(int){} }; int main(){ A * a = new A(); a->f();} "); //$NON-NLS-1$
|
IASTTranslationUnit tu = parse("class A { void f(){} void f(int){} }; int main(){ A * a = new A(); a->f();} "); //$NON-NLS-1$
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 10 );
|
assertEquals( col.size(), 10 );
|
||||||
ICPPClassType A = (ICPPClassType) col.getName(0).resolveBinding();
|
ICPPClassType A = (ICPPClassType) col.getName(0).resolveBinding();
|
||||||
|
@ -1344,7 +1346,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
"void main(){ int i = initialize(); }" ); //$NON-NLS-1$
|
"void main(){ int i = initialize(); }" ); //$NON-NLS-1$
|
||||||
|
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 7 );
|
assertEquals( col.size(), 7 );
|
||||||
IFunction init1 = (IFunction) col.getName(0).resolveBinding();
|
IFunction init1 = (IFunction) col.getName(0).resolveBinding();
|
||||||
|
@ -1364,7 +1366,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
IASTTranslationUnit tu = parse( buffer.toString() );
|
IASTTranslationUnit tu = parse( buffer.toString() );
|
||||||
|
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 7 );
|
assertEquals( col.size(), 7 );
|
||||||
ICPPClassType myClass = (ICPPClassType) col.getName(0).resolveBinding();
|
ICPPClassType myClass = (ICPPClassType) col.getName(0).resolveBinding();
|
||||||
|
@ -1388,7 +1390,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
IASTTranslationUnit tu = parse( buffer.toString() );
|
IASTTranslationUnit tu = parse( buffer.toString() );
|
||||||
|
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 12 );
|
assertEquals( col.size(), 12 );
|
||||||
ICPPClassType A = (ICPPClassType) col.getName(0).resolveBinding();
|
ICPPClassType A = (ICPPClassType) col.getName(0).resolveBinding();
|
||||||
|
@ -1420,7 +1422,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
IASTTranslationUnit tu = parse( buffer.toString() );
|
IASTTranslationUnit tu = parse( buffer.toString() );
|
||||||
|
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 5 );
|
assertEquals( col.size(), 5 );
|
||||||
ICPPClassType s = (ICPPClassType) col.getName(0).resolveBinding();
|
ICPPClassType s = (ICPPClassType) col.getName(0).resolveBinding();
|
||||||
|
@ -1444,7 +1446,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
IASTTranslationUnit tu = parse( buffer.toString() );
|
IASTTranslationUnit tu = parse( buffer.toString() );
|
||||||
|
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 13 );
|
assertEquals( col.size(), 13 );
|
||||||
ICPPNamespace N = (ICPPNamespace) col.getName(0).resolveBinding();
|
ICPPNamespace N = (ICPPNamespace) col.getName(0).resolveBinding();
|
||||||
|
@ -1468,7 +1470,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
IASTTranslationUnit tu = parse( buffer.toString() );
|
IASTTranslationUnit tu = parse( buffer.toString() );
|
||||||
|
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 5 );
|
assertEquals( col.size(), 5 );
|
||||||
IFunction x = (IFunction) col.getName(0).resolveBinding();
|
IFunction x = (IFunction) col.getName(0).resolveBinding();
|
||||||
|
@ -1488,7 +1490,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
IASTTranslationUnit tu = parse( buffer.toString() );
|
IASTTranslationUnit tu = parse( buffer.toString() );
|
||||||
|
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 3 );
|
assertEquals( col.size(), 3 );
|
||||||
IFunction foo = (IFunction) col.getName(0).resolveBinding();
|
IFunction foo = (IFunction) col.getName(0).resolveBinding();
|
||||||
|
@ -1500,7 +1502,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
IASTTranslationUnit tu = parse( "A anA; int x = c; class A {}; A * anotherA = &anA; int b;", false ); //$NON-NLS-1$
|
IASTTranslationUnit tu = parse( "A anA; int x = c; class A {}; A * anotherA = &anA; int b;", false ); //$NON-NLS-1$
|
||||||
|
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 9 );
|
assertEquals( col.size(), 9 );
|
||||||
IProblemBinding p = (IProblemBinding) col.getName(0).resolveBinding();
|
IProblemBinding p = (IProblemBinding) col.getName(0).resolveBinding();
|
||||||
|
@ -1523,7 +1525,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
IASTTranslationUnit tu = parse ("class A{ int getX() {return x[1];} int x[10];};"); //$NON-NLS-1$
|
IASTTranslationUnit tu = parse ("class A{ int getX() {return x[1];} int x[10];};"); //$NON-NLS-1$
|
||||||
|
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 4 );
|
assertEquals( col.size(), 4 );
|
||||||
|
|
||||||
|
@ -1548,7 +1550,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
writer.write( "void f( char * ){} \n" ); //$NON-NLS-1$
|
writer.write( "void f( char * ){} \n" ); //$NON-NLS-1$
|
||||||
IASTTranslationUnit tu = parse( writer.toString() );
|
IASTTranslationUnit tu = parse( writer.toString() );
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 4 );
|
assertEquals( col.size(), 4 );
|
||||||
IFunction f1 = (IFunction) col.getName(0).resolveBinding();
|
IFunction f1 = (IFunction) col.getName(0).resolveBinding();
|
||||||
|
@ -1567,7 +1569,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse( writer.toString() );
|
IASTTranslationUnit tu = parse( writer.toString() );
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 4 );
|
assertEquals( col.size(), 4 );
|
||||||
IFunction f1 = (IFunction) col.getName(0).resolveBinding();
|
IFunction f1 = (IFunction) col.getName(0).resolveBinding();
|
||||||
|
@ -1586,7 +1588,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse( writer.toString() );
|
IASTTranslationUnit tu = parse( writer.toString() );
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 3 );
|
assertEquals( col.size(), 3 );
|
||||||
|
|
||||||
|
@ -1611,7 +1613,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse( writer.toString() );
|
IASTTranslationUnit tu = parse( writer.toString() );
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 11 );
|
assertEquals( col.size(), 11 );
|
||||||
IVariable i = (IVariable)col.getName(1).resolveBinding();
|
IVariable i = (IVariable)col.getName(1).resolveBinding();
|
||||||
|
@ -1629,7 +1631,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
parse( writer.toString() );
|
parse( writer.toString() );
|
||||||
IASTTranslationUnit tu = parse( writer.toString() );
|
IASTTranslationUnit tu = parse( writer.toString() );
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 4 );
|
assertEquals( col.size(), 4 );
|
||||||
ICPPField pfi = (ICPPField)col.getName(2).resolveBinding();
|
ICPPField pfi = (ICPPField)col.getName(2).resolveBinding();
|
||||||
|
@ -1648,7 +1650,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
{
|
{
|
||||||
IASTTranslationUnit tu = parse( "typedef struct blah sb;"); //$NON-NLS-1$
|
IASTTranslationUnit tu = parse( "typedef struct blah sb;"); //$NON-NLS-1$
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 2 );
|
assertEquals( col.size(), 2 );
|
||||||
|
|
||||||
|
@ -1680,7 +1682,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
IASTTranslationUnit tu = parse( writer.toString() );
|
IASTTranslationUnit tu = parse( writer.toString() );
|
||||||
|
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 10 );
|
assertEquals( col.size(), 10 );
|
||||||
|
|
||||||
|
@ -1704,7 +1706,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
writer.write( "void X::f( T ) { } " ); //$NON-NLS-1$
|
writer.write( "void X::f( T ) { } " ); //$NON-NLS-1$
|
||||||
IASTTranslationUnit tu = parse( writer.toString() );
|
IASTTranslationUnit tu = parse( writer.toString() );
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 10 );
|
assertEquals( col.size(), 10 );
|
||||||
ICPPClassType X = (ICPPClassType) col.getName(0).resolveBinding();
|
ICPPClassType X = (ICPPClassType) col.getName(0).resolveBinding();
|
||||||
|
@ -1724,7 +1726,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
writer.write( "class AltG3 : AltG2 { int x;};"); //$NON-NLS-1$
|
writer.write( "class AltG3 : AltG2 { int x;};"); //$NON-NLS-1$
|
||||||
IASTTranslationUnit tu = parse( writer.toString() );
|
IASTTranslationUnit tu = parse( writer.toString() );
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 7 );
|
assertEquals( col.size(), 7 );
|
||||||
ICPPClassType G2 = (ICPPClassType) col.getName(0).resolveBinding();
|
ICPPClassType G2 = (ICPPClassType) col.getName(0).resolveBinding();
|
||||||
|
@ -1746,7 +1748,7 @@ public class CompleteParser2Tests extends TestCase {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse( writer.toString(), true, ParserLanguage.C );
|
IASTTranslationUnit tu = parse( writer.toString(), true, ParserLanguage.C );
|
||||||
CNameCollector col = new CNameCollector();
|
CNameCollector col = new CNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( col );
|
tu.accept( col );
|
||||||
|
|
||||||
assertEquals( col.size(), 9 );
|
assertEquals( col.size(), 9 );
|
||||||
ICompositeType A = (ICompositeType) col.getName(0).resolveBinding();
|
ICompositeType A = (ICompositeType) col.getName(0).resolveBinding();
|
||||||
|
|
|
@ -51,7 +51,7 @@ public class GCCTests extends AST2BaseTest {
|
||||||
IASTTranslationUnit tu = parse( buffer.toString(), ParserLanguage.C );
|
IASTTranslationUnit tu = parse( buffer.toString(), ParserLanguage.C );
|
||||||
|
|
||||||
CNameCollector collector = new CNameCollector();
|
CNameCollector collector = new CNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( collector );
|
tu.accept( collector );
|
||||||
|
|
||||||
assertEquals( collector.size(), 33 );
|
assertEquals( collector.size(), 33 );
|
||||||
ICompositeType x = (ICompositeType) collector.getName( 0 ).resolveBinding();
|
ICompositeType x = (ICompositeType) collector.getName( 0 ).resolveBinding();
|
||||||
|
@ -92,7 +92,7 @@ public class GCCTests extends AST2BaseTest {
|
||||||
IASTTranslationUnit tu = parse( buffer.toString(), ParserLanguage.C );
|
IASTTranslationUnit tu = parse( buffer.toString(), ParserLanguage.C );
|
||||||
|
|
||||||
CNameCollector collector = new CNameCollector();
|
CNameCollector collector = new CNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( collector );
|
tu.accept( collector );
|
||||||
|
|
||||||
assertEquals( collector.size(), 5 );
|
assertEquals( collector.size(), 5 );
|
||||||
IFunction f = (IFunction) collector.getName( 0 ).resolveBinding();
|
IFunction f = (IFunction) collector.getName( 0 ).resolveBinding();
|
||||||
|
@ -119,7 +119,7 @@ public class GCCTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse( buffer.toString(), ParserLanguage.C );
|
IASTTranslationUnit tu = parse( buffer.toString(), ParserLanguage.C );
|
||||||
CNameCollector collector = new CNameCollector();
|
CNameCollector collector = new CNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( collector );
|
tu.accept( collector );
|
||||||
|
|
||||||
assertEquals( collector.size(), 12 );
|
assertEquals( collector.size(), 12 );
|
||||||
|
|
||||||
|
@ -157,7 +157,7 @@ public class GCCTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse( buffer.toString(), ParserLanguage.C );
|
IASTTranslationUnit tu = parse( buffer.toString(), ParserLanguage.C );
|
||||||
CNameCollector collector = new CNameCollector();
|
CNameCollector collector = new CNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( collector );
|
tu.accept( collector );
|
||||||
|
|
||||||
assertEquals( collector.size(), 16 );
|
assertEquals( collector.size(), 16 );
|
||||||
IVariable loop1 = (IVariable) collector.getName( 0 ).resolveBinding();
|
IVariable loop1 = (IVariable) collector.getName( 0 ).resolveBinding();
|
||||||
|
@ -191,7 +191,7 @@ public class GCCTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse( buffer.toString(), ParserLanguage.C );
|
IASTTranslationUnit tu = parse( buffer.toString(), ParserLanguage.C );
|
||||||
CNameCollector collector = new CNameCollector();
|
CNameCollector collector = new CNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( collector );
|
tu.accept( collector );
|
||||||
|
|
||||||
assertEquals( collector.size(), 11 );
|
assertEquals( collector.size(), 11 );
|
||||||
IVariable nResult = (IVariable) collector.getName( 1 ).resolveBinding();
|
IVariable nResult = (IVariable) collector.getName( 1 ).resolveBinding();
|
||||||
|
@ -219,7 +219,7 @@ public class GCCTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse( buffer.toString(), ParserLanguage.C );
|
IASTTranslationUnit tu = parse( buffer.toString(), ParserLanguage.C );
|
||||||
CNameCollector collector = new CNameCollector();
|
CNameCollector collector = new CNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( collector );
|
tu.accept( collector );
|
||||||
|
|
||||||
assertEquals( collector.size(), 11 );
|
assertEquals( collector.size(), 11 );
|
||||||
IVariable f = (IVariable) collector.getName( 0 ).resolveBinding();
|
IVariable f = (IVariable) collector.getName( 0 ).resolveBinding();
|
||||||
|
@ -249,7 +249,7 @@ public class GCCTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse( buffer.toString(), ParserLanguage.C );
|
IASTTranslationUnit tu = parse( buffer.toString(), ParserLanguage.C );
|
||||||
CNameCollector collector = new CNameCollector();
|
CNameCollector collector = new CNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( collector );
|
tu.accept( collector );
|
||||||
|
|
||||||
assertEquals( collector.size(), 19 );
|
assertEquals( collector.size(), 19 );
|
||||||
IFunction buggy = (IFunction) collector.getName(0).resolveBinding();
|
IFunction buggy = (IFunction) collector.getName(0).resolveBinding();
|
||||||
|
@ -284,7 +284,7 @@ public class GCCTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse( buffer.toString(), ParserLanguage.C );
|
IASTTranslationUnit tu = parse( buffer.toString(), ParserLanguage.C );
|
||||||
CNameCollector collector = new CNameCollector();
|
CNameCollector collector = new CNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( collector );
|
tu.accept( collector );
|
||||||
|
|
||||||
assertEquals( collector.size(), 7 );
|
assertEquals( collector.size(), 7 );
|
||||||
IVariable winds = (IVariable) collector.getName( 1 ).resolveBinding();
|
IVariable winds = (IVariable) collector.getName( 1 ).resolveBinding();
|
||||||
|
@ -310,7 +310,7 @@ public class GCCTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse( buffer.toString(), ParserLanguage.C );
|
IASTTranslationUnit tu = parse( buffer.toString(), ParserLanguage.C );
|
||||||
CNameCollector collector = new CNameCollector();
|
CNameCollector collector = new CNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( collector );
|
tu.accept( collector );
|
||||||
|
|
||||||
assertEquals( collector.size(), 15 );
|
assertEquals( collector.size(), 15 );
|
||||||
ITypedef uint64 = (ITypedef) collector.getName( 0 ).resolveBinding();
|
ITypedef uint64 = (ITypedef) collector.getName( 0 ).resolveBinding();
|
||||||
|
@ -348,7 +348,7 @@ public class GCCTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse( buffer.toString(), ParserLanguage.C );
|
IASTTranslationUnit tu = parse( buffer.toString(), ParserLanguage.C );
|
||||||
CNameCollector collector = new CNameCollector();
|
CNameCollector collector = new CNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( collector );
|
tu.accept( collector );
|
||||||
|
|
||||||
assertEquals( collector.size(), 34 );
|
assertEquals( collector.size(), 34 );
|
||||||
IVariable aa = (IVariable) collector.getName( 0 ).resolveBinding();
|
IVariable aa = (IVariable) collector.getName( 0 ).resolveBinding();
|
||||||
|
@ -390,7 +390,7 @@ public class GCCTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse( buffer.toString(), ParserLanguage.C );
|
IASTTranslationUnit tu = parse( buffer.toString(), ParserLanguage.C );
|
||||||
CNameCollector collector = new CNameCollector();
|
CNameCollector collector = new CNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( collector );
|
tu.accept( collector );
|
||||||
|
|
||||||
assertEquals( collector.size(), 11 );
|
assertEquals( collector.size(), 11 );
|
||||||
IVariable i = (IVariable) collector.getName( 0 ).resolveBinding();
|
IVariable i = (IVariable) collector.getName( 0 ).resolveBinding();
|
||||||
|
@ -419,7 +419,7 @@ public class GCCTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse( buffer.toString(), ParserLanguage.C );
|
IASTTranslationUnit tu = parse( buffer.toString(), ParserLanguage.C );
|
||||||
CNameCollector collector = new CNameCollector();
|
CNameCollector collector = new CNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( collector );
|
tu.accept( collector );
|
||||||
|
|
||||||
assertEquals( collector.size(), 14 );
|
assertEquals( collector.size(), 14 );
|
||||||
IFunction f = (IFunction) collector.getName( 0 ).resolveBinding();
|
IFunction f = (IFunction) collector.getName( 0 ).resolveBinding();
|
||||||
|
@ -459,7 +459,7 @@ public class GCCTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse( buffer.toString(), ParserLanguage.C );
|
IASTTranslationUnit tu = parse( buffer.toString(), ParserLanguage.C );
|
||||||
CNameCollector collector = new CNameCollector();
|
CNameCollector collector = new CNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( collector );
|
tu.accept( collector );
|
||||||
|
|
||||||
assertEquals( collector.size(), 36 );
|
assertEquals( collector.size(), 36 );
|
||||||
IField y = (IField) collector.getName( 1 ).resolveBinding();
|
IField y = (IField) collector.getName( 1 ).resolveBinding();
|
||||||
|
@ -504,7 +504,7 @@ public class GCCTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse( buffer.toString(), ParserLanguage.C );
|
IASTTranslationUnit tu = parse( buffer.toString(), ParserLanguage.C );
|
||||||
CNameCollector collector = new CNameCollector();
|
CNameCollector collector = new CNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( collector );
|
tu.accept( collector );
|
||||||
|
|
||||||
assertEquals( collector.size(), 43 );
|
assertEquals( collector.size(), 43 );
|
||||||
IFunction f = (IFunction) collector.getName( 0 ).resolveBinding();
|
IFunction f = (IFunction) collector.getName( 0 ).resolveBinding();
|
||||||
|
@ -550,7 +550,7 @@ public class GCCTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse( buffer.toString(), ParserLanguage.C );
|
IASTTranslationUnit tu = parse( buffer.toString(), ParserLanguage.C );
|
||||||
CNameCollector collector = new CNameCollector();
|
CNameCollector collector = new CNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( collector );
|
tu.accept( collector );
|
||||||
|
|
||||||
assertEquals( collector.size(), 10 );
|
assertEquals( collector.size(), 10 );
|
||||||
IField node = (IField) collector.getName( 3 ).resolveBinding();
|
IField node = (IField) collector.getName( 3 ).resolveBinding();
|
||||||
|
@ -579,7 +579,7 @@ public class GCCTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse( buffer.toString(), ParserLanguage.C );
|
IASTTranslationUnit tu = parse( buffer.toString(), ParserLanguage.C );
|
||||||
CNameCollector collector = new CNameCollector();
|
CNameCollector collector = new CNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( collector );
|
tu.accept( collector );
|
||||||
|
|
||||||
assertEquals( collector.size(), 25 );
|
assertEquals( collector.size(), 25 );
|
||||||
ICompositeType foo = (ICompositeType) collector.getName( 0 ).resolveBinding();
|
ICompositeType foo = (ICompositeType) collector.getName( 0 ).resolveBinding();
|
||||||
|
@ -621,7 +621,7 @@ public class GCCTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse( buffer.toString(), ParserLanguage.C );
|
IASTTranslationUnit tu = parse( buffer.toString(), ParserLanguage.C );
|
||||||
CNameCollector collector = new CNameCollector();
|
CNameCollector collector = new CNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( collector );
|
tu.accept( collector );
|
||||||
|
|
||||||
assertEquals( collector.size(), 6 );
|
assertEquals( collector.size(), 6 );
|
||||||
IFunction sub = (IFunction) collector.getName( 0 ).resolveBinding();
|
IFunction sub = (IFunction) collector.getName( 0 ).resolveBinding();
|
||||||
|
@ -663,7 +663,7 @@ public class GCCTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse( buffer.toString(), ParserLanguage.C );
|
IASTTranslationUnit tu = parse( buffer.toString(), ParserLanguage.C );
|
||||||
CNameCollector collector = new CNameCollector();
|
CNameCollector collector = new CNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( collector );
|
tu.accept( collector );
|
||||||
|
|
||||||
assertEquals( collector.size(), 95 );
|
assertEquals( collector.size(), 95 );
|
||||||
IFunction f = (IFunction) collector.getName( 0 ).resolveBinding();
|
IFunction f = (IFunction) collector.getName( 0 ).resolveBinding();
|
||||||
|
@ -703,7 +703,7 @@ public class GCCTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse( buffer.toString(), ParserLanguage.C );
|
IASTTranslationUnit tu = parse( buffer.toString(), ParserLanguage.C );
|
||||||
CNameCollector collector = new CNameCollector();
|
CNameCollector collector = new CNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( collector );
|
tu.accept( collector );
|
||||||
|
|
||||||
assertEquals( collector.size(), 22 );
|
assertEquals( collector.size(), 22 );
|
||||||
ICompositeType s1 = (ICompositeType) collector.getName( 0 ).resolveBinding();
|
ICompositeType s1 = (ICompositeType) collector.getName( 0 ).resolveBinding();
|
||||||
|
@ -741,7 +741,7 @@ public class GCCTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse( buffer.toString(), ParserLanguage.C );
|
IASTTranslationUnit tu = parse( buffer.toString(), ParserLanguage.C );
|
||||||
CNameCollector collector = new CNameCollector();
|
CNameCollector collector = new CNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( collector );
|
tu.accept( collector );
|
||||||
|
|
||||||
assertEquals( collector.size(), 27 );
|
assertEquals( collector.size(), 27 );
|
||||||
ICompositeType F = (ICompositeType) collector.getName( 0 ).resolveBinding();
|
ICompositeType F = (ICompositeType) collector.getName( 0 ).resolveBinding();
|
||||||
|
@ -779,7 +779,7 @@ public class GCCTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse( buffer.toString(), ParserLanguage.C );
|
IASTTranslationUnit tu = parse( buffer.toString(), ParserLanguage.C );
|
||||||
CNameCollector collector = new CNameCollector();
|
CNameCollector collector = new CNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( collector );
|
tu.accept( collector );
|
||||||
|
|
||||||
assertEquals( collector.size(), 14 );
|
assertEquals( collector.size(), 14 );
|
||||||
ICompositeType F = (ICompositeType) collector.getName( 0 ).resolveBinding();
|
ICompositeType F = (ICompositeType) collector.getName( 0 ).resolveBinding();
|
||||||
|
@ -810,7 +810,7 @@ public class GCCTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse( buffer.toString(), ParserLanguage.C );
|
IASTTranslationUnit tu = parse( buffer.toString(), ParserLanguage.C );
|
||||||
CNameCollector collector = new CNameCollector();
|
CNameCollector collector = new CNameCollector();
|
||||||
tu.getVisitor().visitTranslationUnit( collector );
|
tu.accept( collector );
|
||||||
|
|
||||||
assertEquals( collector.size(), 11 );
|
assertEquals( collector.size(), 11 );
|
||||||
IEnumeration foo = (IEnumeration) collector.getName( 0 ).resolveBinding();
|
IEnumeration foo = (IEnumeration) collector.getName( 0 ).resolveBinding();
|
||||||
|
|
|
@ -0,0 +1,52 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2004 IBM Corporation and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Common Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/cpl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* IBM Corporation - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Created on Mar 8, 2005
|
||||||
|
*/
|
||||||
|
package org.eclipse.cdt.core.dom.ast;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator;
|
||||||
|
|
||||||
|
|
||||||
|
public abstract class ASTVisitor {
|
||||||
|
public boolean shouldVisitNames = false;
|
||||||
|
public boolean shouldVisitDeclarations = false;
|
||||||
|
public boolean shouldVisitInitializers = false;
|
||||||
|
public boolean shouldVisitParameterDeclarations = false;
|
||||||
|
public boolean shouldVisitDeclarators = false;
|
||||||
|
public boolean shouldVisitDeclSpecifiers = false;
|
||||||
|
public boolean shouldVisitExpressions = false;
|
||||||
|
public boolean shouldVisitStatements = false;
|
||||||
|
public boolean shouldVisitTypeIds = false;
|
||||||
|
public boolean shouldVisitEnumerators = false;
|
||||||
|
public boolean shouldVisitTranslationUnit = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return continue to continue visiting, abort to stop, skip to not descend into this node.
|
||||||
|
*/
|
||||||
|
public final static int PROCESS_SKIP = 1;
|
||||||
|
public final static int PROCESS_ABORT = 2;
|
||||||
|
public final static int PROCESS_CONTINUE = 3;
|
||||||
|
|
||||||
|
|
||||||
|
public int visit( IASTTranslationUnit tu ) { return PROCESS_CONTINUE; }
|
||||||
|
public int visit( IASTName name ) { return PROCESS_CONTINUE; }
|
||||||
|
public int visit( IASTDeclaration declaration ) { return PROCESS_CONTINUE; }
|
||||||
|
public int visit( IASTInitializer initializer ) { return PROCESS_CONTINUE; }
|
||||||
|
public int visit( IASTParameterDeclaration parameterDeclaration ) { return PROCESS_CONTINUE; }
|
||||||
|
public int visit( IASTDeclarator declarator ) { return PROCESS_CONTINUE; }
|
||||||
|
public int visit( IASTDeclSpecifier declSpec ) {return PROCESS_CONTINUE; }
|
||||||
|
public int visit( IASTExpression expression ) { return PROCESS_CONTINUE; }
|
||||||
|
public int visit( IASTStatement statement ) { return PROCESS_CONTINUE; }
|
||||||
|
public int visit( IASTTypeId typeId ) { return PROCESS_CONTINUE; }
|
||||||
|
public int visit( IASTEnumerator enumerator ) { return PROCESS_CONTINUE; }
|
||||||
|
}
|
|
@ -40,5 +40,6 @@ public interface IASTNode {
|
||||||
|
|
||||||
public void setPropertyInParent( ASTNodeProperty property );
|
public void setPropertyInParent( ASTNodeProperty property );
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor visitor );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,7 +73,5 @@ public interface IASTTranslationUnit extends IASTNode {
|
||||||
|
|
||||||
public String getUnpreprocessedSignature( IASTNodeLocation [] locations );
|
public String getUnpreprocessedSignature( IASTNodeLocation [] locations );
|
||||||
|
|
||||||
public IASTVisitor getVisitor();
|
|
||||||
|
|
||||||
public String getFilePath();
|
public String getFilePath();
|
||||||
}
|
}
|
|
@ -1,66 +0,0 @@
|
||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2004 IBM Corporation and others.
|
|
||||||
* All rights reserved. This program and the accompanying materials
|
|
||||||
* are made available under the terms of the Common Public License v1.0
|
|
||||||
* which accompanies this distribution, and is available at
|
|
||||||
* http://www.eclipse.org/legal/cpl-v10.html
|
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* IBM Corporation - initial API and implementation
|
|
||||||
*******************************************************************************/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Created on Feb 22, 2005
|
|
||||||
*/
|
|
||||||
package org.eclipse.cdt.core.dom.ast;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author aniefer
|
|
||||||
*/
|
|
||||||
public interface IASTVisitor {
|
|
||||||
public static abstract class BaseVisitorAction {
|
|
||||||
public boolean processNames = false;
|
|
||||||
public boolean processDeclarations = false;
|
|
||||||
public boolean processInitializers = false;
|
|
||||||
public boolean processParameterDeclarations = false;
|
|
||||||
public boolean processDeclarators = false;
|
|
||||||
public boolean processDeclSpecifiers = false;
|
|
||||||
public boolean processExpressions = false;
|
|
||||||
public boolean processStatements = false;
|
|
||||||
public boolean processTypeIds = false;
|
|
||||||
public boolean processEnumerators = false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return continue to continue visiting, abort to stop, skip to not descend into this node.
|
|
||||||
*/
|
|
||||||
public final static int PROCESS_SKIP = 1;
|
|
||||||
public final static int PROCESS_ABORT = 2;
|
|
||||||
public final static int PROCESS_CONTINUE = 3;
|
|
||||||
|
|
||||||
|
|
||||||
public int processName( IASTName name ) { return PROCESS_CONTINUE; }
|
|
||||||
public int processDeclaration( IASTDeclaration declaration ){ return PROCESS_CONTINUE; }
|
|
||||||
public int processInitializer( IASTInitializer initializer ){ return PROCESS_CONTINUE; }
|
|
||||||
public int processParameterDeclaration( IASTParameterDeclaration parameterDeclaration ) { return PROCESS_CONTINUE; }
|
|
||||||
public int processDeclarator( IASTDeclarator declarator ) { return PROCESS_CONTINUE; }
|
|
||||||
public int processDeclSpecifier( IASTDeclSpecifier declSpec ){return PROCESS_CONTINUE; }
|
|
||||||
public int processExpression( IASTExpression expression ) { return PROCESS_CONTINUE; }
|
|
||||||
public int processStatement( IASTStatement statement ) { return PROCESS_CONTINUE; }
|
|
||||||
public int processTypeId( IASTTypeId typeId ) { return PROCESS_CONTINUE; }
|
|
||||||
public int processEnumerator( IASTEnumerator enumerator ) { return PROCESS_CONTINUE; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public void visitTranslationUnit( BaseVisitorAction action );
|
|
||||||
public boolean visitDeclaration( IASTDeclaration declaration, BaseVisitorAction action );
|
|
||||||
public boolean visitName( IASTName name, BaseVisitorAction action );
|
|
||||||
public boolean visitDeclSpecifier( IASTDeclSpecifier declSpecifier, BaseVisitorAction action );
|
|
||||||
public boolean visitDeclarator( IASTDeclarator declarator, BaseVisitorAction action );
|
|
||||||
public boolean visitStatement( IASTStatement statement, BaseVisitorAction action );
|
|
||||||
public boolean visitExpression( IASTExpression expression, BaseVisitorAction action );
|
|
||||||
public boolean visitTypeId( IASTTypeId typeId, BaseVisitorAction action );
|
|
||||||
public boolean visitInitializer( IASTInitializer initializer, BaseVisitorAction action );
|
|
||||||
public boolean visitEnumerator( IASTEnumerator enumerator, BaseVisitorAction action );
|
|
||||||
public boolean visitParameterDeclaration( IASTParameterDeclaration parameterDeclaration, BaseVisitorAction action );
|
|
||||||
}
|
|
|
@ -10,22 +10,15 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Created on Feb 22, 2005
|
* Created on Mar 8, 2005
|
||||||
*/
|
*/
|
||||||
package org.eclipse.cdt.core.dom.ast.c;
|
package org.eclipse.cdt.core.dom.ast.c;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTVisitor;
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
|
|
||||||
/**
|
|
||||||
* @author aniefer
|
|
||||||
*/
|
|
||||||
public interface ICASTVisitor extends IASTVisitor {
|
|
||||||
|
|
||||||
public static abstract class CBaseVisitorAction extends BaseVisitorAction {
|
public abstract class CASTVisitor extends ASTVisitor {
|
||||||
public boolean processDesignators = false;
|
public boolean shouldVisitDesignators = false;
|
||||||
|
|
||||||
public int processDesignator( ICASTDesignator designator ) { return PROCESS_CONTINUE; }
|
public int visit( ICASTDesignator designator ) { return PROCESS_CONTINUE; }
|
||||||
}
|
|
||||||
|
|
||||||
public boolean visitDesignator( ICASTDesignator designator, BaseVisitorAction action );
|
|
||||||
}
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2004 IBM Corporation and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Common Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/cpl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* IBM Corporation - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Created on Mar 8, 2005
|
||||||
|
*/
|
||||||
|
package org.eclipse.cdt.core.dom.ast.cpp;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier;
|
||||||
|
|
||||||
|
|
||||||
|
public abstract class CPPASTVisitor extends ASTVisitor{
|
||||||
|
public boolean shouldVisitBaseSpecifiers = false;
|
||||||
|
public boolean shouldVisitNamespaces = false;
|
||||||
|
public boolean shouldVisitTemplateParameters = false;
|
||||||
|
|
||||||
|
public int visit( ICPPASTBaseSpecifier specifier ) { return PROCESS_CONTINUE; }
|
||||||
|
public int visit( ICPPASTNamespaceDefinition namespace ){ return PROCESS_CONTINUE; }
|
||||||
|
public int visit( ICPPASTTemplateParameter parameter ) { return PROCESS_CONTINUE; }
|
||||||
|
}
|
|
@ -1,39 +0,0 @@
|
||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2004 IBM Corporation and others.
|
|
||||||
* All rights reserved. This program and the accompanying materials
|
|
||||||
* are made available under the terms of the Common Public License v1.0
|
|
||||||
* which accompanies this distribution, and is available at
|
|
||||||
* http://www.eclipse.org/legal/cpl-v10.html
|
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* IBM Corporation - initial API and implementation
|
|
||||||
*******************************************************************************/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Created on Feb 22, 2005
|
|
||||||
*/
|
|
||||||
package org.eclipse.cdt.core.dom.ast.cpp;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTVisitor;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author aniefer
|
|
||||||
*/
|
|
||||||
public interface ICPPASTVisitor extends IASTVisitor {
|
|
||||||
|
|
||||||
public static abstract class CPPBaseVisitorAction extends BaseVisitorAction{
|
|
||||||
public boolean processBaseSpecifiers = false;
|
|
||||||
public boolean processNamespaces = false;
|
|
||||||
public boolean processTemplateParameters = false;
|
|
||||||
|
|
||||||
public int processBaseSpecifier(ICPPASTBaseSpecifier specifier) { return PROCESS_CONTINUE; }
|
|
||||||
public int processNamespace( ICPPASTNamespaceDefinition namespace) { return PROCESS_CONTINUE; }
|
|
||||||
public int processTemplateParameter( ICPPASTTemplateParameter parameter) { return PROCESS_CONTINUE; }
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public boolean visitNamespaceDefinition( ICPPASTNamespaceDefinition namespace, BaseVisitorAction action );
|
|
||||||
public abstract boolean visitBaseSpecifier( ICPPASTBaseSpecifier specifier, BaseVisitorAction action );
|
|
||||||
public abstract boolean visitTemplateParameter( ICPPASTTemplateParameter parameter, BaseVisitorAction action );
|
|
||||||
}
|
|
|
@ -9,6 +9,7 @@
|
||||||
* IBM Rational Software - Initial API and implementation */
|
* IBM Rational Software - Initial API and implementation */
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTASMDeclaration;
|
import org.eclipse.cdt.core.dom.ast.IASTASMDeclaration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -32,4 +33,14 @@ public class CASTASMDeclaration extends CASTNode implements IASTASMDeclaration {
|
||||||
this.assembly = assembly.toCharArray();
|
this.assembly = assembly.toCharArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitDeclarations ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,8 +9,10 @@
|
||||||
* IBM Rational Software - Initial API and implementation */
|
* IBM Rational Software - Initial API and implementation */
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTArrayDeclarator;
|
import org.eclipse.cdt.core.dom.ast.IASTArrayDeclarator;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTArrayModifier;
|
import org.eclipse.cdt.core.dom.ast.IASTArrayModifier;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTInitializer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
|
@ -61,4 +63,13 @@ public class CASTArrayDeclarator extends CASTDeclarator implements
|
||||||
arrayMods[ currentIndex++ ] = arrayModifier;
|
arrayMods[ currentIndex++ ] = arrayModifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected boolean postAccept( ASTVisitor action ){
|
||||||
|
IASTArrayModifier [] mods = getArrayModifiers();
|
||||||
|
for ( int i = 0; i < mods.length; i++ ) {
|
||||||
|
if( !mods[i].accept( action ) ) return false;
|
||||||
|
}
|
||||||
|
IASTInitializer initializer = getInitializer();
|
||||||
|
if( initializer != null ) if( !initializer.accept( action ) ) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,9 @@
|
||||||
* IBM Rational Software - Initial API and implementation */
|
* IBM Rational Software - Initial API and implementation */
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.c.CASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.c.ICASTArrayDesignator;
|
import org.eclipse.cdt.core.dom.ast.c.ICASTArrayDesignator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -34,4 +36,15 @@ public class CASTArrayDesignator extends CASTNode implements
|
||||||
exp = value;
|
exp = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action instanceof CASTVisitor && ((CASTVisitor)action).shouldVisitDesignators ){
|
||||||
|
switch( ((CASTVisitor)action).visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( exp != null ) if( !exp.accept( action ) ) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
* IBM Rational Software - Initial API and implementation */
|
* IBM Rational Software - Initial API and implementation */
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTArrayModifier;
|
import org.eclipse.cdt.core.dom.ast.IASTArrayModifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||||
|
|
||||||
|
@ -33,4 +34,8 @@ public class CASTArrayModifier extends CASTNode implements IASTArrayModifier {
|
||||||
this.exp = expression;
|
this.exp = expression;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( exp != null ) if( !exp.accept( action ) ) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,9 @@
|
||||||
* IBM Rational Software - Initial API and implementation */
|
* IBM Rational Software - Initial API and implementation */
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.c.CASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.gnu.c.IGCCASTArrayRangeDesignator;
|
import org.eclipse.cdt.core.dom.ast.gnu.c.IGCCASTArrayRangeDesignator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -48,4 +50,16 @@ public class CASTArrayRangeDesignator extends CASTNode implements
|
||||||
ceiling = expression;
|
ceiling = expression;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action instanceof CASTVisitor && ((CASTVisitor)action).shouldVisitDesignators ){
|
||||||
|
switch( ((CASTVisitor)action).visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( floor != null ) if( !floor.accept( action ) ) return false;
|
||||||
|
if( ceiling != null ) if( !ceiling.accept( action ) ) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
* IBM Rational Software - Initial API and implementation */
|
* IBM Rational Software - Initial API and implementation */
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTArraySubscriptExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTArraySubscriptExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||||
|
|
||||||
|
@ -49,4 +50,17 @@ public class CASTArraySubscriptExpression extends CASTNode implements
|
||||||
this.subscript = expression;
|
this.subscript = expression;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitExpressions ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( array != null ) if( !array.accept( action ) ) return false;
|
||||||
|
if( subscript != null ) if( !subscript.accept( action ) ) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
* IBM Rational Software - Initial API and implementation */
|
* IBM Rational Software - Initial API and implementation */
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTBinaryExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTBinaryExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||||
|
|
||||||
|
@ -64,4 +65,17 @@ public class CASTBinaryExpression extends CASTNode implements
|
||||||
operand2 = expression;
|
operand2 = expression;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitExpressions ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( operand1 != null ) if( !operand1.accept( action ) ) return false;
|
||||||
|
if( operand2 != null ) if( !operand2.accept( action ) ) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
* IBM Rational Software - Initial API and implementation */
|
* IBM Rational Software - Initial API and implementation */
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTBreakStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTBreakStatement;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -16,4 +17,14 @@ import org.eclipse.cdt.core.dom.ast.IASTBreakStatement;
|
||||||
*/
|
*/
|
||||||
public class CASTBreakStatement extends CASTNode implements IASTBreakStatement {
|
public class CASTBreakStatement extends CASTNode implements IASTBreakStatement {
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitStatements ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
* IBM Rational Software - Initial API and implementation */
|
* IBM Rational Software - Initial API and implementation */
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTCaseStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTCaseStatement;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||||
|
|
||||||
|
@ -33,4 +34,16 @@ public class CASTCaseStatement extends CASTNode implements IASTCaseStatement {
|
||||||
this.expression = expression;
|
this.expression = expression;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitStatements ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( expression != null ) if( !expression.accept( action ) ) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,8 +9,10 @@
|
||||||
* IBM Rational Software - Initial API and implementation */
|
* IBM Rational Software - Initial API and implementation */
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTCastExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTCastExpression;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
|
@ -34,4 +36,18 @@ public class CASTCastExpression extends CASTUnaryExpression implements
|
||||||
return typeId;
|
return typeId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitExpressions ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( typeId != null ) if( !typeId.accept( action ) ) return false;
|
||||||
|
IASTExpression operand = getOperand();
|
||||||
|
if( operand != null ) if( !operand.accept( action ) ) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
* IBM Rational Software - Initial API and implementation */
|
* IBM Rational Software - Initial API and implementation */
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
|
@ -118,4 +119,20 @@ public class CASTCompositeTypeSpecifier extends CASTBaseDeclSpecifier implements
|
||||||
return getName().toString() == null ? "" : getName().toString(); //$NON-NLS-1$
|
return getName().toString() == null ? "" : getName().toString(); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitDeclSpecifiers ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( name != null ) if( !name.accept( action ) ) return false;
|
||||||
|
|
||||||
|
IASTDeclaration [] decls = getMembers();
|
||||||
|
for( int i = 0; i < decls.length; i++ )
|
||||||
|
if( !decls[i].accept( action ) ) return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
* IBM Rational Software - Initial API and implementation */
|
* IBM Rational Software - Initial API and implementation */
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTStatement;
|
||||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
|
@ -77,4 +78,19 @@ public class CASTCompoundStatement extends CASTNode implements
|
||||||
return scope;
|
return scope;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitStatements ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
IASTStatement [] s = getStatements();
|
||||||
|
for ( int i = 0; i < s.length; i++ ) {
|
||||||
|
if( !s[i].accept( action ) ) return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
* IBM Rational Software - Initial API and implementation */
|
* IBM Rational Software - Initial API and implementation */
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement;
|
||||||
import org.eclipse.cdt.core.dom.ast.gnu.IGNUASTCompoundStatementExpression;
|
import org.eclipse.cdt.core.dom.ast.gnu.IGNUASTCompoundStatementExpression;
|
||||||
|
|
||||||
|
@ -34,4 +35,16 @@ public class CASTCompoundStatementExpression extends CASTNode implements
|
||||||
this.statement = statement;
|
this.statement = statement;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitExpressions ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( statement != null ) if( !statement.accept( action ) ) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
* IBM Rational Software - Initial API and implementation */
|
* IBM Rational Software - Initial API and implementation */
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTConditionalExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTConditionalExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||||
|
|
||||||
|
@ -64,4 +65,18 @@ public class CASTConditionalExpression extends CASTNode implements
|
||||||
this.negative = expression;
|
this.negative = expression;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitExpressions ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( condition != null ) if( !condition.accept( action ) ) return false;
|
||||||
|
if( postive != null ) if( !postive.accept( action ) ) return false;
|
||||||
|
if( negative != null ) if( !negative.accept( action ) ) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
* IBM Rational Software - Initial API and implementation */
|
* IBM Rational Software - Initial API and implementation */
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTContinueStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTContinueStatement;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -17,4 +18,14 @@ import org.eclipse.cdt.core.dom.ast.IASTContinueStatement;
|
||||||
public class CASTContinueStatement extends CASTNode implements
|
public class CASTContinueStatement extends CASTNode implements
|
||||||
IASTContinueStatement {
|
IASTContinueStatement {
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitStatements ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
* IBM Rational Software - Initial API and implementation */
|
* IBM Rational Software - Initial API and implementation */
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTDeclarationStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTDeclarationStatement;
|
||||||
|
|
||||||
|
@ -34,4 +35,15 @@ public class CASTDeclarationStatement extends CASTNode implements
|
||||||
this.declaration = declaration;
|
this.declaration = declaration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitStatements ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( declaration != null ) if( !declaration.accept( action ) ) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,10 +9,12 @@
|
||||||
* IBM Rational Software - Initial API and implementation */
|
* IBM Rational Software - Initial API and implementation */
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTInitializer;
|
import org.eclipse.cdt.core.dom.ast.IASTInitializer;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTPointerOperator;
|
import org.eclipse.cdt.core.dom.ast.IASTPointerOperator;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
|
@ -110,4 +112,32 @@ public class CASTDeclarator extends CASTNode implements IASTDeclarator {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitDeclarators ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( getPropertyInParent() != IASTTypeId.ABSTRACT_DECLARATOR &&
|
||||||
|
nestedDeclarator == null )
|
||||||
|
{
|
||||||
|
if( name != null ) if( !name.accept( action ) ) return false;
|
||||||
|
}
|
||||||
|
if( nestedDeclarator != null ) if( !nestedDeclarator.accept( action ) ) return false;
|
||||||
|
|
||||||
|
IASTPointerOperator [] ptrOps = getPointerOperators();
|
||||||
|
for ( int i = 0; i < ptrOps.length; i++ ) {
|
||||||
|
if( !ptrOps[i].accept( action ) ) return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return postAccept( action );
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean postAccept( ASTVisitor action ){
|
||||||
|
if( initializer != null ) if( !initializer.accept( action ) ) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
* IBM Rational Software - Initial API and implementation */
|
* IBM Rational Software - Initial API and implementation */
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTDefaultStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTDefaultStatement;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -17,4 +18,14 @@ import org.eclipse.cdt.core.dom.ast.IASTDefaultStatement;
|
||||||
public class CASTDefaultStatement extends CASTNode implements
|
public class CASTDefaultStatement extends CASTNode implements
|
||||||
IASTDefaultStatement {
|
IASTDefaultStatement {
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitStatements ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTInitializer;
|
import org.eclipse.cdt.core.dom.ast.IASTInitializer;
|
||||||
import org.eclipse.cdt.core.dom.ast.c.ICASTDesignatedInitializer;
|
import org.eclipse.cdt.core.dom.ast.c.ICASTDesignatedInitializer;
|
||||||
import org.eclipse.cdt.core.dom.ast.c.ICASTDesignator;
|
import org.eclipse.cdt.core.dom.ast.c.ICASTDesignator;
|
||||||
|
@ -81,4 +82,20 @@ public class CASTDesignatedInitializer extends CASTNode implements
|
||||||
this.rhs = rhs;
|
this.rhs = rhs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitInitializers ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ICASTDesignator [] ds = getDesignators();
|
||||||
|
for ( int i = 0; i < ds.length; i++ ) {
|
||||||
|
if( !ds[i].accept( action ) ) return false;
|
||||||
|
}
|
||||||
|
if( rhs != null ) if( !rhs.accept( action ) ) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
* IBM Rational Software - Initial API and implementation */
|
* IBM Rational Software - Initial API and implementation */
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTDoStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTDoStatement;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTStatement;
|
||||||
|
@ -49,4 +50,16 @@ public class CASTDoStatement extends CASTNode implements IASTDoStatement {
|
||||||
this.condition = condition;
|
this.condition = condition;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitStatements ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( body != null ) if( !body.accept( action ) ) return false;
|
||||||
|
if( condition != null ) if( !condition.accept( action ) ) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
* IBM Rational Software - Initial API and implementation */
|
* IBM Rational Software - Initial API and implementation */
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.c.ICASTElaboratedTypeSpecifier;
|
import org.eclipse.cdt.core.dom.ast.c.ICASTElaboratedTypeSpecifier;
|
||||||
|
|
||||||
|
@ -49,4 +50,15 @@ public class CASTElaboratedTypeSpecifier extends CASTBaseDeclSpecifier implement
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitDeclSpecifiers ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( name != null ) if( !name.accept( action ) ) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
* IBM Rational Software - Initial API and implementation */
|
* IBM Rational Software - Initial API and implementation */
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.c.ICASTEnumerationSpecifier;
|
import org.eclipse.cdt.core.dom.ast.c.ICASTEnumerationSpecifier;
|
||||||
|
|
||||||
|
@ -87,4 +88,20 @@ public class CASTEnumerationSpecifier extends CASTBaseDeclSpecifier implements
|
||||||
return getName().toString() == null ? "" : getName().toString(); //$NON-NLS-1$
|
return getName().toString() == null ? "" : getName().toString(); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitDeclSpecifiers ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( name != null ) if( !name.accept( action ) ) return false;
|
||||||
|
IASTEnumerator[] etors = getEnumerators();
|
||||||
|
for ( int i = 0; i < etors.length; i++ ) {
|
||||||
|
if( !etors[i].accept( action ) ) return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
* IBM Rational Software - Initial API and implementation */
|
* IBM Rational Software - Initial API and implementation */
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator;
|
import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator;
|
||||||
|
@ -49,4 +50,17 @@ public class CASTEnumerator extends CASTNode implements IASTEnumerator {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitEnumerators ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( name != null ) if( !name.accept( action ) ) return false;
|
||||||
|
if( value != null ) if( !value.accept( action ) ) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
* IBM Rational Software - Initial API and implementation */
|
* IBM Rational Software - Initial API and implementation */
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTExpressionList;
|
import org.eclipse.cdt.core.dom.ast.IASTExpressionList;
|
||||||
|
|
||||||
|
@ -66,4 +67,19 @@ public class CASTExpressionList extends CASTNode implements IASTExpressionList {
|
||||||
private IASTExpression [] expressions = null;
|
private IASTExpression [] expressions = null;
|
||||||
private static final int DEFAULT_EXPRESSIONLIST_SIZE = 4;
|
private static final int DEFAULT_EXPRESSIONLIST_SIZE = 4;
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitExpressions ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
IASTExpression [] exps = getExpressions();
|
||||||
|
for( int i = 0; i < exps.length; i++ )
|
||||||
|
if( !exps[i].accept( action ) ) return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
* IBM Rational Software - Initial API and implementation */
|
* IBM Rational Software - Initial API and implementation */
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTExpressionStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTExpressionStatement;
|
||||||
|
|
||||||
|
@ -34,4 +35,16 @@ public class CASTExpressionStatement extends CASTNode implements
|
||||||
this.expression = expression;
|
this.expression = expression;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitStatements ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( expression != null ) if( !expression.accept( action ) ) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,8 +9,10 @@
|
||||||
* IBM Rational Software - Initial API and implementation */
|
* IBM Rational Software - Initial API and implementation */
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTFieldDeclarator;
|
import org.eclipse.cdt.core.dom.ast.IASTFieldDeclarator;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTInitializer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
|
@ -34,5 +36,11 @@ public class CASTFieldDeclarator extends CASTDeclarator implements
|
||||||
bitFieldSize = size;
|
bitFieldSize = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected boolean postAccept( ASTVisitor action ){
|
||||||
|
if( bitFieldSize != null ) if( !bitFieldSize.accept( action ) ) return false;
|
||||||
|
|
||||||
|
IASTInitializer initializer = getInitializer();
|
||||||
|
if( initializer != null ) if( !initializer.accept( action ) ) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,9 @@
|
||||||
* IBM Rational Software - Initial API and implementation */
|
* IBM Rational Software - Initial API and implementation */
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.c.CASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.c.ICASTFieldDesignator;
|
import org.eclipse.cdt.core.dom.ast.c.ICASTFieldDesignator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -34,4 +36,15 @@ public class CASTFieldDesignator extends CASTNode implements
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action instanceof CASTVisitor && ((CASTVisitor)action).shouldVisitDesignators ){
|
||||||
|
switch( ((CASTVisitor)action).visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( name != null ) if( !name.accept( action ) ) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
* IBM Rational Software - Initial API and implementation */
|
* IBM Rational Software - Initial API and implementation */
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTFieldReference;
|
import org.eclipse.cdt.core.dom.ast.IASTFieldReference;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
|
@ -64,4 +65,17 @@ public class CASTFieldReference extends CASTNode implements IASTFieldReference {
|
||||||
ptr = value;
|
ptr = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitExpressions ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( owner != null ) if( !owner.accept( action ) ) return false;
|
||||||
|
if( name != null ) if( !name.accept( action ) ) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
* IBM Rational Software - Initial API and implementation */
|
* IBM Rational Software - Initial API and implementation */
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTForStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTForStatement;
|
||||||
|
@ -107,4 +108,20 @@ public class CASTForStatement extends CASTNode implements IASTForStatement {
|
||||||
return scope;
|
return scope;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitStatements ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( initDeclaration != null ) if( !initDeclaration.accept( action ) ) return false;
|
||||||
|
if( initialExpression != null ) if( !initialExpression.accept( action ) ) return false;
|
||||||
|
if( condition != null ) if( !condition.accept( action ) ) return false;
|
||||||
|
if( iterationExpression != null ) if( !iterationExpression.accept( action ) ) return false;
|
||||||
|
if( body != null ) if( !body.accept( action ) ) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
* IBM Rational Software - Initial API and implementation */
|
* IBM Rational Software - Initial API and implementation */
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTFunctionCallExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTFunctionCallExpression;
|
||||||
|
|
||||||
|
@ -49,4 +50,18 @@ public class CASTFunctionCallExpression extends CASTNode implements
|
||||||
return parameter;
|
return parameter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitExpressions ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( functionName != null ) if( !functionName.accept( action ) ) return false;
|
||||||
|
if( parameter != null ) if( !parameter.accept( action ) ) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,8 +9,9 @@
|
||||||
* IBM Rational Software - Initial API and implementation */
|
* IBM Rational Software - Initial API and implementation */
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTStandardFunctionDeclarator;
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration;
|
import org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTStandardFunctionDeclarator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
|
@ -84,4 +85,11 @@ public class CASTFunctionDeclarator extends CASTDeclarator implements
|
||||||
varArgs = value;
|
varArgs = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected boolean postAccept( ASTVisitor action ){
|
||||||
|
IASTParameterDeclaration [] params = getParameters();
|
||||||
|
for ( int i = 0; i < params.length; i++ ) {
|
||||||
|
if( !params[i].accept( action ) ) return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
* IBM Rational Software - Initial API and implementation */
|
* IBM Rational Software - Initial API and implementation */
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
|
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator;
|
import org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition;
|
import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition;
|
||||||
|
@ -78,4 +79,19 @@ public class CASTFunctionDefinition extends CASTNode implements
|
||||||
return scope;
|
return scope;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitDeclarations ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( declSpecifier != null ) if( !declSpecifier.accept( action ) ) return false;
|
||||||
|
if( declarator != null ) if( !declarator.accept( action ) ) return false;
|
||||||
|
if( bodyStatement != null ) if( !bodyStatement.accept( action ) ) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
* IBM Rational Software - Initial API and implementation */
|
* IBM Rational Software - Initial API and implementation */
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTGotoStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTGotoStatement;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
|
|
||||||
|
@ -33,4 +34,15 @@ public class CASTGotoStatement extends CASTNode implements IASTGotoStatement {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitStatements ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( name != null ) if( !name.accept( action ) ) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
* IBM Rational Software - Initial API and implementation */
|
* IBM Rational Software - Initial API and implementation */
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTIdExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTIdExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
|
|
||||||
|
@ -33,4 +34,16 @@ public class CASTIdExpression extends CASTNode implements IASTIdExpression {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitExpressions ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( name != null ) if( !name.accept( action ) ) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
* IBM Rational Software - Initial API and implementation */
|
* IBM Rational Software - Initial API and implementation */
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTIfStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTIfStatement;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTStatement;
|
||||||
|
@ -64,4 +65,17 @@ public class CASTIfStatement extends CASTNode implements IASTIfStatement {
|
||||||
this.elseClause = elseClause;
|
this.elseClause = elseClause;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitStatements ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( condition != null ) if( !condition.accept( action ) ) return false;
|
||||||
|
if( thenClause != null ) if( !thenClause.accept( action ) ) return false;
|
||||||
|
if( elseClause != null ) if( !elseClause.accept( action ) ) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
* IBM Rational Software - Initial API and implementation */
|
* IBM Rational Software - Initial API and implementation */
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTInitializerExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTInitializerExpression;
|
||||||
|
|
||||||
|
@ -34,4 +35,16 @@ public class CASTInitializerExpression extends CASTNode implements
|
||||||
this.expression = expression;
|
this.expression = expression;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitInitializers ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( expression != null ) if( !expression.accept( action ) ) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
* IBM Rational Software - Initial API and implementation */
|
* IBM Rational Software - Initial API and implementation */
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTInitializer;
|
import org.eclipse.cdt.core.dom.ast.IASTInitializer;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTInitializerList;
|
import org.eclipse.cdt.core.dom.ast.IASTInitializerList;
|
||||||
|
|
||||||
|
@ -69,4 +70,19 @@ public class CASTInitializerList extends CASTNode implements
|
||||||
private IASTInitializer [] initializers = null;
|
private IASTInitializer [] initializers = null;
|
||||||
private static final int DEFAULT_INITIALIZERS_LIST_SIZE = 4;
|
private static final int DEFAULT_INITIALIZERS_LIST_SIZE = 4;
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitInitializers ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
IASTInitializer [] list = getInitializers();
|
||||||
|
for ( int i = 0; i < list.length; i++ ) {
|
||||||
|
if( !list[i].accept( action ) ) return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.gnu.c.ICASTKnRFunctionDeclarator;
|
import org.eclipse.cdt.core.dom.ast.gnu.c.ICASTKnRFunctionDeclarator;
|
||||||
|
@ -52,4 +53,17 @@ public class CASTKnRFunctionDeclarator extends CASTDeclarator implements ICASTKn
|
||||||
return parameterDeclarations;
|
return parameterDeclarations;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected boolean postAccept( ASTVisitor action ){
|
||||||
|
IASTName [] ns = getParameterNames();
|
||||||
|
for ( int i = 0; i < ns.length; i++ ) {
|
||||||
|
if( !ns[i].accept( action ) ) return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
IASTDeclaration [] params = getParameterDeclarations();
|
||||||
|
for ( int i = 0; i < params.length; i++ ) {
|
||||||
|
if( !params[i].accept( action ) ) return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
* IBM Rational Software - Initial API and implementation */
|
* IBM Rational Software - Initial API and implementation */
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTLabelStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTLabelStatement;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
|
|
||||||
|
@ -33,4 +34,15 @@ public class CASTLabelStatement extends CASTNode implements IASTLabelStatement {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitStatements ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( name != null ) if( !name.accept( action ) ) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
* IBM Rational Software - Initial API and implementation */
|
* IBM Rational Software - Initial API and implementation */
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTLiteralExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTLiteralExpression;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -48,4 +49,14 @@ public class CASTLiteralExpression extends CASTNode implements
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitExpressions ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
* IBM Rational Software - Initial API and implementation */
|
* IBM Rational Software - Initial API and implementation */
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
|
|
||||||
|
@ -69,4 +70,16 @@ public class CASTName extends CASTNode implements IASTName {
|
||||||
public char[] toCharArray() {
|
public char[] toCharArray() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitNames ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
|
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
|
||||||
|
@ -62,4 +63,7 @@ public class CASTNode extends ASTNode implements IASTNode {
|
||||||
return (IASTTranslationUnit) node;
|
return (IASTTranslationUnit) node;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
* IBM Rational Software - Initial API and implementation */
|
* IBM Rational Software - Initial API and implementation */
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNullStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTNullStatement;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -16,4 +17,14 @@ import org.eclipse.cdt.core.dom.ast.IASTNullStatement;
|
||||||
*/
|
*/
|
||||||
public class CASTNullStatement extends CASTNode implements IASTNullStatement {
|
public class CASTNullStatement extends CASTNode implements IASTNullStatement {
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitStatements ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
* IBM Rational Software - Initial API and implementation */
|
* IBM Rational Software - Initial API and implementation */
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
|
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration;
|
import org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration;
|
||||||
|
@ -50,4 +51,17 @@ public class CASTParameterDeclaration extends CASTNode implements
|
||||||
this.declarator = declarator;
|
this.declarator = declarator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitParameterDeclarations ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( declSpec != null ) if( !declSpec.accept( action ) ) return false;
|
||||||
|
if( declarator != null ) if( !declarator.accept( action ) ) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTProblemDeclaration;
|
import org.eclipse.cdt.core.dom.ast.IASTProblemDeclaration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -18,4 +19,15 @@ import org.eclipse.cdt.core.dom.ast.IASTProblemDeclaration;
|
||||||
public class CASTProblemDeclaration extends CASTProblemOwner implements
|
public class CASTProblemDeclaration extends CASTProblemOwner implements
|
||||||
IASTProblemDeclaration {
|
IASTProblemDeclaration {
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitDeclarations ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTProblemExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTProblemExpression;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -18,4 +19,14 @@ import org.eclipse.cdt.core.dom.ast.IASTProblemExpression;
|
||||||
public class CASTProblemExpression extends CASTProblemOwner implements
|
public class CASTProblemExpression extends CASTProblemOwner implements
|
||||||
IASTProblemExpression {
|
IASTProblemExpression {
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitExpressions ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTProblemStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTProblemStatement;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -17,5 +18,14 @@ import org.eclipse.cdt.core.dom.ast.IASTProblemStatement;
|
||||||
*/
|
*/
|
||||||
public class CASTProblemStatement extends CASTProblemOwner implements
|
public class CASTProblemStatement extends CASTProblemOwner implements
|
||||||
IASTProblemStatement {
|
IASTProblemStatement {
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitStatements ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
* IBM Rational Software - Initial API and implementation */
|
* IBM Rational Software - Initial API and implementation */
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTReturnStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTReturnStatement;
|
||||||
|
|
||||||
|
@ -34,4 +35,15 @@ public class CASTReturnStatement extends CASTNode implements
|
||||||
retValue = returnValue;
|
retValue = returnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitStatements ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( retValue != null ) if( !retValue.accept( action ) ) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
* IBM Rational Software - Initial API and implementation */
|
* IBM Rational Software - Initial API and implementation */
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.c.ICASTSimpleDeclSpecifier;
|
import org.eclipse.cdt.core.dom.ast.c.ICASTSimpleDeclSpecifier;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -108,4 +109,15 @@ public class CASTSimpleDeclSpecifier extends CASTBaseDeclSpecifier implements IC
|
||||||
longlong = value;
|
longlong = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitDeclSpecifiers ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
* IBM Rational Software - Initial API and implementation */
|
* IBM Rational Software - Initial API and implementation */
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
|
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration;
|
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration;
|
||||||
|
@ -79,4 +80,21 @@ public class CASTSimpleDeclaration extends CASTNode implements
|
||||||
public void setDeclSpecifier(IASTDeclSpecifier declSpecifier) {
|
public void setDeclSpecifier(IASTDeclSpecifier declSpecifier) {
|
||||||
this.declSpecifier = declSpecifier;
|
this.declSpecifier = declSpecifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitDeclarations ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( declSpecifier != null ) if( !declSpecifier.accept( action ) ) return false;
|
||||||
|
IASTDeclarator [] dtors = getDeclarators();
|
||||||
|
for( int i = 0; i < dtors.length; i++ )
|
||||||
|
if( !dtors[i].accept( action ) ) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
* IBM Rational Software - Initial API and implementation */
|
* IBM Rational Software - Initial API and implementation */
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTStatement;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTSwitchStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTSwitchStatement;
|
||||||
|
@ -50,4 +51,16 @@ public class CASTSwitchStatement extends CASTNode implements
|
||||||
this.body = body;
|
this.body = body;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitStatements ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( controller != null ) if( !controller.accept( action ) ) return false;
|
||||||
|
if( body != null ) if( !body.accept( action ) ) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTArrayDeclarator;
|
import org.eclipse.cdt.core.dom.ast.IASTArrayDeclarator;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTArrayModifier;
|
import org.eclipse.cdt.core.dom.ast.IASTArrayModifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
|
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
|
||||||
|
@ -30,9 +31,9 @@ import org.eclipse.cdt.core.dom.ast.IASTProblem;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTStatement;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTVisitor;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.c.CASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.c.ICASTDesignator;
|
import org.eclipse.cdt.core.dom.ast.c.ICASTDesignator;
|
||||||
import org.eclipse.cdt.core.parser.ast.IASTEnumerator;
|
import org.eclipse.cdt.core.parser.ast.IASTEnumerator;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
|
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
|
||||||
|
@ -55,8 +56,6 @@ public class CASTTranslationUnit extends CASTNode implements
|
||||||
// Binding
|
// Binding
|
||||||
private CScope compilationUnit = null;
|
private CScope compilationUnit = null;
|
||||||
|
|
||||||
private CVisitor visitor = null;
|
|
||||||
|
|
||||||
private ILocationResolver resolver;
|
private ILocationResolver resolver;
|
||||||
|
|
||||||
private static final IASTPreprocessorStatement[] EMPTY_PREPROCESSOR_STATEMENT_ARRAY = new IASTPreprocessorStatement[0];
|
private static final IASTPreprocessorStatement[] EMPTY_PREPROCESSOR_STATEMENT_ARRAY = new IASTPreprocessorStatement[0];
|
||||||
|
@ -158,19 +157,19 @@ public class CASTTranslationUnit extends CASTNode implements
|
||||||
return resolver.getLocations(offset, length);
|
return resolver.getLocations(offset, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class CFindNodeForOffsetAction extends CVisitor.CBaseVisitorAction {
|
private class CFindNodeForOffsetAction extends CASTVisitor {
|
||||||
{
|
{
|
||||||
processNames = true;
|
shouldVisitNames = true;
|
||||||
processDeclarations = true;
|
shouldVisitDeclarations = true;
|
||||||
processInitializers = true;
|
shouldVisitInitializers = true;
|
||||||
processParameterDeclarations = true;
|
shouldVisitParameterDeclarations = true;
|
||||||
processDeclarators = true;
|
shouldVisitDeclarators = true;
|
||||||
processDeclSpecifiers = true;
|
shouldVisitDeclSpecifiers = true;
|
||||||
processDesignators = true;
|
shouldVisitDesignators = true;
|
||||||
processExpressions = true;
|
shouldVisitExpressions = true;
|
||||||
processStatements = true;
|
shouldVisitStatements = true;
|
||||||
processTypeIds = true;
|
shouldVisitTypeIds = true;
|
||||||
processEnumerators = true;
|
shouldVisitEnumerators = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
IASTNode foundNode = null;
|
IASTNode foundNode = null;
|
||||||
|
@ -213,7 +212,7 @@ public class CASTTranslationUnit extends CASTNode implements
|
||||||
*
|
*
|
||||||
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.CPPVisitor.CPPBaseVisitorAction#processDeclaration(org.eclipse.cdt.core.dom.ast.IASTDeclaration)
|
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.CPPVisitor.CPPBaseVisitorAction#processDeclaration(org.eclipse.cdt.core.dom.ast.IASTDeclaration)
|
||||||
*/
|
*/
|
||||||
public int processDeclaration(IASTDeclaration declaration) {
|
public int visit(IASTDeclaration declaration) {
|
||||||
// use declarations to determine if the search has gone past the
|
// use declarations to determine if the search has gone past the
|
||||||
// offset (i.e. don't know the order the visitor visits the nodes)
|
// offset (i.e. don't know the order the visitor visits the nodes)
|
||||||
if (declaration instanceof ASTNode
|
if (declaration instanceof ASTNode
|
||||||
|
@ -228,7 +227,7 @@ public class CASTTranslationUnit extends CASTNode implements
|
||||||
*
|
*
|
||||||
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.CPPVisitor.CPPBaseVisitorAction#processDeclarator(org.eclipse.cdt.core.dom.ast.IASTDeclarator)
|
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.CPPVisitor.CPPBaseVisitorAction#processDeclarator(org.eclipse.cdt.core.dom.ast.IASTDeclarator)
|
||||||
*/
|
*/
|
||||||
public int processDeclarator(IASTDeclarator declarator) {
|
public int visit(IASTDeclarator declarator) {
|
||||||
int ret = processNode(declarator);
|
int ret = processNode(declarator);
|
||||||
|
|
||||||
IASTPointerOperator[] ops = declarator.getPointerOperators();
|
IASTPointerOperator[] ops = declarator.getPointerOperators();
|
||||||
|
@ -250,7 +249,7 @@ public class CASTTranslationUnit extends CASTNode implements
|
||||||
*
|
*
|
||||||
* @see org.eclipse.cdt.internal.core.dom.parser.c.CVisitor.CBaseVisitorAction#processDesignator(org.eclipse.cdt.core.dom.ast.c.ICASTDesignator)
|
* @see org.eclipse.cdt.internal.core.dom.parser.c.CVisitor.CBaseVisitorAction#processDesignator(org.eclipse.cdt.core.dom.ast.c.ICASTDesignator)
|
||||||
*/
|
*/
|
||||||
public int processDesignator(ICASTDesignator designator) {
|
public int visit(ICASTDesignator designator) {
|
||||||
return processNode(designator);
|
return processNode(designator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -259,7 +258,7 @@ public class CASTTranslationUnit extends CASTNode implements
|
||||||
*
|
*
|
||||||
* @see org.eclipse.cdt.internal.core.dom.parser.c.CVisitor.CBaseVisitorAction#processDeclSpecifier(org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier)
|
* @see org.eclipse.cdt.internal.core.dom.parser.c.CVisitor.CBaseVisitorAction#processDeclSpecifier(org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier)
|
||||||
*/
|
*/
|
||||||
public int processDeclSpecifier(IASTDeclSpecifier declSpec) {
|
public int visit(IASTDeclSpecifier declSpec) {
|
||||||
return processNode(declSpec);
|
return processNode(declSpec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -268,7 +267,7 @@ public class CASTTranslationUnit extends CASTNode implements
|
||||||
*
|
*
|
||||||
* @see org.eclipse.cdt.internal.core.dom.parser.c.CVisitor.CBaseVisitorAction#processEnumerator(org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator)
|
* @see org.eclipse.cdt.internal.core.dom.parser.c.CVisitor.CBaseVisitorAction#processEnumerator(org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator)
|
||||||
*/
|
*/
|
||||||
public int processEnumerator(IASTEnumerator enumerator) {
|
public int visit(IASTEnumerator enumerator) {
|
||||||
return processNode((IASTNode) enumerator);
|
return processNode((IASTNode) enumerator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -277,7 +276,7 @@ public class CASTTranslationUnit extends CASTNode implements
|
||||||
*
|
*
|
||||||
* @see org.eclipse.cdt.internal.core.dom.parser.c.CVisitor.CBaseVisitorAction#processExpression(org.eclipse.cdt.core.dom.ast.IASTExpression)
|
* @see org.eclipse.cdt.internal.core.dom.parser.c.CVisitor.CBaseVisitorAction#processExpression(org.eclipse.cdt.core.dom.ast.IASTExpression)
|
||||||
*/
|
*/
|
||||||
public int processExpression(IASTExpression expression) {
|
public int visit(IASTExpression expression) {
|
||||||
return processNode(expression);
|
return processNode(expression);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -286,7 +285,7 @@ public class CASTTranslationUnit extends CASTNode implements
|
||||||
*
|
*
|
||||||
* @see org.eclipse.cdt.internal.core.dom.parser.c.CVisitor.CBaseVisitorAction#processInitializer(org.eclipse.cdt.core.dom.ast.IASTInitializer)
|
* @see org.eclipse.cdt.internal.core.dom.parser.c.CVisitor.CBaseVisitorAction#processInitializer(org.eclipse.cdt.core.dom.ast.IASTInitializer)
|
||||||
*/
|
*/
|
||||||
public int processInitializer(IASTInitializer initializer) {
|
public int visit(IASTInitializer initializer) {
|
||||||
return processNode(initializer);
|
return processNode(initializer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -295,7 +294,7 @@ public class CASTTranslationUnit extends CASTNode implements
|
||||||
*
|
*
|
||||||
* @see org.eclipse.cdt.internal.core.dom.parser.c.CVisitor.CBaseVisitorAction#processName(org.eclipse.cdt.core.dom.ast.IASTName)
|
* @see org.eclipse.cdt.internal.core.dom.parser.c.CVisitor.CBaseVisitorAction#processName(org.eclipse.cdt.core.dom.ast.IASTName)
|
||||||
*/
|
*/
|
||||||
public int processName(IASTName name) {
|
public int visit(IASTName name) {
|
||||||
if (name.toString() != null)
|
if (name.toString() != null)
|
||||||
return processNode(name);
|
return processNode(name);
|
||||||
return PROCESS_CONTINUE;
|
return PROCESS_CONTINUE;
|
||||||
|
@ -306,7 +305,7 @@ public class CASTTranslationUnit extends CASTNode implements
|
||||||
*
|
*
|
||||||
* @see org.eclipse.cdt.internal.core.dom.parser.c.CVisitor.CBaseVisitorAction#processParameterDeclaration(org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration)
|
* @see org.eclipse.cdt.internal.core.dom.parser.c.CVisitor.CBaseVisitorAction#processParameterDeclaration(org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration)
|
||||||
*/
|
*/
|
||||||
public int processParameterDeclaration(
|
public int visit(
|
||||||
IASTParameterDeclaration parameterDeclaration) {
|
IASTParameterDeclaration parameterDeclaration) {
|
||||||
return processNode(parameterDeclaration);
|
return processNode(parameterDeclaration);
|
||||||
}
|
}
|
||||||
|
@ -316,7 +315,7 @@ public class CASTTranslationUnit extends CASTNode implements
|
||||||
*
|
*
|
||||||
* @see org.eclipse.cdt.internal.core.dom.parser.c.CVisitor.CBaseVisitorAction#processStatement(org.eclipse.cdt.core.dom.ast.IASTStatement)
|
* @see org.eclipse.cdt.internal.core.dom.parser.c.CVisitor.CBaseVisitorAction#processStatement(org.eclipse.cdt.core.dom.ast.IASTStatement)
|
||||||
*/
|
*/
|
||||||
public int processStatement(IASTStatement statement) {
|
public int visit(IASTStatement statement) {
|
||||||
return processNode(statement);
|
return processNode(statement);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -325,7 +324,7 @@ public class CASTTranslationUnit extends CASTNode implements
|
||||||
*
|
*
|
||||||
* @see org.eclipse.cdt.internal.core.dom.parser.c.CVisitor.CBaseVisitorAction#processTypeId(org.eclipse.cdt.core.dom.ast.IASTTypeId)
|
* @see org.eclipse.cdt.internal.core.dom.parser.c.CVisitor.CBaseVisitorAction#processTypeId(org.eclipse.cdt.core.dom.ast.IASTTypeId)
|
||||||
*/
|
*/
|
||||||
public int processTypeId(IASTTypeId typeId) {
|
public int visit(IASTTypeId typeId) {
|
||||||
return processNode(typeId);
|
return processNode(typeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -358,7 +357,7 @@ public class CASTTranslationUnit extends CASTNode implements
|
||||||
globalOffset = result == null ? globalOffset : result.getGlobalOffset();
|
globalOffset = result == null ? globalOffset : result.getGlobalOffset();
|
||||||
if (globalOffset >= 0) {
|
if (globalOffset >= 0) {
|
||||||
CFindNodeForOffsetAction nodeFinder = new CFindNodeForOffsetAction(globalOffset, realLength);
|
CFindNodeForOffsetAction nodeFinder = new CFindNodeForOffsetAction(globalOffset, realLength);
|
||||||
getVisitor().visitTranslationUnit(nodeFinder);
|
accept(nodeFinder);
|
||||||
node = nodeFinder.getNode();
|
node = nodeFinder.getNode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -471,17 +470,6 @@ public class CASTTranslationUnit extends CASTNode implements
|
||||||
return new String(resolver.getUnpreprocessedSignature(locations));
|
return new String(resolver.getUnpreprocessedSignature(locations));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IASTTranslationUnit#getVisitor()
|
|
||||||
*/
|
|
||||||
public IASTVisitor getVisitor() {
|
|
||||||
if (visitor == null)
|
|
||||||
visitor = new CVisitor(this);
|
|
||||||
return visitor;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
|
@ -492,4 +480,19 @@ public class CASTTranslationUnit extends CASTNode implements
|
||||||
return EMPTY_STRING;
|
return EMPTY_STRING;
|
||||||
return new String(resolver.getTranslationUnitPath());
|
return new String(resolver.getTranslationUnitPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitTranslationUnit){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
IASTDeclaration [] ds = getDeclarations();
|
||||||
|
for( int i = 0; i < ds.length; i++ ){
|
||||||
|
if( !ds[i].accept( action ) ) return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
* IBM Rational Software - Initial API and implementation */
|
* IBM Rational Software - Initial API and implementation */
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
|
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
||||||
|
@ -50,4 +51,17 @@ public class CASTTypeId extends CASTNode implements IASTTypeId {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitTypeIds ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( declSpecifier != null ) if( !declSpecifier.accept( action ) ) return false;
|
||||||
|
if( declarator != null ) if( !declarator.accept( action ) ) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
* IBM Rational Software - Initial API and implementation */
|
* IBM Rational Software - Initial API and implementation */
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTypeIdExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTTypeIdExpression;
|
||||||
|
|
||||||
|
@ -49,4 +50,16 @@ public class CASTTypeIdExpression extends CASTNode implements
|
||||||
return typeId;
|
return typeId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitExpressions ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( typeId != null ) if( !typeId.accept( action ) ) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
* IBM Rational Software - Initial API and implementation */
|
* IBM Rational Software - Initial API and implementation */
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTInitializer;
|
import org.eclipse.cdt.core.dom.ast.IASTInitializer;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
||||||
import org.eclipse.cdt.core.dom.ast.c.ICASTTypeIdInitializerExpression;
|
import org.eclipse.cdt.core.dom.ast.c.ICASTTypeIdInitializerExpression;
|
||||||
|
@ -50,4 +51,17 @@ public class CASTTypeIdInitializerExpression extends CASTNode implements
|
||||||
i = initializer;
|
i = initializer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitExpressions ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( t != null ) if( !t.accept( action ) ) return false;
|
||||||
|
if( i != null ) if( !i.accept( action ) ) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
* IBM Rational Software - Initial API and implementation */
|
* IBM Rational Software - Initial API and implementation */
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.c.ICASTTypedefNameSpecifier;
|
import org.eclipse.cdt.core.dom.ast.c.ICASTTypedefNameSpecifier;
|
||||||
|
|
||||||
|
@ -33,4 +34,16 @@ public class CASTTypedefNameSpecifier extends CASTBaseDeclSpecifier implements
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitDeclSpecifiers ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( name != null ) if( !name.accept( action ) ) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
* IBM Rational Software - Initial API and implementation */
|
* IBM Rational Software - Initial API and implementation */
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression;
|
||||||
|
|
||||||
|
@ -49,4 +50,16 @@ public class CASTUnaryExpression extends CASTNode implements
|
||||||
operand = expression;
|
operand = expression;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitExpressions ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( operand != null ) if( !operand.accept( action ) ) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
* IBM Rational Software - Initial API and implementation */
|
* IBM Rational Software - Initial API and implementation */
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTStatement;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTWhileStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTWhileStatement;
|
||||||
|
@ -49,4 +50,17 @@ public class CASTWhileStatement extends CASTNode implements IASTWhileStatement {
|
||||||
this.body = body;
|
this.body = body;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitStatements ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( condition != null ) if( !condition.accept( action ) ) return false;
|
||||||
|
if( body != null ) if( !body.accept( action ) ) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,8 +17,6 @@ package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTVisitor;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
import org.eclipse.cdt.core.dom.ast.c.ICASTCompositeTypeSpecifier;
|
import org.eclipse.cdt.core.dom.ast.c.ICASTCompositeTypeSpecifier;
|
||||||
|
@ -74,12 +72,8 @@ public class CCompositeTypeScope implements ICCompositeTypeScope {
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IScope#find(java.lang.String)
|
* @see org.eclipse.cdt.core.dom.ast.IScope#find(java.lang.String)
|
||||||
*/
|
*/
|
||||||
public IBinding[] find( String name ) {
|
public IBinding[] find( String name ) {
|
||||||
IASTNode node = getPhysicalNode();
|
|
||||||
IASTTranslationUnit tu = node.getTranslationUnit();
|
|
||||||
IASTVisitor visitor = tu.getVisitor();
|
|
||||||
|
|
||||||
CollectNamesAction action = new CollectNamesAction( name.toCharArray() );
|
CollectNamesAction action = new CollectNamesAction( name.toCharArray() );
|
||||||
visitor.visitDeclSpecifier( compositeTypeSpec, action );
|
compositeTypeSpec.accept( action );
|
||||||
|
|
||||||
IASTName [] names = action.getNames();
|
IASTName [] names = action.getNames();
|
||||||
IBinding [] result = null;
|
IBinding [] result = null;
|
||||||
|
|
|
@ -19,9 +19,9 @@ import org.eclipse.cdt.core.dom.ast.IASTStatement;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.ILabel;
|
import org.eclipse.cdt.core.dom.ast.ILabel;
|
||||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.c.CASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.c.ICFunctionScope;
|
import org.eclipse.cdt.core.dom.ast.c.ICFunctionScope;
|
||||||
import org.eclipse.cdt.core.dom.ast.c.ICScope;
|
import org.eclipse.cdt.core.dom.ast.c.ICScope;
|
||||||
import org.eclipse.cdt.core.dom.ast.c.ICASTVisitor.CBaseVisitorAction;
|
|
||||||
import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
||||||
import org.eclipse.cdt.core.parser.util.CharArrayObjectMap;
|
import org.eclipse.cdt.core.parser.util.CharArrayObjectMap;
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ public class CFunctionScope implements ICFunctionScope {
|
||||||
public ILabel[] getLabels(){
|
public ILabel[] getLabels(){
|
||||||
FindLabelsAction action = new FindLabelsAction();
|
FindLabelsAction action = new FindLabelsAction();
|
||||||
|
|
||||||
function.getTranslationUnit().getVisitor().visitDeclaration( function, action );
|
function.accept( action );
|
||||||
|
|
||||||
ILabel [] result = null;
|
ILabel [] result = null;
|
||||||
if( action.labels != null ){
|
if( action.labels != null ){
|
||||||
|
@ -100,14 +100,14 @@ public class CFunctionScope implements ICFunctionScope {
|
||||||
return (ILabel[]) ArrayUtil.trim( ILabel.class, result );
|
return (ILabel[]) ArrayUtil.trim( ILabel.class, result );
|
||||||
}
|
}
|
||||||
|
|
||||||
static private class FindLabelsAction extends CBaseVisitorAction {
|
static private class FindLabelsAction extends CASTVisitor {
|
||||||
public IASTLabelStatement [] labels = null;
|
public IASTLabelStatement [] labels = null;
|
||||||
|
|
||||||
public FindLabelsAction(){
|
public FindLabelsAction(){
|
||||||
processStatements = true;
|
shouldVisitStatements = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int processStatement( IASTStatement statement ) {
|
public int visit( IASTStatement statement ) {
|
||||||
if( statement instanceof IASTLabelStatement ){
|
if( statement instanceof IASTLabelStatement ){
|
||||||
labels = (IASTLabelStatement[]) ArrayUtil.append( IASTLabelStatement.class, labels, statement );
|
labels = (IASTLabelStatement[]) ArrayUtil.append( IASTLabelStatement.class, labels, statement );
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,13 +23,11 @@ import org.eclipse.cdt.core.dom.ast.IASTElaboratedTypeSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTStatement;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTVisitor;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.ICompositeType;
|
import org.eclipse.cdt.core.dom.ast.ICompositeType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IEnumeration;
|
import org.eclipse.cdt.core.dom.ast.IEnumeration;
|
||||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
import org.eclipse.cdt.core.dom.ast.c.ICASTVisitor;
|
import org.eclipse.cdt.core.dom.ast.c.CASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.c.ICScope;
|
import org.eclipse.cdt.core.dom.ast.c.ICScope;
|
||||||
import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
||||||
import org.eclipse.cdt.core.parser.util.CharArrayObjectMap;
|
import org.eclipse.cdt.core.parser.util.CharArrayObjectMap;
|
||||||
|
@ -54,14 +52,14 @@ public class CScope implements ICScope {
|
||||||
return CVisitor.getContainingScope( physicalNode );
|
return CVisitor.getContainingScope( physicalNode );
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static class CollectNamesAction extends ICASTVisitor.CBaseVisitorAction {
|
protected static class CollectNamesAction extends CASTVisitor {
|
||||||
private char [] name;
|
private char [] name;
|
||||||
private IASTName [] result = null;
|
private IASTName [] result = null;
|
||||||
CollectNamesAction( char [] n ){
|
CollectNamesAction( char [] n ){
|
||||||
name = n;
|
name = n;
|
||||||
processNames = true;
|
shouldVisitNames = true;
|
||||||
}
|
}
|
||||||
public int processName( IASTName n ){
|
public int visit( IASTName n ){
|
||||||
ASTNodeProperty prop = n.getPropertyInParent();
|
ASTNodeProperty prop = n.getPropertyInParent();
|
||||||
if( prop == IASTElaboratedTypeSpecifier.TYPE_NAME ||
|
if( prop == IASTElaboratedTypeSpecifier.TYPE_NAME ||
|
||||||
prop == IASTCompositeTypeSpecifier.TYPE_NAME ||
|
prop == IASTCompositeTypeSpecifier.TYPE_NAME ||
|
||||||
|
@ -73,7 +71,7 @@ public class CScope implements ICScope {
|
||||||
|
|
||||||
return PROCESS_CONTINUE;
|
return PROCESS_CONTINUE;
|
||||||
}
|
}
|
||||||
public int processStatement( IASTStatement statement ){
|
public int visit( IASTStatement statement ){
|
||||||
if( statement instanceof IASTDeclarationStatement )
|
if( statement instanceof IASTDeclarationStatement )
|
||||||
return PROCESS_CONTINUE;
|
return PROCESS_CONTINUE;
|
||||||
return PROCESS_SKIP;
|
return PROCESS_SKIP;
|
||||||
|
@ -87,14 +85,8 @@ public class CScope implements ICScope {
|
||||||
*/
|
*/
|
||||||
public IBinding[] find( String name ) {
|
public IBinding[] find( String name ) {
|
||||||
IASTNode node = getPhysicalNode();
|
IASTNode node = getPhysicalNode();
|
||||||
IASTTranslationUnit tu = node.getTranslationUnit();
|
|
||||||
IASTVisitor visitor = tu.getVisitor();
|
|
||||||
|
|
||||||
CollectNamesAction action = new CollectNamesAction( name.toCharArray() );
|
CollectNamesAction action = new CollectNamesAction( name.toCharArray() );
|
||||||
if( node instanceof IASTTranslationUnit )
|
node.accept( action );
|
||||||
visitor.visitTranslationUnit( action );
|
|
||||||
else if( node instanceof IASTStatement )
|
|
||||||
visitor.visitStatement( (IASTStatement) node, action );
|
|
||||||
|
|
||||||
IASTName [] names = action.getNames();
|
IASTName [] names = action.getNames();
|
||||||
IBinding [] result = null;
|
IBinding [] result = null;
|
||||||
|
|
|
@ -16,23 +16,16 @@ import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTArrayDeclarator;
|
import org.eclipse.cdt.core.dom.ast.IASTArrayDeclarator;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTArrayModifier;
|
import org.eclipse.cdt.core.dom.ast.IASTArrayModifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTArraySubscriptExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTArraySubscriptExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTBinaryExpression;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTCaseStatement;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTCastExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTCastExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier;
|
import org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTConditionalExpression;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
|
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTDeclarationStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTDeclarationStatement;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTDoStatement;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTElaboratedTypeSpecifier;
|
import org.eclipse.cdt.core.dom.ast.IASTElaboratedTypeSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier;
|
import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTExpressionList;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTExpressionStatement;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTFieldDeclarator;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTFieldReference;
|
import org.eclipse.cdt.core.dom.ast.IASTFieldReference;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTForStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTForStatement;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTFunctionCallExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTFunctionCallExpression;
|
||||||
|
@ -40,10 +33,6 @@ import org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition;
|
import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTGotoStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTGotoStatement;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTIdExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTIdExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTIfStatement;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTInitializer;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTInitializerExpression;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTInitializerList;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTLabelStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTLabelStatement;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNamedTypeSpecifier;
|
import org.eclipse.cdt.core.dom.ast.IASTNamedTypeSpecifier;
|
||||||
|
@ -52,16 +41,12 @@ import org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTPointerOperator;
|
import org.eclipse.cdt.core.dom.ast.IASTPointerOperator;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTProblem;
|
import org.eclipse.cdt.core.dom.ast.IASTProblem;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTProblemHolder;
|
import org.eclipse.cdt.core.dom.ast.IASTProblemHolder;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTReturnStatement;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration;
|
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTStandardFunctionDeclarator;
|
import org.eclipse.cdt.core.dom.ast.IASTStandardFunctionDeclarator;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTStatement;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTSwitchStatement;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTypeIdExpression;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTWhileStatement;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IArrayType;
|
import org.eclipse.cdt.core.dom.ast.IArrayType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.ICompositeType;
|
import org.eclipse.cdt.core.dom.ast.ICompositeType;
|
||||||
|
@ -77,26 +62,20 @@ import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
||||||
import org.eclipse.cdt.core.dom.ast.IVariable;
|
import org.eclipse.cdt.core.dom.ast.IVariable;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator;
|
import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator;
|
||||||
import org.eclipse.cdt.core.dom.ast.c.ICASTArrayDesignator;
|
import org.eclipse.cdt.core.dom.ast.c.CASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.c.ICASTArrayModifier;
|
import org.eclipse.cdt.core.dom.ast.c.ICASTArrayModifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.c.ICASTCompositeTypeSpecifier;
|
import org.eclipse.cdt.core.dom.ast.c.ICASTCompositeTypeSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.c.ICASTDeclSpecifier;
|
import org.eclipse.cdt.core.dom.ast.c.ICASTDeclSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.c.ICASTDesignatedInitializer;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.c.ICASTDesignator;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.c.ICASTElaboratedTypeSpecifier;
|
import org.eclipse.cdt.core.dom.ast.c.ICASTElaboratedTypeSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.c.ICASTEnumerationSpecifier;
|
import org.eclipse.cdt.core.dom.ast.c.ICASTEnumerationSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.c.ICASTFieldDesignator;
|
import org.eclipse.cdt.core.dom.ast.c.ICASTFieldDesignator;
|
||||||
import org.eclipse.cdt.core.dom.ast.c.ICASTPointer;
|
import org.eclipse.cdt.core.dom.ast.c.ICASTPointer;
|
||||||
import org.eclipse.cdt.core.dom.ast.c.ICASTSimpleDeclSpecifier;
|
import org.eclipse.cdt.core.dom.ast.c.ICASTSimpleDeclSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.c.ICASTTypeIdInitializerExpression;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.c.ICASTTypedefNameSpecifier;
|
import org.eclipse.cdt.core.dom.ast.c.ICASTTypedefNameSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.c.ICASTVisitor;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.c.ICCompositeTypeScope;
|
import org.eclipse.cdt.core.dom.ast.c.ICCompositeTypeScope;
|
||||||
import org.eclipse.cdt.core.dom.ast.c.ICFunctionScope;
|
import org.eclipse.cdt.core.dom.ast.c.ICFunctionScope;
|
||||||
import org.eclipse.cdt.core.dom.ast.c.ICScope;
|
import org.eclipse.cdt.core.dom.ast.c.ICScope;
|
||||||
import org.eclipse.cdt.core.dom.ast.gnu.IGNUASTCompoundStatementExpression;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.gnu.c.ICASTKnRFunctionDeclarator;
|
import org.eclipse.cdt.core.dom.ast.gnu.c.ICASTKnRFunctionDeclarator;
|
||||||
import org.eclipse.cdt.core.dom.ast.gnu.c.IGCCASTArrayRangeDesignator;
|
|
||||||
import org.eclipse.cdt.core.parser.util.CharArrayUtils;
|
import org.eclipse.cdt.core.parser.util.CharArrayUtils;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
|
import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.ProblemBinding;
|
import org.eclipse.cdt.internal.core.dom.parser.ProblemBinding;
|
||||||
|
@ -106,12 +85,12 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPFunctionType;
|
||||||
* Created on Nov 5, 2004
|
* Created on Nov 5, 2004
|
||||||
* @author aniefer
|
* @author aniefer
|
||||||
*/
|
*/
|
||||||
public class CVisitor implements ICASTVisitor {
|
public class CVisitor {
|
||||||
public static class ClearBindingAction extends CBaseVisitorAction {
|
public static class ClearBindingAction extends CASTVisitor {
|
||||||
{
|
{
|
||||||
processNames = true;
|
shouldVisitNames = true;
|
||||||
}
|
}
|
||||||
public int processName(IASTName name) {
|
public int visit(IASTName name) {
|
||||||
if ( ((CASTName)name).hasBinding() ) {
|
if ( ((CASTName)name).hasBinding() ) {
|
||||||
ICScope scope;
|
ICScope scope;
|
||||||
try {
|
try {
|
||||||
|
@ -127,12 +106,12 @@ public class CVisitor implements ICASTVisitor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class CollectProblemsAction extends CBaseVisitorAction {
|
public static class CollectProblemsAction extends CASTVisitor {
|
||||||
{
|
{
|
||||||
processDeclarations = true;
|
shouldVisitDeclarations = true;
|
||||||
processExpressions = true;
|
shouldVisitExpressions = true;
|
||||||
processStatements = true;
|
shouldVisitStatements = true;
|
||||||
processTypeIds = true;
|
shouldVisitTypeIds = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final int DEFAULT_CHILDREN_LIST_SIZE = 8;
|
private static final int DEFAULT_CHILDREN_LIST_SIZE = 8;
|
||||||
|
@ -175,7 +154,7 @@ public class CVisitor implements ICASTVisitor {
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.internal.core.dom.parser.c.CVisitor.CBaseVisitorAction#processDeclaration(org.eclipse.cdt.core.dom.ast.IASTDeclaration)
|
* @see org.eclipse.cdt.internal.core.dom.parser.c.CVisitor.CBaseVisitorAction#processDeclaration(org.eclipse.cdt.core.dom.ast.IASTDeclaration)
|
||||||
*/
|
*/
|
||||||
public int processDeclaration(IASTDeclaration declaration) {
|
public int visit(IASTDeclaration declaration) {
|
||||||
if ( declaration instanceof IASTProblemHolder )
|
if ( declaration instanceof IASTProblemHolder )
|
||||||
addProblem(((IASTProblemHolder)declaration).getProblem());
|
addProblem(((IASTProblemHolder)declaration).getProblem());
|
||||||
|
|
||||||
|
@ -185,7 +164,7 @@ public class CVisitor implements ICASTVisitor {
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.internal.core.dom.parser.c.CVisitor.CBaseVisitorAction#processExpression(org.eclipse.cdt.core.dom.ast.IASTExpression)
|
* @see org.eclipse.cdt.internal.core.dom.parser.c.CVisitor.CBaseVisitorAction#processExpression(org.eclipse.cdt.core.dom.ast.IASTExpression)
|
||||||
*/
|
*/
|
||||||
public int processExpression(IASTExpression expression) {
|
public int visit(IASTExpression expression) {
|
||||||
if ( expression instanceof IASTProblemHolder )
|
if ( expression instanceof IASTProblemHolder )
|
||||||
addProblem(((IASTProblemHolder)expression).getProblem());
|
addProblem(((IASTProblemHolder)expression).getProblem());
|
||||||
|
|
||||||
|
@ -195,7 +174,7 @@ public class CVisitor implements ICASTVisitor {
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.internal.core.dom.parser.c.CVisitor.CBaseVisitorAction#processStatement(org.eclipse.cdt.core.dom.ast.IASTStatement)
|
* @see org.eclipse.cdt.internal.core.dom.parser.c.CVisitor.CBaseVisitorAction#processStatement(org.eclipse.cdt.core.dom.ast.IASTStatement)
|
||||||
*/
|
*/
|
||||||
public int processStatement(IASTStatement statement) {
|
public int visit(IASTStatement statement) {
|
||||||
if ( statement instanceof IASTProblemHolder )
|
if ( statement instanceof IASTProblemHolder )
|
||||||
addProblem(((IASTProblemHolder)statement).getProblem());
|
addProblem(((IASTProblemHolder)statement).getProblem());
|
||||||
|
|
||||||
|
@ -205,7 +184,7 @@ public class CVisitor implements ICASTVisitor {
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.internal.core.dom.parser.c.CVisitor.CBaseVisitorAction#processTypeId(org.eclipse.cdt.core.dom.ast.IASTTypeId)
|
* @see org.eclipse.cdt.internal.core.dom.parser.c.CVisitor.CBaseVisitorAction#processTypeId(org.eclipse.cdt.core.dom.ast.IASTTypeId)
|
||||||
*/
|
*/
|
||||||
public int processTypeId(IASTTypeId typeId) {
|
public int visit(IASTTypeId typeId) {
|
||||||
if ( typeId instanceof IASTProblemHolder )
|
if ( typeId instanceof IASTProblemHolder )
|
||||||
addProblem(((IASTProblemHolder)typeId).getProblem());
|
addProblem(((IASTProblemHolder)typeId).getProblem());
|
||||||
|
|
||||||
|
@ -213,12 +192,12 @@ public class CVisitor implements ICASTVisitor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class CollectDeclarationsAction extends CBaseVisitorAction {
|
public static class CollectDeclarationsAction extends CASTVisitor {
|
||||||
{
|
{
|
||||||
processDeclarators = true;
|
shouldVisitDeclarators = true;
|
||||||
processDeclSpecifiers = true;
|
shouldVisitDeclSpecifiers = true;
|
||||||
processEnumerators = true;
|
shouldVisitEnumerators = true;
|
||||||
processStatements = true;
|
shouldVisitStatements = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final int DEFAULT_CHILDREN_LIST_SIZE = 8;
|
private static final int DEFAULT_CHILDREN_LIST_SIZE = 8;
|
||||||
|
@ -264,7 +243,7 @@ public class CVisitor implements ICASTVisitor {
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.internal.core.dom.parser.c.CVisitor.CBaseVisitorAction#processDeclarator(org.eclipse.cdt.core.dom.ast.IASTDeclarator)
|
* @see org.eclipse.cdt.internal.core.dom.parser.c.CVisitor.CBaseVisitorAction#processDeclarator(org.eclipse.cdt.core.dom.ast.IASTDeclarator)
|
||||||
*/
|
*/
|
||||||
public int processDeclarator(IASTDeclarator declarator) {
|
public int visit(IASTDeclarator declarator) {
|
||||||
//GCC allows declarations in expressions, so we have to continue from the
|
//GCC allows declarations in expressions, so we have to continue from the
|
||||||
//declarator in case there is something in the initializer expression
|
//declarator in case there is something in the initializer expression
|
||||||
if ( declarator == null || declarator.getName() == null || declarator.getName().toCharArray().length == 0 ) return PROCESS_CONTINUE;
|
if ( declarator == null || declarator.getName() == null || declarator.getName().toCharArray().length == 0 ) return PROCESS_CONTINUE;
|
||||||
|
@ -303,7 +282,7 @@ public class CVisitor implements ICASTVisitor {
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.internal.core.dom.parser.c.CVisitor.CBaseVisitorAction#processDeclSpecifier(org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier)
|
* @see org.eclipse.cdt.internal.core.dom.parser.c.CVisitor.CBaseVisitorAction#processDeclSpecifier(org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier)
|
||||||
*/
|
*/
|
||||||
public int processDeclSpecifier(IASTDeclSpecifier declSpec) {
|
public int visit(IASTDeclSpecifier declSpec) {
|
||||||
if ( compositeTypeDeclared && declSpec instanceof ICASTTypedefNameSpecifier )
|
if ( compositeTypeDeclared && declSpec instanceof ICASTTypedefNameSpecifier )
|
||||||
return PROCESS_CONTINUE;
|
return PROCESS_CONTINUE;
|
||||||
|
|
||||||
|
@ -340,7 +319,7 @@ public class CVisitor implements ICASTVisitor {
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.internal.core.dom.parser.c.CVisitor.CBaseVisitorAction#processEnumerator(org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator)
|
* @see org.eclipse.cdt.internal.core.dom.parser.c.CVisitor.CBaseVisitorAction#processEnumerator(org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator)
|
||||||
*/
|
*/
|
||||||
public int processEnumerator(IASTEnumerator enumerator) {
|
public int visit(IASTEnumerator enumerator) {
|
||||||
if( binding instanceof IEnumerator && enumerator.getName().resolveBinding() == binding ){
|
if( binding instanceof IEnumerator && enumerator.getName().resolveBinding() == binding ){
|
||||||
addName( enumerator.getName() );
|
addName( enumerator.getName() );
|
||||||
}
|
}
|
||||||
|
@ -351,7 +330,7 @@ public class CVisitor implements ICASTVisitor {
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.internal.core.dom.parser.c.CVisitor.CBaseVisitorAction#processStatement(org.eclipse.cdt.core.dom.ast.IASTStatement)
|
* @see org.eclipse.cdt.internal.core.dom.parser.c.CVisitor.CBaseVisitorAction#processStatement(org.eclipse.cdt.core.dom.ast.IASTStatement)
|
||||||
*/
|
*/
|
||||||
public int processStatement(IASTStatement statement) {
|
public int visit(IASTStatement statement) {
|
||||||
if ( statement instanceof IASTLabelStatement && binding instanceof ILabel ){
|
if ( statement instanceof IASTLabelStatement && binding instanceof ILabel ){
|
||||||
if ( ((IASTLabelStatement)statement).getName().resolveBinding() == binding )
|
if ( ((IASTLabelStatement)statement).getName().resolveBinding() == binding )
|
||||||
addName(((IASTLabelStatement)statement).getName());
|
addName(((IASTLabelStatement)statement).getName());
|
||||||
|
@ -362,7 +341,7 @@ public class CVisitor implements ICASTVisitor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class CollectReferencesAction extends CBaseVisitorAction {
|
public static class CollectReferencesAction extends CASTVisitor {
|
||||||
private static final int DEFAULT_LIST_SIZE = 8;
|
private static final int DEFAULT_LIST_SIZE = 8;
|
||||||
private IASTName [] refs;
|
private IASTName [] refs;
|
||||||
private IBinding binding;
|
private IBinding binding;
|
||||||
|
@ -378,7 +357,7 @@ public class CVisitor implements ICASTVisitor {
|
||||||
this.binding = binding;
|
this.binding = binding;
|
||||||
this.refs = new IASTName[ DEFAULT_LIST_SIZE ];
|
this.refs = new IASTName[ DEFAULT_LIST_SIZE ];
|
||||||
|
|
||||||
processNames = true;
|
shouldVisitNames = true;
|
||||||
if( binding instanceof ILabel )
|
if( binding instanceof ILabel )
|
||||||
kind = KIND_LABEL;
|
kind = KIND_LABEL;
|
||||||
else if( binding instanceof ICompositeType ||
|
else if( binding instanceof ICompositeType ||
|
||||||
|
@ -390,7 +369,7 @@ public class CVisitor implements ICASTVisitor {
|
||||||
kind = KIND_OBJ_FN;
|
kind = KIND_OBJ_FN;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int processName( IASTName name ){
|
public int visit( IASTName name ){
|
||||||
ASTNodeProperty prop = name.getPropertyInParent();
|
ASTNodeProperty prop = name.getPropertyInParent();
|
||||||
switch( kind ){
|
switch( kind ){
|
||||||
case KIND_LABEL:
|
case KIND_LABEL:
|
||||||
|
@ -1337,355 +1316,354 @@ public class CVisitor implements ICASTVisitor {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void clearBindings( IASTTranslationUnit tu ){
|
public static void clearBindings( IASTTranslationUnit tu ){
|
||||||
tu.getVisitor().visitTranslationUnit( new ClearBindingAction() );
|
tu.accept( new ClearBindingAction() );
|
||||||
}
|
}
|
||||||
|
|
||||||
private IASTTranslationUnit tu = null;
|
// public CVisitor( IASTTranslationUnit tu ) {
|
||||||
public CVisitor( IASTTranslationUnit tu ) {
|
// this.tu = tu;
|
||||||
this.tu = tu;
|
// }
|
||||||
}
|
|
||||||
|
|
||||||
public void visitTranslationUnit( BaseVisitorAction action ){
|
// public void visitTranslationUnit( ASTVisitor action ){
|
||||||
IASTDeclaration[] decls = tu.getDeclarations();
|
// IASTDeclaration[] decls = tu.getDeclarations();
|
||||||
for( int i = 0; i < decls.length; i++ ){
|
// for( int i = 0; i < decls.length; i++ ){
|
||||||
if( !visitDeclaration( decls[i], action ) ) return;
|
// if( !visitDeclaration( decls[i], action ) ) return;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public boolean visitName( IASTName name, BaseVisitorAction action ){
|
// public boolean visitName( IASTName name, ASTVisitor action ){
|
||||||
if( action.processNames ) {
|
// if( action.processNames ) {
|
||||||
switch( action.processName( name ) ){
|
// switch( action.processName( name ) ){
|
||||||
case BaseVisitorAction.PROCESS_ABORT : return false;
|
// case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
case BaseVisitorAction.PROCESS_SKIP : return true;
|
// case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
default : break;
|
// default : break;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public boolean visitDeclaration( IASTDeclaration declaration, BaseVisitorAction action ){
|
// public boolean visitDeclaration( IASTDeclaration declaration, ASTVisitor action ){
|
||||||
if( action.processDeclarations ) {
|
// if( action.processDeclarations ) {
|
||||||
switch( action.processDeclaration( declaration ) ){
|
// switch( action.processDeclaration( declaration ) ){
|
||||||
case BaseVisitorAction.PROCESS_ABORT : return false;
|
// case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
case BaseVisitorAction.PROCESS_SKIP : return true;
|
// case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
default : break;
|
// default : break;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if( declaration instanceof IASTSimpleDeclaration ){
|
// if( declaration instanceof IASTSimpleDeclaration ){
|
||||||
IASTSimpleDeclaration simpleDecl = (IASTSimpleDeclaration) declaration;
|
// IASTSimpleDeclaration simpleDecl = (IASTSimpleDeclaration) declaration;
|
||||||
if( !visitDeclSpecifier( simpleDecl.getDeclSpecifier(), action ) ) return false;
|
// if( !visitDeclSpecifier( simpleDecl.getDeclSpecifier(), action ) ) return false;
|
||||||
IASTDeclarator [] list = simpleDecl.getDeclarators();
|
// IASTDeclarator [] list = simpleDecl.getDeclarators();
|
||||||
for( int i = 0; list != null && i < list.length; i++ ){
|
// for( int i = 0; list != null && i < list.length; i++ ){
|
||||||
if( !visitDeclarator( list[i], action ) ) return false;
|
// if( !visitDeclarator( list[i], action ) ) return false;
|
||||||
}
|
// }
|
||||||
} else if( declaration instanceof IASTFunctionDefinition ){
|
// } else if( declaration instanceof IASTFunctionDefinition ){
|
||||||
IASTFunctionDefinition fnDef = (IASTFunctionDefinition) declaration;
|
// IASTFunctionDefinition fnDef = (IASTFunctionDefinition) declaration;
|
||||||
if( !visitDeclSpecifier( fnDef.getDeclSpecifier(), action ) ) return false;
|
// if( !visitDeclSpecifier( fnDef.getDeclSpecifier(), action ) ) return false;
|
||||||
if( !visitDeclarator( fnDef.getDeclarator(), action ) ) return false;
|
// if( !visitDeclarator( fnDef.getDeclarator(), action ) ) return false;
|
||||||
if( !visitStatement( fnDef.getBody(), action ) ) return false;
|
// if( !visitStatement( fnDef.getBody(), action ) ) return false;
|
||||||
}
|
// }
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
public boolean visitDeclarator( IASTDeclarator declarator, BaseVisitorAction action ){
|
// public boolean visitDeclarator( IASTDeclarator declarator, ASTVisitor action ){
|
||||||
if( action.processDeclarators ){
|
// if( action.processDeclarators ){
|
||||||
switch( action.processDeclarator( declarator ) ){
|
// switch( action.processDeclarator( declarator ) ){
|
||||||
case BaseVisitorAction.PROCESS_ABORT : return false;
|
// case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
case BaseVisitorAction.PROCESS_SKIP : return true;
|
// case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
default : break;
|
// default : break;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
//having a nested declarator implies that the name on this declarator is empty
|
// //having a nested declarator implies that the name on this declarator is empty
|
||||||
if( declarator.getPropertyInParent() != IASTTypeId.ABSTRACT_DECLARATOR &&
|
// if( declarator.getPropertyInParent() != IASTTypeId.ABSTRACT_DECLARATOR &&
|
||||||
declarator.getNestedDeclarator() == null )
|
// declarator.getNestedDeclarator() == null )
|
||||||
{
|
// {
|
||||||
if( !visitName( declarator.getName(), action ) ) return false;
|
// if( !visitName( declarator.getName(), action ) ) return false;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if( declarator.getNestedDeclarator() != null )
|
// if( declarator.getNestedDeclarator() != null )
|
||||||
if( !visitDeclarator( declarator.getNestedDeclarator(), action ) ) return false;
|
// if( !visitDeclarator( declarator.getNestedDeclarator(), action ) ) return false;
|
||||||
|
//
|
||||||
if( declarator.getInitializer() != null )
|
// if( declarator.getInitializer() != null )
|
||||||
if( !visitInitializer( declarator.getInitializer(), action ) ) return false;
|
// if( !visitInitializer( declarator.getInitializer(), action ) ) return false;
|
||||||
|
//
|
||||||
if( declarator instanceof IASTStandardFunctionDeclarator ){
|
// if( declarator instanceof IASTStandardFunctionDeclarator ){
|
||||||
IASTParameterDeclaration [] list = ((IASTStandardFunctionDeclarator)declarator).getParameters();
|
// IASTParameterDeclaration [] list = ((IASTStandardFunctionDeclarator)declarator).getParameters();
|
||||||
for( int i = 0; i < list.length; i++ ){
|
// for( int i = 0; i < list.length; i++ ){
|
||||||
if( !visitParameterDeclaration( list[i], action ) ) return false;
|
// if( !visitParameterDeclaration( list[i], action ) ) return false;
|
||||||
}
|
// }
|
||||||
} else if ( declarator instanceof ICASTKnRFunctionDeclarator ) {
|
// } else if ( declarator instanceof ICASTKnRFunctionDeclarator ) {
|
||||||
ICASTKnRFunctionDeclarator knr = (ICASTKnRFunctionDeclarator) declarator;
|
// ICASTKnRFunctionDeclarator knr = (ICASTKnRFunctionDeclarator) declarator;
|
||||||
IASTName [] names = knr.getParameterNames();
|
// IASTName [] names = knr.getParameterNames();
|
||||||
for( int i = 0; i < names.length; i++ ){
|
// for( int i = 0; i < names.length; i++ ){
|
||||||
if( !visitName( names[i], action ) ) return false;
|
// if( !visitName( names[i], action ) ) return false;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
IASTDeclaration[] parmDeclarations = knr.getParameterDeclarations();
|
// IASTDeclaration[] parmDeclarations = knr.getParameterDeclarations();
|
||||||
for( int i = 0; i < parmDeclarations.length; i++ ){
|
// for( int i = 0; i < parmDeclarations.length; i++ ){
|
||||||
if( !visitDeclaration( parmDeclarations[i], action ) ) return false;
|
// if( !visitDeclaration( parmDeclarations[i], action ) ) return false;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
else if( declarator instanceof IASTArrayDeclarator )
|
// else if( declarator instanceof IASTArrayDeclarator )
|
||||||
{
|
// {
|
||||||
IASTArrayDeclarator arrayDecl = (IASTArrayDeclarator) declarator;
|
// IASTArrayDeclarator arrayDecl = (IASTArrayDeclarator) declarator;
|
||||||
IASTArrayModifier [] mods = arrayDecl.getArrayModifiers();
|
// IASTArrayModifier [] mods = arrayDecl.getArrayModifiers();
|
||||||
for( int i = 0; i < mods.length; ++i )
|
// for( int i = 0; i < mods.length; ++i )
|
||||||
if( mods[i].getConstantExpression() != null &&
|
// if( mods[i].getConstantExpression() != null &&
|
||||||
!visitExpression( mods[i].getConstantExpression(), action ) ) return false;
|
// !visitExpression( mods[i].getConstantExpression(), action ) ) return false;
|
||||||
}
|
// }
|
||||||
else if( declarator instanceof IASTFieldDeclarator )
|
// else if( declarator instanceof IASTFieldDeclarator )
|
||||||
if( ! visitExpression( ((IASTFieldDeclarator) declarator).getBitFieldSize(), action ) ) return false;
|
// if( ! visitExpression( ((IASTFieldDeclarator) declarator).getBitFieldSize(), action ) ) return false;
|
||||||
|
//
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public boolean visitInitializer( IASTInitializer initializer, BaseVisitorAction action ){
|
// public boolean visitInitializer( IASTInitializer initializer, ASTVisitor action ){
|
||||||
if( initializer == null )
|
// if( initializer == null )
|
||||||
return true;
|
// return true;
|
||||||
|
//
|
||||||
if( action.processInitializers ){
|
// if( action.processInitializers ){
|
||||||
switch( action.processInitializer( initializer ) ){
|
// switch( action.processInitializer( initializer ) ){
|
||||||
case BaseVisitorAction.PROCESS_ABORT : return false;
|
// case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
case BaseVisitorAction.PROCESS_SKIP : return true;
|
// case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
default : break;
|
// default : break;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if( initializer instanceof IASTInitializerExpression ){
|
// if( initializer instanceof IASTInitializerExpression ){
|
||||||
if( !visitExpression( ((IASTInitializerExpression) initializer).getExpression(), action ) ) return false;
|
// if( !visitExpression( ((IASTInitializerExpression) initializer).getExpression(), action ) ) return false;
|
||||||
} else if( initializer instanceof IASTInitializerList ){
|
// } else if( initializer instanceof IASTInitializerList ){
|
||||||
IASTInitializer [] list = ((IASTInitializerList) initializer).getInitializers();
|
// IASTInitializer [] list = ((IASTInitializerList) initializer).getInitializers();
|
||||||
for( int i = 0; i < list.length; i++ ){
|
// for( int i = 0; i < list.length; i++ ){
|
||||||
if( !visitInitializer( list[i], action ) ) return false;
|
// if( !visitInitializer( list[i], action ) ) return false;
|
||||||
}
|
// }
|
||||||
} else if( initializer instanceof ICASTDesignatedInitializer ){
|
// } else if( initializer instanceof ICASTDesignatedInitializer ){
|
||||||
ICASTDesignatedInitializer dinit = (ICASTDesignatedInitializer) initializer;
|
// ICASTDesignatedInitializer dinit = (ICASTDesignatedInitializer) initializer;
|
||||||
ICASTDesignator [] ds = dinit.getDesignators();
|
// ICASTDesignator [] ds = dinit.getDesignators();
|
||||||
for( int i = 0; i < ds.length; i++ ){
|
// for( int i = 0; i < ds.length; i++ ){
|
||||||
if( !visitDesignator( ds[i], action ) ) return false;
|
// if( !visitDesignator( ds[i], action ) ) return false;
|
||||||
}
|
// }
|
||||||
if( !visitInitializer( dinit.getOperandInitializer(), action ) ) return false;
|
// if( !visitInitializer( dinit.getOperandInitializer(), action ) ) return false;
|
||||||
}
|
// }
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
public boolean visitDesignator( ICASTDesignator designator, BaseVisitorAction action ){
|
// public boolean visitDesignator( ICASTDesignator designator, ASTVisitor action ){
|
||||||
if( action instanceof CBaseVisitorAction && ((CBaseVisitorAction)action).processDesignators ){
|
// if( action instanceof CASTVisitor && ((CASTVisitor)action).processDesignators ){
|
||||||
switch( ((CBaseVisitorAction)action).processDesignator( designator ) ){
|
// switch( ((CASTVisitor)action).processDesignator( designator ) ){
|
||||||
case BaseVisitorAction.PROCESS_ABORT : return false;
|
// case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
case BaseVisitorAction.PROCESS_SKIP : return true;
|
// case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
default : break;
|
// default : break;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
if( designator instanceof ICASTFieldDesignator ){
|
// if( designator instanceof ICASTFieldDesignator ){
|
||||||
if( !visitName( ((ICASTFieldDesignator)designator).getName(), action ) ) return false;
|
// if( !visitName( ((ICASTFieldDesignator)designator).getName(), action ) ) return false;
|
||||||
} else if( designator instanceof ICASTArrayDesignator ){
|
// } else if( designator instanceof ICASTArrayDesignator ){
|
||||||
if( !visitExpression( ((ICASTArrayDesignator)designator).getSubscriptExpression(), action ) ) return false;
|
// if( !visitExpression( ((ICASTArrayDesignator)designator).getSubscriptExpression(), action ) ) return false;
|
||||||
} else if( designator instanceof IGCCASTArrayRangeDesignator ){
|
// } else if( designator instanceof IGCCASTArrayRangeDesignator ){
|
||||||
if( !visitExpression( ((IGCCASTArrayRangeDesignator)designator).getRangeFloor(), action ) ) return false;
|
// if( !visitExpression( ((IGCCASTArrayRangeDesignator)designator).getRangeFloor(), action ) ) return false;
|
||||||
if( !visitExpression( ((IGCCASTArrayRangeDesignator)designator).getRangeCeiling(), action ) ) return false;
|
// if( !visitExpression( ((IGCCASTArrayRangeDesignator)designator).getRangeCeiling(), action ) ) return false;
|
||||||
}
|
// }
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
public boolean visitParameterDeclaration( IASTParameterDeclaration parameterDeclaration, BaseVisitorAction action ){
|
// public boolean visitParameterDeclaration( IASTParameterDeclaration parameterDeclaration, ASTVisitor action ){
|
||||||
if( action.processParameterDeclarations ){
|
// if( action.processParameterDeclarations ){
|
||||||
switch( action.processParameterDeclaration( parameterDeclaration ) ){
|
// switch( action.processParameterDeclaration( parameterDeclaration ) ){
|
||||||
case BaseVisitorAction.PROCESS_ABORT : return false;
|
// case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
case BaseVisitorAction.PROCESS_SKIP : return true;
|
// case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
default : break;
|
// default : break;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if( !visitDeclSpecifier( parameterDeclaration.getDeclSpecifier(), action ) ) return false;
|
// if( !visitDeclSpecifier( parameterDeclaration.getDeclSpecifier(), action ) ) return false;
|
||||||
if( !visitDeclarator( parameterDeclaration.getDeclarator(), action ) ) return false;
|
// if( !visitDeclarator( parameterDeclaration.getDeclarator(), action ) ) return false;
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public boolean visitDeclSpecifier( IASTDeclSpecifier declSpec, BaseVisitorAction action ){
|
// public boolean visitDeclSpecifier( IASTDeclSpecifier declSpec, ASTVisitor action ){
|
||||||
if( action.processDeclSpecifiers ){
|
// if( action.processDeclSpecifiers ){
|
||||||
switch( action.processDeclSpecifier( declSpec ) ){
|
// switch( action.processDeclSpecifier( declSpec ) ){
|
||||||
case BaseVisitorAction.PROCESS_ABORT : return false;
|
// case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
case BaseVisitorAction.PROCESS_SKIP : return true;
|
// case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
default : break;
|
// default : break;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if( declSpec instanceof ICASTCompositeTypeSpecifier ){
|
// if( declSpec instanceof ICASTCompositeTypeSpecifier ){
|
||||||
ICASTCompositeTypeSpecifier compTypeSpec = (ICASTCompositeTypeSpecifier) declSpec;
|
// ICASTCompositeTypeSpecifier compTypeSpec = (ICASTCompositeTypeSpecifier) declSpec;
|
||||||
if( !visitName( compTypeSpec.getName(), action ) ) return false;
|
// if( !visitName( compTypeSpec.getName(), action ) ) return false;
|
||||||
|
//
|
||||||
IASTDeclaration [] list = compTypeSpec.getMembers();
|
// IASTDeclaration [] list = compTypeSpec.getMembers();
|
||||||
for( int i = 0; i < list.length; i++ ){
|
// for( int i = 0; i < list.length; i++ ){
|
||||||
if( !visitDeclaration( list[i], action ) ) return false;
|
// if( !visitDeclaration( list[i], action ) ) return false;
|
||||||
}
|
// }
|
||||||
} else if( declSpec instanceof ICASTElaboratedTypeSpecifier ){
|
// } else if( declSpec instanceof ICASTElaboratedTypeSpecifier ){
|
||||||
if( !visitName( ((ICASTElaboratedTypeSpecifier) declSpec).getName(), action ) ) return false;
|
// if( !visitName( ((ICASTElaboratedTypeSpecifier) declSpec).getName(), action ) ) return false;
|
||||||
} else if( declSpec instanceof ICASTTypedefNameSpecifier ){
|
// } else if( declSpec instanceof ICASTTypedefNameSpecifier ){
|
||||||
if( !visitName( ((ICASTTypedefNameSpecifier) declSpec).getName(), action ) ) return false;
|
// if( !visitName( ((ICASTTypedefNameSpecifier) declSpec).getName(), action ) ) return false;
|
||||||
} else if( declSpec instanceof ICASTEnumerationSpecifier ){
|
// } else if( declSpec instanceof ICASTEnumerationSpecifier ){
|
||||||
ICASTEnumerationSpecifier enumSpec = (ICASTEnumerationSpecifier) declSpec;
|
// ICASTEnumerationSpecifier enumSpec = (ICASTEnumerationSpecifier) declSpec;
|
||||||
if( !visitName( enumSpec.getName(), action ) ) return false;
|
// if( !visitName( enumSpec.getName(), action ) ) return false;
|
||||||
IASTEnumerator [] list = enumSpec.getEnumerators();
|
// IASTEnumerator [] list = enumSpec.getEnumerators();
|
||||||
for( int i = 0; i < list.length; i++ ){
|
// for( int i = 0; i < list.length; i++ ){
|
||||||
if( !visitEnumerator( list[i], action ) ) return false;
|
// if( !visitEnumerator( list[i], action ) ) return false;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
public boolean visitEnumerator( IASTEnumerator enumerator, BaseVisitorAction action ){
|
// public boolean visitEnumerator( IASTEnumerator enumerator, ASTVisitor action ){
|
||||||
if( action.processEnumerators ){
|
// if( action.processEnumerators ){
|
||||||
switch( action.processEnumerator( enumerator ) ){
|
// switch( action.processEnumerator( enumerator ) ){
|
||||||
case BaseVisitorAction.PROCESS_ABORT : return false;
|
// case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
case BaseVisitorAction.PROCESS_SKIP : return true;
|
// case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
default : break;
|
// default : break;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if( !visitName( enumerator.getName(), action ) ) return false;
|
// if( !visitName( enumerator.getName(), action ) ) return false;
|
||||||
if( enumerator.getValue() != null )
|
// if( enumerator.getValue() != null )
|
||||||
if( !visitExpression( enumerator.getValue(), action ) ) return false;
|
// if( !visitExpression( enumerator.getValue(), action ) ) return false;
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
private boolean visitIfStatement( IASTIfStatement ifStatement, BaseVisitorAction action ){
|
// private boolean visitIfStatement( IASTIfStatement ifStatement, ASTVisitor action ){
|
||||||
while( ifStatement != null ){
|
// while( ifStatement != null ){
|
||||||
if( action.processStatements ){
|
// if( action.processStatements ){
|
||||||
switch( action.processStatement( ifStatement ) ){
|
// switch( action.processStatement( ifStatement ) ){
|
||||||
case BaseVisitorAction.PROCESS_ABORT : return false;
|
// case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
case BaseVisitorAction.PROCESS_SKIP : return true;
|
// case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
default : break;
|
// default : break;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
if( !visitExpression( ifStatement.getCondition(), action ) ) return false;
|
// if( !visitExpression( ifStatement.getCondition(), action ) ) return false;
|
||||||
if( !visitStatement( ifStatement.getThenClause(), action ) ) return false;
|
// if( !visitStatement( ifStatement.getThenClause(), action ) ) return false;
|
||||||
if( ifStatement.getElseClause() != null ){
|
// if( ifStatement.getElseClause() != null ){
|
||||||
IASTStatement statement = ifStatement.getElseClause();
|
// IASTStatement statement = ifStatement.getElseClause();
|
||||||
if( statement instanceof IASTIfStatement ){
|
// if( statement instanceof IASTIfStatement ){
|
||||||
ifStatement = (IASTIfStatement) statement;
|
// ifStatement = (IASTIfStatement) statement;
|
||||||
continue;
|
// continue;
|
||||||
}
|
// }
|
||||||
if( !visitStatement( statement, action ) ) return false;
|
// if( !visitStatement( statement, action ) ) return false;
|
||||||
}
|
// }
|
||||||
ifStatement = null;
|
// ifStatement = null;
|
||||||
}
|
// }
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
public boolean visitStatement( IASTStatement statement, BaseVisitorAction action ){
|
// public boolean visitStatement( IASTStatement statement, ASTVisitor action ){
|
||||||
//handle if's in a non-recursive manner to avoid stack overflows in case of huge number of elses
|
// //handle if's in a non-recursive manner to avoid stack overflows in case of huge number of elses
|
||||||
if( statement instanceof IASTIfStatement )
|
// if( statement instanceof IASTIfStatement )
|
||||||
return visitIfStatement( (IASTIfStatement) statement, action );
|
// return visitIfStatement( (IASTIfStatement) statement, action );
|
||||||
|
//
|
||||||
if( action.processStatements ){
|
// if( action.processStatements ){
|
||||||
switch( action.processStatement( statement ) ){
|
// switch( action.processStatement( statement ) ){
|
||||||
case BaseVisitorAction.PROCESS_ABORT : return false;
|
// case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
case BaseVisitorAction.PROCESS_SKIP : return true;
|
// case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
default : break;
|
// default : break;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if( statement instanceof IASTCompoundStatement ){
|
// if( statement instanceof IASTCompoundStatement ){
|
||||||
IASTStatement [] list = ((IASTCompoundStatement) statement).getStatements();
|
// IASTStatement [] list = ((IASTCompoundStatement) statement).getStatements();
|
||||||
for( int i = 0; i < list.length; i++ ){
|
// for( int i = 0; i < list.length; i++ ){
|
||||||
if( list[i] == null ) break;
|
// if( list[i] == null ) break;
|
||||||
if( !visitStatement( list[i], action ) ) return false;
|
// if( !visitStatement( list[i], action ) ) return false;
|
||||||
}
|
// }
|
||||||
} else if( statement instanceof IASTDeclarationStatement ){
|
// } else if( statement instanceof IASTDeclarationStatement ){
|
||||||
if( !visitDeclaration( ((IASTDeclarationStatement)statement).getDeclaration(), action ) ) return false;
|
// if( !visitDeclaration( ((IASTDeclarationStatement)statement).getDeclaration(), action ) ) return false;
|
||||||
} else if( statement instanceof IASTExpressionStatement ){
|
// } else if( statement instanceof IASTExpressionStatement ){
|
||||||
if( ((IASTExpressionStatement)statement).getExpression() != null && !visitExpression( ((IASTExpressionStatement)statement).getExpression(), action ) ) return false;
|
// if( ((IASTExpressionStatement)statement).getExpression() != null && !visitExpression( ((IASTExpressionStatement)statement).getExpression(), action ) ) return false;
|
||||||
} else if( statement instanceof IASTCaseStatement ){
|
// } else if( statement instanceof IASTCaseStatement ){
|
||||||
if( !visitExpression( ((IASTCaseStatement)statement).getExpression(), action ) ) return false;
|
// if( !visitExpression( ((IASTCaseStatement)statement).getExpression(), action ) ) return false;
|
||||||
} else if( statement instanceof IASTDoStatement ){
|
// } else if( statement instanceof IASTDoStatement ){
|
||||||
if( !visitStatement( ((IASTDoStatement)statement).getBody(), action ) ) return false;
|
// if( !visitStatement( ((IASTDoStatement)statement).getBody(), action ) ) return false;
|
||||||
if( !visitExpression( ((IASTDoStatement)statement).getCondition(), action ) ) return false;
|
// if( !visitExpression( ((IASTDoStatement)statement).getCondition(), action ) ) return false;
|
||||||
} else if( statement instanceof IASTGotoStatement ){
|
// } else if( statement instanceof IASTGotoStatement ){
|
||||||
if( !visitName( ((IASTGotoStatement)statement).getName(), action ) ) return false;
|
// if( !visitName( ((IASTGotoStatement)statement).getName(), action ) ) return false;
|
||||||
} else if( statement instanceof IASTLabelStatement ){
|
// } else if( statement instanceof IASTLabelStatement ){
|
||||||
if( !visitName( ((IASTLabelStatement)statement).getName(), action ) ) return false;
|
// if( !visitName( ((IASTLabelStatement)statement).getName(), action ) ) return false;
|
||||||
} else if( statement instanceof IASTReturnStatement ){
|
// } else if( statement instanceof IASTReturnStatement ){
|
||||||
if( ((IASTReturnStatement) statement ).getReturnValue() != null )
|
// if( ((IASTReturnStatement) statement ).getReturnValue() != null )
|
||||||
if( !visitExpression( ((IASTReturnStatement) statement ).getReturnValue(), action ) ) return false;
|
// if( !visitExpression( ((IASTReturnStatement) statement ).getReturnValue(), action ) ) return false;
|
||||||
} else if( statement instanceof IASTSwitchStatement ){
|
// } else if( statement instanceof IASTSwitchStatement ){
|
||||||
if( !visitExpression( ((IASTSwitchStatement) statement ).getController(), action ) ) return false;
|
// if( !visitExpression( ((IASTSwitchStatement) statement ).getController(), action ) ) return false;
|
||||||
if( !visitStatement( ((IASTSwitchStatement) statement ).getBody(), action ) ) return false;
|
// if( !visitStatement( ((IASTSwitchStatement) statement ).getBody(), action ) ) return false;
|
||||||
} else if( statement instanceof IASTWhileStatement ){
|
// } else if( statement instanceof IASTWhileStatement ){
|
||||||
if( !visitExpression( ((IASTWhileStatement) statement ).getCondition(), action ) ) return false;
|
// if( !visitExpression( ((IASTWhileStatement) statement ).getCondition(), action ) ) return false;
|
||||||
if( !visitStatement( ((IASTWhileStatement) statement ).getBody(), action ) ) return false;
|
// if( !visitStatement( ((IASTWhileStatement) statement ).getBody(), action ) ) return false;
|
||||||
} else if( statement instanceof IASTForStatement ){
|
// } else if( statement instanceof IASTForStatement ){
|
||||||
IASTForStatement s = (IASTForStatement) statement;
|
// IASTForStatement s = (IASTForStatement) statement;
|
||||||
if( s.getInitDeclaration() != null )
|
// if( s.getInitDeclaration() != null )
|
||||||
if( !visitDeclaration( s.getInitDeclaration(), action ) ) return false;
|
// if( !visitDeclaration( s.getInitDeclaration(), action ) ) return false;
|
||||||
if( s.getInitExpression() != null )
|
// if( s.getInitExpression() != null )
|
||||||
if( !visitExpression( s.getInitExpression(), action ) ) return false;
|
// if( !visitExpression( s.getInitExpression(), action ) ) return false;
|
||||||
if( !visitExpression( s.getCondition(), action ) ) return false;
|
// if( !visitExpression( s.getCondition(), action ) ) return false;
|
||||||
if( !visitExpression( s.getIterationExpression(), action ) ) return false;
|
// if( !visitExpression( s.getIterationExpression(), action ) ) return false;
|
||||||
if( !visitStatement( s.getBody(), action ) ) return false;
|
// if( !visitStatement( s.getBody(), action ) ) return false;
|
||||||
}
|
// }
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
public boolean visitTypeId( IASTTypeId typeId, BaseVisitorAction action ){
|
// public boolean visitTypeId( IASTTypeId typeId, ASTVisitor action ){
|
||||||
if( action.processTypeIds ){
|
// if( action.processTypeIds ){
|
||||||
switch( action.processTypeId( typeId ) ){
|
// switch( action.processTypeId( typeId ) ){
|
||||||
case BaseVisitorAction.PROCESS_ABORT : return false;
|
// case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
case BaseVisitorAction.PROCESS_SKIP : return true;
|
// case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
default : break;
|
// default : break;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if( !visitDeclarator( typeId.getAbstractDeclarator(), action ) ) return false;
|
// if( !visitDeclarator( typeId.getAbstractDeclarator(), action ) ) return false;
|
||||||
if( !visitDeclSpecifier( typeId.getDeclSpecifier(), action ) ) return false;
|
// if( !visitDeclSpecifier( typeId.getDeclSpecifier(), action ) ) return false;
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
public boolean visitExpression( IASTExpression expression, BaseVisitorAction action ){
|
// public boolean visitExpression( IASTExpression expression, ASTVisitor action ){
|
||||||
if (expression == null) return true;
|
// if (expression == null) return true;
|
||||||
|
//
|
||||||
if( action.processExpressions ){
|
// if( action.processExpressions ){
|
||||||
switch( action.processExpression( expression ) ){
|
// switch( action.processExpression( expression ) ){
|
||||||
case BaseVisitorAction.PROCESS_ABORT : return false;
|
// case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
case BaseVisitorAction.PROCESS_SKIP : return true;
|
// case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
default : break;
|
// default : break;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if( expression instanceof IASTArraySubscriptExpression ){
|
// if( expression instanceof IASTArraySubscriptExpression ){
|
||||||
if( !visitExpression( ((IASTArraySubscriptExpression)expression).getArrayExpression(), action ) ) return false;
|
// if( !visitExpression( ((IASTArraySubscriptExpression)expression).getArrayExpression(), action ) ) return false;
|
||||||
if( !visitExpression( ((IASTArraySubscriptExpression)expression).getSubscriptExpression(), action ) ) return false;
|
// if( !visitExpression( ((IASTArraySubscriptExpression)expression).getSubscriptExpression(), action ) ) return false;
|
||||||
} else if( expression instanceof IASTBinaryExpression ){
|
// } else if( expression instanceof IASTBinaryExpression ){
|
||||||
if( !visitExpression( ((IASTBinaryExpression)expression).getOperand1(), action ) ) return false;
|
// if( !visitExpression( ((IASTBinaryExpression)expression).getOperand1(), action ) ) return false;
|
||||||
if( !visitExpression( ((IASTBinaryExpression)expression).getOperand2(), action ) ) return false;
|
// if( !visitExpression( ((IASTBinaryExpression)expression).getOperand2(), action ) ) return false;
|
||||||
} else if( expression instanceof IASTConditionalExpression){
|
// } else if( expression instanceof IASTConditionalExpression){
|
||||||
if( !visitExpression( ((IASTConditionalExpression)expression).getLogicalConditionExpression(), action ) ) return false;
|
// if( !visitExpression( ((IASTConditionalExpression)expression).getLogicalConditionExpression(), action ) ) return false;
|
||||||
if( !visitExpression( ((IASTConditionalExpression)expression).getNegativeResultExpression(), action ) ) return false;
|
// if( !visitExpression( ((IASTConditionalExpression)expression).getNegativeResultExpression(), action ) ) return false;
|
||||||
if( !visitExpression( ((IASTConditionalExpression)expression).getPositiveResultExpression(), action ) ) return false;
|
// if( !visitExpression( ((IASTConditionalExpression)expression).getPositiveResultExpression(), action ) ) return false;
|
||||||
} else if( expression instanceof IASTExpressionList ){
|
// } else if( expression instanceof IASTExpressionList ){
|
||||||
IASTExpression[] list = ((IASTExpressionList)expression).getExpressions();
|
// IASTExpression[] list = ((IASTExpressionList)expression).getExpressions();
|
||||||
for( int i = 0; i < list.length; i++){
|
// for( int i = 0; i < list.length; i++){
|
||||||
if( list[i] == null ) break;
|
// if( list[i] == null ) break;
|
||||||
if( !visitExpression( list[i], action ) ) return false;
|
// if( !visitExpression( list[i], action ) ) return false;
|
||||||
}
|
// }
|
||||||
} else if( expression instanceof IASTFieldReference ){
|
// } else if( expression instanceof IASTFieldReference ){
|
||||||
if( !visitExpression( ((IASTFieldReference)expression).getFieldOwner(), action ) ) return false;
|
// if( !visitExpression( ((IASTFieldReference)expression).getFieldOwner(), action ) ) return false;
|
||||||
if( !visitName( ((IASTFieldReference)expression).getFieldName(), action ) ) return false;
|
// if( !visitName( ((IASTFieldReference)expression).getFieldName(), action ) ) return false;
|
||||||
} else if( expression instanceof IASTFunctionCallExpression ){
|
// } else if( expression instanceof IASTFunctionCallExpression ){
|
||||||
if( !visitExpression( ((IASTFunctionCallExpression)expression).getFunctionNameExpression(), action ) ) return false;
|
// if( !visitExpression( ((IASTFunctionCallExpression)expression).getFunctionNameExpression(), action ) ) return false;
|
||||||
if( ((IASTFunctionCallExpression)expression).getParameterExpression() != null && !visitExpression( ((IASTFunctionCallExpression)expression).getParameterExpression(), action ) ) return false;
|
// if( ((IASTFunctionCallExpression)expression).getParameterExpression() != null && !visitExpression( ((IASTFunctionCallExpression)expression).getParameterExpression(), action ) ) return false;
|
||||||
} else if( expression instanceof IASTIdExpression ){
|
// } else if( expression instanceof IASTIdExpression ){
|
||||||
if( !visitName( ((IASTIdExpression)expression).getName(), action ) ) return false;
|
// if( !visitName( ((IASTIdExpression)expression).getName(), action ) ) return false;
|
||||||
} else if( expression instanceof IASTTypeIdExpression ){
|
// } else if( expression instanceof IASTTypeIdExpression ){
|
||||||
if( !visitTypeId( ((IASTTypeIdExpression)expression).getTypeId(), action ) ) return false;
|
// if( !visitTypeId( ((IASTTypeIdExpression)expression).getTypeId(), action ) ) return false;
|
||||||
} else if( expression instanceof IASTCastExpression ){
|
// } else if( expression instanceof IASTCastExpression ){
|
||||||
if( !visitTypeId( ((IASTCastExpression)expression).getTypeId(), action ) ) return false;
|
// if( !visitTypeId( ((IASTCastExpression)expression).getTypeId(), action ) ) return false;
|
||||||
if( !visitExpression( ((IASTCastExpression)expression).getOperand(), action ) ) return false;
|
// if( !visitExpression( ((IASTCastExpression)expression).getOperand(), action ) ) return false;
|
||||||
} else if( expression instanceof IASTUnaryExpression ){
|
// } else if( expression instanceof IASTUnaryExpression ){
|
||||||
if( !visitExpression( ((IASTUnaryExpression)expression).getOperand(), action ) ) return false;
|
// if( !visitExpression( ((IASTUnaryExpression)expression).getOperand(), action ) ) return false;
|
||||||
} else if( expression instanceof ICASTTypeIdInitializerExpression ){
|
// } else if( expression instanceof ICASTTypeIdInitializerExpression ){
|
||||||
if( !visitTypeId( ((ICASTTypeIdInitializerExpression)expression).getTypeId(), action ) ) return false;
|
// if( !visitTypeId( ((ICASTTypeIdInitializerExpression)expression).getTypeId(), action ) ) return false;
|
||||||
if( !visitInitializer( ((ICASTTypeIdInitializerExpression)expression).getInitializer(), action ) ) return false;
|
// if( !visitInitializer( ((ICASTTypeIdInitializerExpression)expression).getInitializer(), action ) ) return false;
|
||||||
} else if( expression instanceof IGNUASTCompoundStatementExpression ){
|
// } else if( expression instanceof IGNUASTCompoundStatementExpression ){
|
||||||
if( !visitStatement( ((IGNUASTCompoundStatementExpression)expression).getCompoundStatement(), action ) ) return false;
|
// if( !visitStatement( ((IGNUASTCompoundStatementExpression)expression).getCompoundStatement(), action ) ) return false;
|
||||||
}
|
// }
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an IType for an IASTName.
|
* Create an IType for an IASTName.
|
||||||
|
@ -1928,14 +1906,14 @@ public class CVisitor implements ICASTVisitor {
|
||||||
|
|
||||||
public static IASTProblem[] getProblems(IASTTranslationUnit tu) {
|
public static IASTProblem[] getProblems(IASTTranslationUnit tu) {
|
||||||
CollectProblemsAction action = new CollectProblemsAction();
|
CollectProblemsAction action = new CollectProblemsAction();
|
||||||
tu.getVisitor().visitTranslationUnit(action);
|
tu.accept(action);
|
||||||
|
|
||||||
return action.getProblems();
|
return action.getProblems();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IASTName[] getDeclarations(IASTTranslationUnit tu, IBinding binding) {
|
public static IASTName[] getDeclarations(IASTTranslationUnit tu, IBinding binding) {
|
||||||
CollectDeclarationsAction action = new CollectDeclarationsAction(binding);
|
CollectDeclarationsAction action = new CollectDeclarationsAction(binding);
|
||||||
tu.getVisitor().visitTranslationUnit(action);
|
tu.accept(action);
|
||||||
|
|
||||||
return action.getDeclarationNames();
|
return action.getDeclarationNames();
|
||||||
}
|
}
|
||||||
|
@ -1947,7 +1925,7 @@ public class CVisitor implements ICASTVisitor {
|
||||||
*/
|
*/
|
||||||
public static IASTName[] getReferences(IASTTranslationUnit tu, IBinding binding) {
|
public static IASTName[] getReferences(IASTTranslationUnit tu, IBinding binding) {
|
||||||
CollectReferencesAction action = new CollectReferencesAction( binding );
|
CollectReferencesAction action = new CollectReferencesAction( binding );
|
||||||
tu.getVisitor().visitTranslationUnit(action);
|
tu.accept(action);
|
||||||
return action.getReferences();
|
return action.getReferences();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTASMDeclaration;
|
import org.eclipse.cdt.core.dom.ast.IASTASMDeclaration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -33,4 +34,15 @@ public class CPPASTASMDeclaration extends CPPASTNode implements
|
||||||
this.assembly = assembly.toCharArray();
|
this.assembly = assembly.toCharArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitDeclarations ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,8 +10,10 @@
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTArrayDeclarator;
|
import org.eclipse.cdt.core.dom.ast.IASTArrayDeclarator;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTArrayModifier;
|
import org.eclipse.cdt.core.dom.ast.IASTArrayModifier;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTInitializer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
|
@ -61,4 +63,14 @@ public class CPPASTArrayDeclarator extends CPPASTDeclarator implements
|
||||||
}
|
}
|
||||||
arrayMods[ currentIndex++ ] = arrayModifier;
|
arrayMods[ currentIndex++ ] = arrayModifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected boolean postAccept( ASTVisitor action ){
|
||||||
|
IASTArrayModifier [] mods = getArrayModifiers();
|
||||||
|
for ( int i = 0; i < mods.length; i++ ) {
|
||||||
|
if( !mods[i].accept( action ) ) return false;
|
||||||
|
}
|
||||||
|
IASTInitializer initializer = getInitializer();
|
||||||
|
if( initializer != null ) if( !initializer.accept( action ) ) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTArrayModifier;
|
import org.eclipse.cdt.core.dom.ast.IASTArrayModifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||||
|
|
||||||
|
@ -34,4 +35,11 @@ public class CPPASTArrayModifier extends CPPASTNode implements
|
||||||
public void setConstantExpression(IASTExpression expression) {
|
public void setConstantExpression(IASTExpression expression) {
|
||||||
exp = expression;
|
exp = expression;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( exp != null )
|
||||||
|
if( !exp.accept( action ) ) return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTArraySubscriptExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTArraySubscriptExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||||
|
|
||||||
|
@ -50,4 +51,19 @@ public class CPPASTArraySubscriptExpression extends CPPASTNode implements
|
||||||
subscriptExp = expression;
|
subscriptExp = expression;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitExpressions ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( arrayExpression != null )
|
||||||
|
if( !arrayExpression.accept( action ) ) return false;
|
||||||
|
if( subscriptExp != null )
|
||||||
|
if( !subscriptExp.accept( action ) ) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,9 @@
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.CPPASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -65,4 +67,18 @@ public class CPPASTBaseSpecifier extends CPPASTNode implements
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action instanceof CPPASTVisitor &&
|
||||||
|
((CPPASTVisitor)action).shouldVisitBaseSpecifiers ){
|
||||||
|
switch( ((CPPASTVisitor)action).visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !name.accept( action ) ) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTBinaryExpression;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTBinaryExpression;
|
||||||
|
|
||||||
|
@ -65,4 +66,18 @@ public class CPPASTBinaryExpression extends CPPASTNode implements
|
||||||
operand2 = expression;
|
operand2 = expression;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitExpressions ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( operand1 != null ) if( !operand1.accept( action ) ) return false;
|
||||||
|
if( operand2 != null ) if( !operand2.accept( action ) ) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTBreakStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTBreakStatement;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -18,4 +19,15 @@ import org.eclipse.cdt.core.dom.ast.IASTBreakStatement;
|
||||||
public class CPPASTBreakStatement extends CPPASTNode implements
|
public class CPPASTBreakStatement extends CPPASTNode implements
|
||||||
IASTBreakStatement {
|
IASTBreakStatement {
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitStatements ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTCaseStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTCaseStatement;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||||
|
|
||||||
|
@ -34,4 +35,16 @@ public class CPPASTCaseStatement extends CPPASTNode implements
|
||||||
this.expression = expression;
|
this.expression = expression;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitStatements ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( expression != null ) if( !expression.accept( action ) ) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCastExpression;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCastExpression;
|
||||||
|
|
||||||
|
@ -34,4 +36,18 @@ public class CPPASTCastExpression extends CPPASTUnaryExpression implements
|
||||||
return typeId;
|
return typeId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitExpressions ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( typeId != null ) if( !typeId.accept( action ) ) return false;
|
||||||
|
IASTExpression op = getOperand();
|
||||||
|
if( op != null ) if( !op.accept( action ) ) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTStatement;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCatchHandler;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCatchHandler;
|
||||||
|
@ -66,4 +67,16 @@ public class CPPASTCatchHandler extends CPPASTNode implements
|
||||||
return declaration;
|
return declaration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitStatements ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( declaration != null ) if( !declaration.accept( action ) ) return false;
|
||||||
|
if( body != null ) if( !body.accept( action ) ) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
|
@ -166,4 +167,23 @@ public class CPPASTCompositeTypeSpecifier extends CPPASTBaseDeclSpecifier
|
||||||
this.scope = scope;
|
this.scope = scope;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitDeclSpecifiers ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( n != null ) if( !n.accept( action ) ) return false;
|
||||||
|
ICPPASTBaseSpecifier[] bases = getBaseSpecifiers();
|
||||||
|
for( int i = 0; i < bases.length; i++ )
|
||||||
|
if( !bases[i].accept( action ) ) return false;
|
||||||
|
|
||||||
|
IASTDeclaration [] decls = getMembers();
|
||||||
|
for( int i = 0; i < decls.length; i++ )
|
||||||
|
if( !decls[i].accept( action ) ) return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTStatement;
|
||||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
|
@ -79,4 +80,18 @@ public class CPPASTCompoundStatement extends CPPASTNode implements
|
||||||
return scope;
|
return scope;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitStatements ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
IASTStatement [] s = getStatements();
|
||||||
|
for ( int i = 0; i < s.length; i++ ) {
|
||||||
|
if( !s[i].accept( action ) ) return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement;
|
||||||
import org.eclipse.cdt.core.dom.ast.gnu.IGNUASTCompoundStatementExpression;
|
import org.eclipse.cdt.core.dom.ast.gnu.IGNUASTCompoundStatementExpression;
|
||||||
|
|
||||||
|
@ -34,4 +35,16 @@ public class CPPASTCompoundStatementExpression extends CPPASTNode implements
|
||||||
this.statement = statement;
|
this.statement = statement;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitExpressions ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( statement != null ) if( !statement.accept( action ) ) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTConditionalExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTConditionalExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||||
|
|
||||||
|
@ -64,4 +65,18 @@ public class CPPASTConditionalExpression extends CPPASTNode implements
|
||||||
this.negative = expression;
|
this.negative = expression;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitExpressions ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( condition != null ) if( !condition.accept( action ) ) return false;
|
||||||
|
if( postive != null ) if( !postive.accept( action ) ) return false;
|
||||||
|
if( negative != null ) if( !negative.accept( action ) ) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConstructorChainInitializer;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConstructorChainInitializer;
|
||||||
|
@ -51,4 +52,9 @@ public class CPPASTConstructorChainInitializer extends CPPASTNode implements
|
||||||
value = expression;
|
value = expression;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( name != null ) if( !name.accept( action ) ) return false;
|
||||||
|
if( value != null ) if( !value.accept( action ) ) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConstructorInitializer;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConstructorInitializer;
|
||||||
|
|
||||||
|
@ -35,4 +36,16 @@ public class CPPASTConstructorInitializer extends CPPASTNode implements
|
||||||
this.exp = expression;
|
this.exp = expression;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitInitializers ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( exp != null ) if( !exp.accept( action ) ) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTContinueStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTContinueStatement;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -18,4 +19,14 @@ import org.eclipse.cdt.core.dom.ast.IASTContinueStatement;
|
||||||
public class CPPASTContinueStatement extends CPPASTNode implements
|
public class CPPASTContinueStatement extends CPPASTNode implements
|
||||||
IASTContinueStatement {
|
IASTContinueStatement {
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitStatements ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTDeclarationStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTDeclarationStatement;
|
||||||
|
|
||||||
|
@ -35,4 +36,15 @@ public class CPPASTDeclarationStatement extends CPPASTNode implements
|
||||||
this.declaration = declaration;
|
this.declaration = declaration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitStatements ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( declaration != null ) if( !declaration.accept( action ) ) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,10 +10,12 @@
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTInitializer;
|
import org.eclipse.cdt.core.dom.ast.IASTInitializer;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTPointerOperator;
|
import org.eclipse.cdt.core.dom.ast.IASTPointerOperator;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author jcamelon
|
* @author jcamelon
|
||||||
|
@ -110,4 +112,33 @@ public class CPPASTDeclarator extends CPPASTNode implements IASTDeclarator {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitDeclarators ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
IASTPointerOperator [] ptrOps = getPointerOperators();
|
||||||
|
for ( int i = 0; i < ptrOps.length; i++ ) {
|
||||||
|
if( !ptrOps[i].accept( action ) ) return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( getPropertyInParent() != IASTTypeId.ABSTRACT_DECLARATOR &&
|
||||||
|
nestedDeclarator == null )
|
||||||
|
{
|
||||||
|
if( name != null ) if( !name.accept( action ) ) return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( nestedDeclarator != null ) if( !nestedDeclarator.accept( action ) ) return false;
|
||||||
|
|
||||||
|
return postAccept( action );
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean postAccept( ASTVisitor action ){
|
||||||
|
if( initializer != null ) if( !initializer.accept( action ) ) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTDefaultStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTDefaultStatement;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -17,5 +18,15 @@ import org.eclipse.cdt.core.dom.ast.IASTDefaultStatement;
|
||||||
*/
|
*/
|
||||||
public class CPPASTDefaultStatement extends CPPASTNode implements
|
public class CPPASTDefaultStatement extends CPPASTNode implements
|
||||||
IASTDefaultStatement {
|
IASTDefaultStatement {
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitStatements ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeleteExpression;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeleteExpression;
|
||||||
|
|
||||||
|
@ -65,4 +66,16 @@ public class CPPASTDeleteExpression extends CPPASTNode implements
|
||||||
return isVectored;
|
return isVectored;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitExpressions ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( operand != null ) if( !operand.accept( action ) ) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTDoStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTDoStatement;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTStatement;
|
||||||
|
@ -49,4 +50,16 @@ public class CPPASTDoStatement extends CPPASTNode implements IASTDoStatement {
|
||||||
this.condition = condition;
|
this.condition = condition;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitStatements ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( body != null ) if( !body.accept( action ) ) return false;
|
||||||
|
if( condition != null ) if( !condition.accept( action ) ) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTElaboratedTypeSpecifier;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTElaboratedTypeSpecifier;
|
||||||
|
|
||||||
|
@ -50,4 +51,15 @@ public class CPPASTElaboratedTypeSpecifier extends CPPASTBaseDeclSpecifier
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitDeclSpecifiers ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( name != null ) if( !name.accept( action ) ) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier;
|
import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeclSpecifier;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeclSpecifier;
|
||||||
|
@ -89,4 +90,19 @@ public class CPPASTEnumerationSpecifier extends CPPASTBaseDeclSpecifier
|
||||||
return getName().toString() == null ? "" : getName().toString(); //$NON-NLS-1$
|
return getName().toString() == null ? "" : getName().toString(); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitDeclSpecifiers ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( name != null ) if( !name.accept( action ) ) return false;
|
||||||
|
IASTEnumerator[] enums = getEnumerators();
|
||||||
|
for( int i = 0; i < enums.length; i++ )
|
||||||
|
if( !enums[i].accept( action ) ) return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator;
|
import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator;
|
||||||
|
@ -49,4 +50,16 @@ public class CPPASTEnumerator extends CPPASTNode implements IASTEnumerator {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitEnumerators ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( name != null ) if( !name.accept( action ) ) return false;
|
||||||
|
if( value != null ) if( !value.accept( action ) ) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTExplicitTemplateInstantiation;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTExplicitTemplateInstantiation;
|
||||||
|
|
||||||
|
@ -35,4 +36,17 @@ public class CPPASTExplicitTemplateInstantiation extends CPPASTNode implements
|
||||||
this.declaration = declaration;
|
this.declaration = declaration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean accept( ASTVisitor action ){
|
||||||
|
if( action.shouldVisitDeclarations ){
|
||||||
|
switch( action.visit( this ) ){
|
||||||
|
case ASTVisitor.PROCESS_ABORT : return false;
|
||||||
|
case ASTVisitor.PROCESS_SKIP : return true;
|
||||||
|
default : break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( declaration != null ) if( !declaration.accept( action ) ) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue