001 /* This file was generated with JastAdd2 (http://jastadd.org) version 2.1.3 */ 002 package AST; 003 004 import java.util.Collection; 005 import java.util.ArrayList; 006 import java.util.HashSet; 007 /** 008 * @ast node 009 * @declaredat /home/csz-naf/examples/PicoJava/spec/picojava.ast:16 010 * @production Dot : {@link Access} ::= <span class="component">ObjectReference:{@link Access}</span> <span class="component">{@link IdUse}</span>; 011 012 */ 013 public class Dot extends Access implements Cloneable { 014 /** 015 * @apilevel internal 016 */ 017 public Dot clone() throws CloneNotSupportedException { 018 Dot node = (Dot) super.clone(); 019 node.decl_visited = -1; 020 node.decl_computed = false; 021 node.decl_value = null; 022 node.type_visited = -1; 023 node.type_computed = false; 024 node.type_value = null; 025 node.isValue_visited = -1; 026 node.in$Circle(false); 027 node.is$Final(false); 028 return node; 029 } 030 /** 031 * @apilevel internal 032 */ 033 public Dot copy() { 034 try { 035 Dot node = (Dot) clone(); 036 node.parent = null; 037 if(children != null) { 038 node.children = (ASTNode[]) children.clone(); 039 } 040 return node; 041 } catch (CloneNotSupportedException e) { 042 throw new Error("Error: clone not supported for " + getClass().getName()); 043 } 044 } 045 /** 046 * Create a deep copy of the AST subtree at this node. 047 * The copy is dangling, i.e. has no parent. 048 * @return dangling copy of the subtree at this node 049 * @apilevel low-level 050 */ 051 public Dot fullCopy() { 052 Dot tree = (Dot) copy(); 053 if (children != null) { 054 for (int i = 0; i < children.length; ++i) { 055 ASTNode child = (ASTNode) children[i]; 056 if(child != null) { 057 child = child.fullCopy(); 058 tree.setChild(child, i); 059 } 060 } 061 } 062 return tree; 063 } 064 /** 065 * @aspect PrettyPrint 066 * @declaredat /home/csz-naf/examples/PicoJava/spec/PrettyPrint.jadd:70 067 */ 068 public String toString() { 069 return getObjectReference() + "." + getIdUse(); 070 } 071 /** 072 */ 073 public Dot() { 074 super(); 075 } 076 /** 077 * Initializes the child array to the correct size. 078 * Initializes List and Opt nta children. 079 * @apilevel internal 080 * @ast method 081 */ 082 public void init$Children() { 083 children = new ASTNode[2]; 084 } 085 /** 086 */ 087 public Dot(Access p0, IdUse p1) { 088 setChild(p0, 0); 089 setChild(p1, 1); 090 } 091 /** 092 * @apilevel low-level 093 */ 094 protected int numChildren() { 095 return 2; 096 } 097 /** 098 * @apilevel internal 099 */ 100 public boolean mayHaveRewrite() { 101 return false; 102 } 103 /** 104 * @apilevel low-level 105 */ 106 public void flushCache() { 107 super.flushCache(); 108 decl_visited = -1; 109 decl_computed = false; 110 decl_value = null; 111 type_visited = -1; 112 type_computed = false; 113 type_value = null; 114 isValue_visited = -1; 115 } 116 /** 117 * @apilevel internal 118 */ 119 public void flushCollectionCache() { 120 super.flushCollectionCache(); 121 } 122 /** 123 * Replaces the ObjectReference child. 124 * @param node The new node to replace the ObjectReference child. 125 * @apilevel high-level 126 */ 127 public void setObjectReference(Access node) { 128 setChild(node, 0); 129 } 130 /** 131 * Retrieves the ObjectReference child. 132 * @return The current node used as the ObjectReference child. 133 * @apilevel high-level 134 */ 135 public Access getObjectReference() { 136 return (Access) getChild(0); 137 } 138 /** 139 * Retrieves the ObjectReference child. 140 * <p><em>This method does not invoke AST transformations.</em></p> 141 * @return The current node used as the ObjectReference child. 142 * @apilevel low-level 143 */ 144 public Access getObjectReferenceNoTransform() { 145 return (Access) getChildNoTransform(0); 146 } 147 /** 148 * Replaces the IdUse child. 149 * @param node The new node to replace the IdUse child. 150 * @apilevel high-level 151 */ 152 public void setIdUse(IdUse node) { 153 setChild(node, 1); 154 } 155 /** 156 * Retrieves the IdUse child. 157 * @return The current node used as the IdUse child. 158 * @apilevel high-level 159 */ 160 public IdUse getIdUse() { 161 return (IdUse) getChild(1); 162 } 163 /** 164 * Retrieves the IdUse child. 165 * <p><em>This method does not invoke AST transformations.</em></p> 166 * @return The current node used as the IdUse child. 167 * @apilevel low-level 168 */ 169 public IdUse getIdUseNoTransform() { 170 return (IdUse) getChildNoTransform(1); 171 } 172 /** 173 * @apilevel internal 174 */ 175 protected int decl_visited = -1; 176 /** 177 * @apilevel internal 178 */ 179 protected boolean decl_computed = false; 180 /** 181 * @apilevel internal 182 */ 183 protected Decl decl_value; 184 /** 185 * @attribute syn 186 * @aspect NameResolution 187 * @declaredat /home/csz-naf/examples/PicoJava/spec/NameResolution.jrag:17 188 */ 189 public Decl decl() { 190 if(decl_computed) { 191 return decl_value; 192 } 193 ASTNode$State state = state(); 194 if (decl_visited == state().boundariesCrossed) { 195 throw new RuntimeException("Circular definition of attr: decl in class: org.jastadd.ast.AST.SynDecl"); 196 } 197 decl_visited = state().boundariesCrossed; 198 int num = state.boundariesCrossed; 199 boolean isFinal = this.is$Final(); 200 decl_value = decl_compute(); 201 if(isFinal && num == state().boundariesCrossed) { 202 decl_computed = true; 203 } else { 204 } 205 206 decl_visited = -1; 207 return decl_value; 208 } 209 /** 210 * @apilevel internal 211 */ 212 private Decl decl_compute() { return getIdUse().decl(); } 213 /** 214 * @apilevel internal 215 */ 216 protected int type_visited = -1; 217 /** 218 * @apilevel internal 219 */ 220 protected boolean type_computed = false; 221 /** 222 * @apilevel internal 223 */ 224 protected TypeDecl type_value; 225 /** 226 * @attribute syn 227 * @aspect TypeAnalysis 228 * @declaredat /home/csz-naf/examples/PicoJava/spec/TypeAnalysis.jrag:37 229 */ 230 public TypeDecl type() { 231 if(type_computed) { 232 return type_value; 233 } 234 ASTNode$State state = state(); 235 if (type_visited == state().boundariesCrossed) { 236 throw new RuntimeException("Circular definition of attr: type in class: org.jastadd.ast.AST.SynDecl"); 237 } 238 type_visited = state().boundariesCrossed; 239 int num = state.boundariesCrossed; 240 boolean isFinal = this.is$Final(); 241 type_value = type_compute(); 242 if(isFinal && num == state().boundariesCrossed) { 243 type_computed = true; 244 } else { 245 } 246 247 type_visited = -1; 248 return type_value; 249 } 250 /** 251 * @apilevel internal 252 */ 253 private TypeDecl type_compute() { return getIdUse().type(); } 254 /** 255 * @apilevel internal 256 */ 257 protected int isValue_visited = -1; 258 /** 259 * @attribute syn 260 * @aspect TypeAnalysis 261 * @declaredat /home/csz-naf/examples/PicoJava/spec/TypeAnalysis.jrag:18 262 */ 263 public boolean isValue() { 264 ASTNode$State state = state(); 265 if (isValue_visited == state().boundariesCrossed) { 266 throw new RuntimeException("Circular definition of attr: isValue in class: org.jastadd.ast.AST.SynDecl"); 267 } 268 isValue_visited = state().boundariesCrossed; 269 try { return getIdUse().isValue(); } 270 finally { 271 isValue_visited = -1; 272 } 273 } 274 /** 275 * @declaredat /home/csz-naf/examples/PicoJava/spec/ErrorCheck.jadd:57 276 * @apilevel internal 277 */ 278 public boolean Define_boolean_isQualified(ASTNode caller, ASTNode child) { 279 if (caller == getIdUseNoTransform()) { 280 return true; 281 } 282 else { 283 return getParent().Define_boolean_isQualified(this, caller); 284 } 285 } 286 /** 287 * @declaredat /home/csz-naf/examples/PicoJava/spec/ErrorCheck.jadd:67 288 * @apilevel internal 289 */ 290 public Access Define_Access_qualifier(ASTNode caller, ASTNode child) { 291 if (caller == getIdUseNoTransform()) { 292 return getObjectReference(); 293 } 294 else { 295 return getParent().Define_Access_qualifier(this, caller); 296 } 297 } 298 /** 299 * @declaredat /home/csz-naf/examples/PicoJava/spec/NameResolution.jrag:55 300 * @apilevel internal 301 */ 302 public Decl Define_Decl_lookup(ASTNode caller, ASTNode child, String name) { 303 if (caller == getIdUseNoTransform()) { 304 return // Do a remote lookup on the object's type. 305 getObjectReference().decl().type().remoteLookup(name); 306 } 307 else { 308 return getParent().Define_Decl_lookup(this, caller, name); 309 } 310 } 311 /** 312 * @apilevel internal 313 */ 314 public ASTNode rewriteTo() { return super.rewriteTo(); 315 }}