001 /* This file was generated with JastAdd2 (http://jastadd.org) version R20130213 */ 002 package AST; 003 004 import java.util.HashSet; 005 import java.io.File; 006 import java.util.*; 007 import beaver.*; 008 import java.util.ArrayList; 009 import java.util.zip.*; 010 import java.io.*; 011 import java.io.FileNotFoundException; 012 import java.util.Collection; 013 /** 014 * @production SuperAccess : {@link Access} ::= <span class="component"><ID:String></span>; 015 * @ast node 016 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/java.ast:28 017 */ 018 public class SuperAccess extends Access implements Cloneable { 019 /** 020 * @apilevel low-level 021 */ 022 public void flushCache() { 023 } 024 /** 025 * @apilevel internal 026 */ 027 public void flushCollectionCache() { 028 } 029 /** 030 * @apilevel internal 031 */ 032 @SuppressWarnings({"unchecked", "cast"}) 033 public SuperAccess clone() throws CloneNotSupportedException { 034 SuperAccess node = (SuperAccess)super.clone(); 035 node.decl_computed = false; 036 node.decl_value = null; 037 node.type_computed = false; 038 node.type_value = null; 039 node.in$Circle(false); 040 node.is$Final(false); 041 return node; 042 } 043 /** 044 * @apilevel internal 045 */ 046 @SuppressWarnings({"unchecked", "cast"}) 047 public SuperAccess copy() { 048 049 try { 050 SuperAccess node = (SuperAccess) clone(); 051 node.parent = null; 052 if(children != null) 053 node.children = (ASTNode[]) children.clone(); 054 055 return node; 056 } catch (CloneNotSupportedException e) { 057 throw new Error("Error: clone not supported for " + getClass().getName()); 058 } 059 060 }/** 061 * Create a deep copy of the AST subtree at this node. 062 * The copy is dangling, i.e. has no parent. 063 * @return dangling copy of the subtree at this node 064 * @apilevel low-level 065 */ 066 @SuppressWarnings({"unchecked", "cast"}) 067 public SuperAccess fullCopy() { 068 069 SuperAccess tree = (SuperAccess) copy(); 070 if (children != null) { 071 for (int i = 0; i < children.length; ++i) { 072 073 ASTNode child = (ASTNode) children[i]; 074 if(child != null) { 075 child = child.fullCopy(); 076 tree.setChild(child, i); 077 } 078 } 079 } 080 return tree; 081 082 } /** 083 * @ast method 084 * @aspect PrettyPrint 085 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/PrettyPrint.jadd:506 086 */ 087 public void toString(StringBuffer s) { 088 s.append("super"); 089 } 090 /** 091 * @ast method 092 * @aspect TypeHierarchyCheck 093 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/TypeHierarchyCheck.jrag:87 094 */ 095 public void nameCheck() { 096 if(isQualified()) { 097 if(!hostType().isInnerTypeOf(decl()) && hostType() != decl()) 098 error("qualified super must name an enclosing type"); 099 if(inStaticContext()) { 100 error("*** Qualified super may not occur in static context"); 101 } 102 } 103 // 8.8.5.1 104 if(inExplicitConstructorInvocation() && hostType().instanceOf(decl().hostType()) ) 105 error("super may not be accessed in an explicit constructor invocation"); 106 // 8.4.3.2 107 if(inStaticContext()) 108 error("super may not be accessed in a static context"); 109 } 110 /** 111 * @ast method 112 * @aspect CreateBCode 113 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Backend/CreateBCode.jrag:573 114 */ 115 public void createBCode(CodeGeneration gen) { 116 emitThis(gen, decl()); 117 } 118 /** 119 * @ast method 120 * 121 */ 122 public SuperAccess() { 123 super(); 124 125 126 } 127 /** 128 * Initializes the child array to the correct size. 129 * Initializes List and Opt nta children. 130 * @apilevel internal 131 * @ast method 132 * @ast method 133 * 134 */ 135 public void init$Children() { 136 } 137 /** 138 * @ast method 139 * 140 */ 141 public SuperAccess(String p0) { 142 setID(p0); 143 } 144 /** 145 * @ast method 146 * 147 */ 148 public SuperAccess(beaver.Symbol p0) { 149 setID(p0); 150 } 151 /** 152 * @apilevel low-level 153 * @ast method 154 * 155 */ 156 protected int numChildren() { 157 return 0; 158 } 159 /** 160 * @apilevel internal 161 * @ast method 162 * 163 */ 164 public boolean mayHaveRewrite() { 165 return false; 166 } 167 /** 168 * Replaces the lexeme ID. 169 * @param value The new value for the lexeme ID. 170 * @apilevel high-level 171 * @ast method 172 * 173 */ 174 public void setID(String value) { 175 tokenString_ID = value; 176 } 177 /** 178 * @apilevel internal 179 * @ast method 180 * 181 */ 182 183 /** 184 * @apilevel internal 185 */ 186 protected String tokenString_ID; 187 /** 188 * @ast method 189 * 190 */ 191 192 public int IDstart; 193 /** 194 * @ast method 195 * 196 */ 197 198 public int IDend; 199 /** 200 * JastAdd-internal setter for lexeme ID using the Beaver parser. 201 * @apilevel internal 202 * @ast method 203 * 204 */ 205 public void setID(beaver.Symbol symbol) { 206 if(symbol.value != null && !(symbol.value instanceof String)) 207 throw new UnsupportedOperationException("setID is only valid for String lexemes"); 208 tokenString_ID = (String)symbol.value; 209 IDstart = symbol.getStart(); 210 IDend = symbol.getEnd(); 211 } 212 /** 213 * Retrieves the value for the lexeme ID. 214 * @return The value for the lexeme ID. 215 * @apilevel high-level 216 * @ast method 217 * 218 */ 219 public String getID() { 220 return tokenString_ID != null ? tokenString_ID : ""; 221 } 222 /** 223 * @ast method 224 * @aspect TypeScopePropagation 225 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/LookupType.jrag:251 226 */ 227 private TypeDecl refined_TypeScopePropagation_SuperAccess_decl() 228 { return isQualified() ? qualifier().type() : hostType(); } 229 /** 230 * @attribute syn 231 * @aspect TypeScopePropagation 232 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/LookupType.jrag:249 233 */ 234 public SimpleSet decls() { 235 ASTNode$State state = state(); 236 try { return SimpleSet.emptySet; } 237 finally { 238 } 239 } 240 /** 241 * @apilevel internal 242 */ 243 protected boolean decl_computed = false; 244 /** 245 * @apilevel internal 246 */ 247 protected TypeDecl decl_value; 248 /** 249 * @attribute syn 250 * @aspect GenericsTypeAnalysis 251 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/Generics.jrag:326 252 */ 253 @SuppressWarnings({"unchecked", "cast"}) 254 public TypeDecl decl() { 255 if(decl_computed) { 256 return decl_value; 257 } 258 ASTNode$State state = state(); 259 int num = state.boundariesCrossed; 260 boolean isFinal = this.is$Final(); 261 decl_value = decl_compute(); 262 if(isFinal && num == state().boundariesCrossed){ decl_computed = true; } 263 return decl_value; 264 } 265 /** 266 * @apilevel internal 267 */ 268 private TypeDecl decl_compute() { 269 TypeDecl typeDecl = refined_TypeScopePropagation_SuperAccess_decl(); 270 if(typeDecl instanceof ParTypeDecl) 271 typeDecl = ((ParTypeDecl)typeDecl).genericDecl(); 272 return typeDecl; 273 } 274 /** 275 * @attribute syn 276 * @aspect AccessTypes 277 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/ResolveAmbiguousNames.jrag:25 278 */ 279 public boolean isSuperAccess() { 280 ASTNode$State state = state(); 281 try { return true; } 282 finally { 283 } 284 } 285 /** 286 * @attribute syn 287 * @aspect SyntacticClassification 288 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/SyntacticClassification.jrag:56 289 */ 290 public NameType predNameType() { 291 ASTNode$State state = state(); 292 try { return NameType.TYPE_NAME; } 293 finally { 294 } 295 } 296 /** 297 * @apilevel internal 298 */ 299 protected boolean type_computed = false; 300 /** 301 * @apilevel internal 302 */ 303 protected TypeDecl type_value; 304 /** 305 * @attribute syn 306 * @aspect TypeAnalysis 307 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/TypeAnalysis.jrag:288 308 */ 309 @SuppressWarnings({"unchecked", "cast"}) 310 public TypeDecl type() { 311 if(type_computed) { 312 return type_value; 313 } 314 ASTNode$State state = state(); 315 int num = state.boundariesCrossed; 316 boolean isFinal = this.is$Final(); 317 type_value = type_compute(); 318 if(isFinal && num == state().boundariesCrossed){ type_computed = true; } 319 return type_value; 320 } 321 /** 322 * @apilevel internal 323 */ 324 private TypeDecl type_compute() { 325 TypeDecl typeDecl = decl(); 326 if(!typeDecl.isClassDecl()) 327 return unknownType(); 328 ClassDecl classDecl = (ClassDecl)typeDecl; 329 if(!classDecl.hasSuperclass()) 330 return unknownType(); 331 return classDecl.superclass(); 332 } 333 /** 334 * @attribute inh 335 * @aspect TypeHierarchyCheck 336 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/TypeHierarchyCheck.jrag:124 337 */ 338 @SuppressWarnings({"unchecked", "cast"}) 339 public boolean inExplicitConstructorInvocation() { 340 ASTNode$State state = state(); 341 boolean inExplicitConstructorInvocation_value = getParent().Define_boolean_inExplicitConstructorInvocation(this, null); 342 return inExplicitConstructorInvocation_value; 343 } 344 /** 345 * @apilevel internal 346 */ 347 public ASTNode rewriteTo() { 348 return super.rewriteTo(); 349 } 350 }