1 /*******************************************************************************
2 * Copyright (c) 2000, 2003 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Common Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/cpl-v10.html
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11 package net.sourceforge.phpdt.internal.compiler;
13 import net.sourceforge.phpdt.core.compiler.IProblem;
14 import net.sourceforge.phpdt.internal.compiler.ast.AND_AND_Expression;
15 import net.sourceforge.phpdt.internal.compiler.ast.AllocationExpression;
16 import net.sourceforge.phpdt.internal.compiler.ast.AnonymousLocalTypeDeclaration;
17 import net.sourceforge.phpdt.internal.compiler.ast.Argument;
18 import net.sourceforge.phpdt.internal.compiler.ast.ArrayAllocationExpression;
19 import net.sourceforge.phpdt.internal.compiler.ast.ArrayInitializer;
20 import net.sourceforge.phpdt.internal.compiler.ast.ArrayQualifiedTypeReference;
21 import net.sourceforge.phpdt.internal.compiler.ast.ArrayReference;
22 import net.sourceforge.phpdt.internal.compiler.ast.ArrayTypeReference;
23 import net.sourceforge.phpdt.internal.compiler.ast.AssertStatement;
24 import net.sourceforge.phpdt.internal.compiler.ast.Assignment;
25 import net.sourceforge.phpdt.internal.compiler.ast.BinaryExpression;
26 import net.sourceforge.phpdt.internal.compiler.ast.Block;
27 import net.sourceforge.phpdt.internal.compiler.ast.BreakStatement;
28 import net.sourceforge.phpdt.internal.compiler.ast.CaseStatement;
29 import net.sourceforge.phpdt.internal.compiler.ast.CastExpression;
30 import net.sourceforge.phpdt.internal.compiler.ast.Clinit;
31 import net.sourceforge.phpdt.internal.compiler.ast.CompilationUnitDeclaration;
32 import net.sourceforge.phpdt.internal.compiler.ast.CompoundAssignment;
33 import net.sourceforge.phpdt.internal.compiler.ast.ConditionalExpression;
34 import net.sourceforge.phpdt.internal.compiler.ast.ConstructorDeclaration;
35 import net.sourceforge.phpdt.internal.compiler.ast.ContinueStatement;
36 import net.sourceforge.phpdt.internal.compiler.ast.DefaultCase;
37 import net.sourceforge.phpdt.internal.compiler.ast.DoStatement;
38 import net.sourceforge.phpdt.internal.compiler.ast.DoubleLiteral;
39 import net.sourceforge.phpdt.internal.compiler.ast.EmptyStatement;
40 import net.sourceforge.phpdt.internal.compiler.ast.EqualExpression;
41 import net.sourceforge.phpdt.internal.compiler.ast.ExplicitConstructorCall;
42 import net.sourceforge.phpdt.internal.compiler.ast.ExtendedStringLiteral;
43 import net.sourceforge.phpdt.internal.compiler.ast.FalseLiteral;
44 import net.sourceforge.phpdt.internal.compiler.ast.FieldDeclaration;
45 import net.sourceforge.phpdt.internal.compiler.ast.FieldReference;
46 import net.sourceforge.phpdt.internal.compiler.ast.FloatLiteral;
47 import net.sourceforge.phpdt.internal.compiler.ast.ForStatement;
48 import net.sourceforge.phpdt.internal.compiler.ast.IfStatement;
49 import net.sourceforge.phpdt.internal.compiler.ast.ImportReference;
50 import net.sourceforge.phpdt.internal.compiler.ast.Initializer;
51 import net.sourceforge.phpdt.internal.compiler.ast.InstanceOfExpression;
52 import net.sourceforge.phpdt.internal.compiler.ast.IntLiteral;
53 import net.sourceforge.phpdt.internal.compiler.ast.LabeledStatement;
54 import net.sourceforge.phpdt.internal.compiler.ast.LocalDeclaration;
55 import net.sourceforge.phpdt.internal.compiler.ast.LocalTypeDeclaration;
56 import net.sourceforge.phpdt.internal.compiler.ast.LongLiteral;
57 import net.sourceforge.phpdt.internal.compiler.ast.MemberTypeDeclaration;
58 import net.sourceforge.phpdt.internal.compiler.ast.MessageSend;
59 import net.sourceforge.phpdt.internal.compiler.ast.MethodDeclaration;
60 import net.sourceforge.phpdt.internal.compiler.ast.NullLiteral;
61 import net.sourceforge.phpdt.internal.compiler.ast.OR_OR_Expression;
62 import net.sourceforge.phpdt.internal.compiler.ast.PostfixExpression;
63 import net.sourceforge.phpdt.internal.compiler.ast.PrefixExpression;
64 import net.sourceforge.phpdt.internal.compiler.ast.QualifiedAllocationExpression;
65 import net.sourceforge.phpdt.internal.compiler.ast.QualifiedNameReference;
66 import net.sourceforge.phpdt.internal.compiler.ast.QualifiedSuperReference;
67 import net.sourceforge.phpdt.internal.compiler.ast.QualifiedThisReference;
68 import net.sourceforge.phpdt.internal.compiler.ast.QualifiedTypeReference;
69 import net.sourceforge.phpdt.internal.compiler.ast.ReturnStatement;
70 import net.sourceforge.phpdt.internal.compiler.ast.SingleNameReference;
71 import net.sourceforge.phpdt.internal.compiler.ast.SingleTypeReference;
72 import net.sourceforge.phpdt.internal.compiler.ast.StringLiteral;
73 import net.sourceforge.phpdt.internal.compiler.ast.SuperReference;
74 import net.sourceforge.phpdt.internal.compiler.ast.SwitchStatement;
75 import net.sourceforge.phpdt.internal.compiler.ast.ThisReference;
76 import net.sourceforge.phpdt.internal.compiler.ast.ThrowStatement;
77 import net.sourceforge.phpdt.internal.compiler.ast.TrueLiteral;
78 import net.sourceforge.phpdt.internal.compiler.ast.TryStatement;
79 import net.sourceforge.phpdt.internal.compiler.ast.TypeDeclaration;
80 import net.sourceforge.phpdt.internal.compiler.ast.UnaryExpression;
81 import net.sourceforge.phpdt.internal.compiler.ast.WhileStatement;
82 import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
83 import net.sourceforge.phpdt.internal.compiler.lookup.ClassScope;
84 import net.sourceforge.phpdt.internal.compiler.lookup.CompilationUnitScope;
85 import net.sourceforge.phpdt.internal.compiler.lookup.MethodScope;
88 * An adapter class for interating through the parse tree.
91 public class AbstractSyntaxTreeVisitorAdapter implements
92 IAbstractSyntaxTreeVisitor {
94 public void acceptProblem(IProblem problem) {
97 public void endVisit(AllocationExpression allocationExpression,
101 public void endVisit(AND_AND_Expression and_and_Expression, BlockScope scope) {
104 public void endVisit(
105 AnonymousLocalTypeDeclaration anonymousTypeDeclaration,
109 public void endVisit(Argument argument, BlockScope scope) {
112 public void endVisit(ArrayAllocationExpression arrayAllocationExpression,
116 public void endVisit(ArrayInitializer arrayInitializer, BlockScope scope) {
119 public void endVisit(
120 ArrayQualifiedTypeReference arrayQualifiedTypeReference,
124 public void endVisit(
125 ArrayQualifiedTypeReference arrayQualifiedTypeReference,
129 public void endVisit(ArrayReference arrayReference, BlockScope scope) {
132 public void endVisit(ArrayTypeReference arrayTypeReference, BlockScope scope) {
135 public void endVisit(ArrayTypeReference arrayTypeReference, ClassScope scope) {
138 public void endVisit(Assignment assignment, BlockScope scope) {
141 public void endVisit(AssertStatement assertStatement, BlockScope scope) {
144 public void endVisit(BinaryExpression binaryExpression, BlockScope scope) {
147 public void endVisit(Block block, BlockScope scope) {
150 public void endVisit(BreakStatement breakStatement, BlockScope scope) {
153 public void endVisit(CaseStatement caseStatement, BlockScope scope) {
156 public void endVisit(CastExpression castExpression, BlockScope scope) {
159 public void endVisit(Clinit clinit, ClassScope scope) {
162 public void endVisit(CompilationUnitDeclaration compilationUnitDeclaration,
163 CompilationUnitScope scope) {
166 public void endVisit(CompoundAssignment compoundAssignment, BlockScope scope) {
169 public void endVisit(ConditionalExpression conditionalExpression,
173 public void endVisit(ConstructorDeclaration constructorDeclaration,
177 public void endVisit(ContinueStatement continueStatement, BlockScope scope) {
180 public void endVisit(DefaultCase defaultCaseStatement, BlockScope scope) {
183 public void endVisit(DoStatement doStatement, BlockScope scope) {
186 public void endVisit(DoubleLiteral doubleLiteral, BlockScope scope) {
189 public void endVisit(EqualExpression equalExpression, BlockScope scope) {
192 public void endVisit(ExplicitConstructorCall explicitConstructor,
196 public void endVisit(ExtendedStringLiteral extendedStringLiteral,
200 public void endVisit(FalseLiteral falseLiteral, BlockScope scope) {
203 public void endVisit(FieldDeclaration fieldDeclaration, MethodScope scope) {
206 public void endVisit(FieldReference fieldReference, BlockScope scope) {
209 public void endVisit(FloatLiteral floatLiteral, BlockScope scope) {
212 public void endVisit(EmptyStatement emptyStatement, BlockScope scope) {
215 public void endVisit(ForStatement forStatement, BlockScope scope) {
218 public void endVisit(IfStatement ifStatement, BlockScope scope) {
221 public void endVisit(ImportReference importRef, CompilationUnitScope scope) {
224 public void endVisit(Initializer initializer, MethodScope scope) {
227 public void endVisit(InstanceOfExpression instanceOfExpression,
231 public void endVisit(IntLiteral intLiteral, BlockScope scope) {
234 public void endVisit(LabeledStatement labeledStatement, BlockScope scope) {
237 public void endVisit(LocalDeclaration localDeclaration, BlockScope scope) {
240 public void endVisit(LongLiteral longLiteral, BlockScope scope) {
243 public void endVisit(MemberTypeDeclaration memberTypeDeclaration,
247 public void endVisit(MessageSend messageSend, BlockScope scope) {
250 public void endVisit(MethodDeclaration methodDeclaration, ClassScope scope) {
253 public void endVisit(NullLiteral nullLiteral, BlockScope scope) {
256 public void endVisit(OR_OR_Expression or_or_Expression, BlockScope scope) {
259 public void endVisit(PostfixExpression postfixExpression, BlockScope scope) {
262 public void endVisit(PrefixExpression prefixExpression, BlockScope scope) {
265 public void endVisit(
266 QualifiedAllocationExpression qualifiedAllocationExpression,
270 public void endVisit(QualifiedNameReference qualifiedNameReference,
274 public void endVisit(QualifiedSuperReference qualifiedSuperReference,
278 public void endVisit(QualifiedThisReference qualifiedThisReference,
282 public void endVisit(QualifiedTypeReference qualifiedTypeReference,
286 public void endVisit(QualifiedTypeReference qualifiedTypeReference,
290 public void endVisit(ReturnStatement returnStatement, BlockScope scope) {
293 public void endVisit(SingleNameReference singleNameReference,
297 public void endVisit(SingleTypeReference singleTypeReference,
301 public void endVisit(SingleTypeReference singleTypeReference,
305 public void endVisit(StringLiteral stringLiteral, BlockScope scope) {
308 public void endVisit(SuperReference superReference, BlockScope scope) {
311 public void endVisit(SwitchStatement switchStatement, BlockScope scope) {
314 public void endVisit(ThisReference thisReference, BlockScope scope) {
317 public void endVisit(ThrowStatement throwStatement, BlockScope scope) {
320 public void endVisit(TrueLiteral trueLiteral, BlockScope scope) {
323 public void endVisit(TryStatement tryStatement, BlockScope scope) {
326 public void endVisit(TypeDeclaration typeDeclaration,
327 CompilationUnitScope scope) {
330 public void endVisit(UnaryExpression unaryExpression, BlockScope scope) {
333 public void endVisit(WhileStatement whileStatement, BlockScope scope) {
336 public boolean visit(AllocationExpression allocationExpression,
341 public boolean visit(AND_AND_Expression and_and_Expression, BlockScope scope) {
345 public boolean visit(
346 AnonymousLocalTypeDeclaration anonymousTypeDeclaration,
351 public boolean visit(Argument argument, BlockScope scope) {
355 public boolean visit(ArrayAllocationExpression arrayAllocationExpression,
360 public boolean visit(ArrayInitializer arrayInitializer, BlockScope scope) {
364 public boolean visit(
365 ArrayQualifiedTypeReference arrayQualifiedTypeReference,
370 public boolean visit(
371 ArrayQualifiedTypeReference arrayQualifiedTypeReference,
376 public boolean visit(ArrayReference arrayReference, BlockScope scope) {
380 public boolean visit(ArrayTypeReference arrayTypeReference, BlockScope scope) {
384 public boolean visit(ArrayTypeReference arrayTypeReference, ClassScope scope) {
388 public boolean visit(Assignment assignment, BlockScope scope) {
392 public boolean visit(AssertStatement assertStatement, BlockScope scope) {
396 public boolean visit(BinaryExpression binaryExpression, BlockScope scope) {
400 public boolean visit(Block block, BlockScope scope) {
404 public boolean visit(BreakStatement breakStatement, BlockScope scope) {
408 public boolean visit(CaseStatement caseStatement, BlockScope scope) {
412 public boolean visit(CastExpression castExpression, BlockScope scope) {
416 public boolean visit(Clinit clinit, ClassScope scope) {
420 public boolean visit(CompilationUnitDeclaration compilationUnitDeclaration,
421 CompilationUnitScope scope) {
425 public boolean visit(CompoundAssignment compoundAssignment, BlockScope scope) {
429 public boolean visit(ConditionalExpression conditionalExpression,
434 public boolean visit(ConstructorDeclaration constructorDeclaration,
439 public boolean visit(ContinueStatement continueStatement, BlockScope scope) {
443 public boolean visit(DefaultCase defaultCaseStatement, BlockScope scope) {
447 public boolean visit(DoStatement doStatement, BlockScope scope) {
451 public boolean visit(DoubleLiteral doubleLiteral, BlockScope scope) {
455 public boolean visit(EqualExpression equalExpression, BlockScope scope) {
459 public boolean visit(EmptyStatement emptyStatement, BlockScope scope) {
463 public boolean visit(ExplicitConstructorCall explicitConstructor,
468 public boolean visit(ExtendedStringLiteral extendedStringLiteral,
473 public boolean visit(FalseLiteral falseLiteral, BlockScope scope) {
477 public boolean visit(FieldDeclaration fieldDeclaration, MethodScope scope) {
481 public boolean visit(FieldReference fieldReference, BlockScope scope) {
485 public boolean visit(FloatLiteral floatLiteral, BlockScope scope) {
489 public boolean visit(ForStatement forStatement, BlockScope scope) {
493 public boolean visit(IfStatement ifStatement, BlockScope scope) {
497 public boolean visit(ImportReference importRef, CompilationUnitScope scope) {
501 public boolean visit(Initializer initializer, MethodScope scope) {
505 public boolean visit(InstanceOfExpression instanceOfExpression,
510 public boolean visit(IntLiteral intLiteral, BlockScope scope) {
514 public boolean visit(LabeledStatement labeledStatement, BlockScope scope) {
518 public boolean visit(LocalDeclaration localDeclaration, BlockScope scope) {
522 public boolean visit(LongLiteral longLiteral, BlockScope scope) {
526 public boolean visit(MemberTypeDeclaration memberTypeDeclaration,
531 public boolean visit(MessageSend messageSend, BlockScope scope) {
535 public boolean visit(MethodDeclaration methodDeclaration, ClassScope scope) {
539 public boolean visit(NullLiteral nullLiteral, BlockScope scope) {
543 public boolean visit(OR_OR_Expression or_or_Expression, BlockScope scope) {
547 public boolean visit(PostfixExpression postfixExpression, BlockScope scope) {
551 public boolean visit(PrefixExpression prefixExpression, BlockScope scope) {
555 public boolean visit(
556 QualifiedAllocationExpression qualifiedAllocationExpression,
561 public boolean visit(QualifiedNameReference qualifiedNameReference,
566 public boolean visit(QualifiedSuperReference qualifiedSuperReference,
571 public boolean visit(QualifiedThisReference qualifiedThisReference,
576 public boolean visit(QualifiedTypeReference qualifiedTypeReference,
581 public boolean visit(QualifiedTypeReference qualifiedTypeReference,
586 public boolean visit(ReturnStatement returnStatement, BlockScope scope) {
590 public boolean visit(SingleNameReference singleNameReference,
595 public boolean visit(SingleTypeReference singleTypeReference,
600 public boolean visit(SingleTypeReference singleTypeReference,
605 public boolean visit(StringLiteral stringLiteral, BlockScope scope) {
609 public boolean visit(SuperReference superReference, BlockScope scope) {
613 public boolean visit(SwitchStatement switchStatement, BlockScope scope) {
617 public boolean visit(ThisReference thisReference, BlockScope scope) {
621 public boolean visit(ThrowStatement throwStatement, BlockScope scope) {
625 public boolean visit(TrueLiteral trueLiteral, BlockScope scope) {
629 public boolean visit(TryStatement tryStatement, BlockScope scope) {
633 public boolean visit(TypeDeclaration typeDeclaration,
634 CompilationUnitScope scope) {
638 public boolean visit(UnaryExpression unaryExpression, BlockScope scope) {
642 public boolean visit(WhileStatement whileStatement, BlockScope scope) {
646 public boolean visit(LocalTypeDeclaration localTypeDeclaration,
651 public void endVisit(LocalTypeDeclaration localTypeDeclaration,