1 11 package org.eclipse.jdt.internal.compiler.ast; 12 13 import org.eclipse.jdt.internal.compiler.flow.FlowContext; 14 import org.eclipse.jdt.internal.compiler.flow.FlowInfo; 15 import org.eclipse.jdt.internal.compiler.lookup.BlockScope; 16 import org.eclipse.jdt.internal.compiler.lookup.InvocationSite; 17 import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; 18 import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; 19 20 public abstract class AbstractVariableDeclaration extends Statement implements InvocationSite { 21 public int declarationEnd; 22 public int declarationSourceEnd; 23 public int declarationSourceStart; 24 public int hiddenVariableDepth; public Expression initialization; 26 public int modifiers; 27 public int modifiersSourceStart; 28 public Annotation[] annotations; 29 30 public char[] name; 31 32 public TypeReference type; 33 34 public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) { 35 return flowInfo; 36 } 37 38 public static final int FIELD = 1; 39 public static final int INITIALIZER = 2; 40 public static final int ENUM_CONSTANT = 3; 41 public static final int LOCAL_VARIABLE = 4; 42 public static final int PARAMETER = 5; 43 public static final int TYPE_PARAMETER = 6; 44 45 46 49 public TypeBinding[] genericTypeArguments() { 50 return null; 51 } 52 53 56 public abstract int getKind(); 57 58 61 public boolean isSuperAccess() { 62 return false; 63 } 64 65 68 public boolean isTypeAccess() { 69 return false; 70 } 71 72 public StringBuffer printStatement(int indent, StringBuffer output) { 73 printAsExpression(indent, output); 74 switch(getKind()) { 75 case ENUM_CONSTANT: 76 return output.append(','); 77 default: 78 return output.append(';'); 79 } 80 } 81 82 public StringBuffer printAsExpression(int indent, StringBuffer output) { 83 printIndent(indent, output); 84 printModifiers(this.modifiers, output); 85 if (this.annotations != null) printAnnotations(this.annotations, output); 86 87 if (type != null) { 88 type.print(0, output).append(' '); 89 } 90 output.append(this.name); 91 switch(getKind()) { 92 case ENUM_CONSTANT: 93 if (initialization != null) { 94 initialization.printExpression(indent, output); 95 } 96 break; 97 default: 98 if (initialization != null) { 99 output.append(" = "); initialization.printExpression(indent, output); 101 } 102 } 103 return output; 104 } 105 106 public void resolve(BlockScope scope) { 107 } 109 110 113 public void setActualReceiverType(ReferenceBinding receiverType) { 114 } 116 117 120 public void setDepth(int depth) { 121 122 this.hiddenVariableDepth = depth; 123 } 124 125 128 public void setFieldIndex(int depth) { 129 } 131 } 132 | Popular Tags |