1 11 package org.eclipse.jdt.internal.compiler.ast; 12 13 import org.eclipse.jdt.internal.compiler.ASTVisitor; 14 import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; 15 import org.eclipse.jdt.internal.compiler.impl.Constant; 16 import org.eclipse.jdt.internal.compiler.lookup.*; 17 18 public class JavadocArgumentExpression extends Expression { 19 public char[] token; 20 public Argument argument; 21 22 public JavadocArgumentExpression(char[] name, int startPos, int endPos, TypeReference typeRef) { 23 this.token = name; 24 this.sourceStart = startPos; 25 this.sourceEnd = endPos; 26 long pos = (((long) startPos) << 32) + endPos; 27 this.argument = new Argument(name, pos, typeRef, ClassFileConstants.AccDefault); 28 this.bits |= InsideJavadoc; 29 } 30 31 34 private TypeBinding internalResolveType(Scope scope) { 35 this.constant = Constant.NotAConstant; 36 if (this.resolvedType != null) return this.resolvedType.isValidBinding() ? this.resolvedType : null; 39 if (this.argument != null) { 40 TypeReference typeRef = this.argument.type; 41 if (typeRef != null) { 42 this.resolvedType = typeRef.getTypeBinding(scope); 43 typeRef.resolvedType = this.resolvedType; 44 if (!this.resolvedType.isValidBinding()) { 45 scope.problemReporter().javadocInvalidType(typeRef, this.resolvedType, scope.getDeclarationModifiers()); 46 return null; 47 } 48 if (isTypeUseDeprecated(this.resolvedType, scope)) { 49 scope.problemReporter().javadocDeprecatedType(this.resolvedType, typeRef, scope.getDeclarationModifiers()); 50 } 51 return this.resolvedType = scope.environment().convertToRawType(this.resolvedType); 52 } 53 } 54 return null; 55 } 56 57 public StringBuffer printExpression(int indent, StringBuffer output) { 58 if (this.argument == null) { 59 if (this.token != null) { 60 output.append(this.token); 61 } 62 } 63 else { 64 this.argument.print(indent, output); 65 } 66 return output; 67 } 68 69 public void resolve(BlockScope scope) { 70 if (this.argument != null) { 71 this.argument.resolve(scope); 72 } 73 } 74 75 public TypeBinding resolveType(BlockScope scope) { 76 return internalResolveType(scope); 77 } 78 79 public TypeBinding resolveType(ClassScope scope) { 80 return internalResolveType(scope); 81 } 82 83 87 public void traverse(ASTVisitor visitor, BlockScope blockScope) { 88 if (visitor.visit(this, blockScope)) { 89 if (this.argument != null) { 90 this.argument.traverse(visitor, blockScope); 91 } 92 } 93 visitor.endVisit(this, blockScope); 94 } 95 public void traverse(ASTVisitor visitor, ClassScope blockScope) { 96 if (visitor.visit(this, blockScope)) { 97 if (this.argument != null) { 98 this.argument.traverse(visitor, blockScope); 99 } 100 } 101 visitor.endVisit(this, blockScope); 102 } 103 } 104 | Popular Tags |