001 /* This file was generated with JastAdd2 (http://jastadd.org) version 2.1.13-12-g880e696 */ 002 package org.extendj.ast; 003 004 import java.util.HashSet; 005 import java.io.File; 006 import java.util.Set; 007 import java.util.Collections; 008 import java.util.Collection; 009 import java.util.ArrayList; 010 import beaver.*; 011 import java.util.*; 012 import java.io.ByteArrayOutputStream; 013 import java.io.PrintStream; 014 import java.lang.reflect.InvocationTargetException; 015 import java.lang.reflect.Method; 016 import org.jastadd.util.*; 017 import java.util.zip.*; 018 import java.io.*; 019 import org.jastadd.util.PrettyPrintable; 020 import org.jastadd.util.PrettyPrinter; 021 import java.io.FileNotFoundException; 022 import java.io.BufferedInputStream; 023 import java.io.DataInputStream; 024 /** 025 * @ast node 026 * @declaredat /home/jesper/git/extendj/java4/grammar/BoundNames.ast:6 027 * @production BoundFieldAccess : {@link VarAccess} ::= <span class="component"><FieldDeclaration:FieldDeclaration></span>; 028 029 */ 030 public class BoundFieldAccess extends VarAccess implements Cloneable { 031 /** 032 * @aspect BoundNames 033 * @declaredat /home/jesper/git/extendj/java4/frontend/BoundNames.jrag:88 034 */ 035 public BoundFieldAccess(FieldDeclaration f) { 036 this(f.name(), f); 037 } 038 /** 039 * @aspect BoundNames 040 * @declaredat /home/jesper/git/extendj/java4/frontend/BoundNames.jrag:93 041 */ 042 public boolean isExactVarAccess() { 043 return false; 044 } 045 /** 046 * @declaredat ASTNode:1 047 */ 048 public BoundFieldAccess() { 049 super(); 050 } 051 /** 052 * Initializes the child array to the correct size. 053 * Initializes List and Opt nta children. 054 * @apilevel internal 055 * @ast method 056 * @declaredat ASTNode:10 057 */ 058 public void init$Children() { 059 } 060 /** 061 * @declaredat ASTNode:12 062 */ 063 public BoundFieldAccess(String p0, FieldDeclaration p1) { 064 setID(p0); 065 setFieldDeclaration(p1); 066 } 067 /** 068 * @declaredat ASTNode:16 069 */ 070 public BoundFieldAccess(beaver.Symbol p0, FieldDeclaration p1) { 071 setID(p0); 072 setFieldDeclaration(p1); 073 } 074 /** 075 * @apilevel low-level 076 * @declaredat ASTNode:23 077 */ 078 protected int numChildren() { 079 return 0; 080 } 081 /** 082 * @apilevel internal 083 * @declaredat ASTNode:29 084 */ 085 public boolean mayHaveRewrite() { 086 return false; 087 } 088 /** 089 * @apilevel internal 090 * @declaredat ASTNode:35 091 */ 092 public void flushAttrCache() { 093 super.flushAttrCache(); 094 decl_reset(); 095 } 096 /** 097 * @apilevel internal 098 * @declaredat ASTNode:42 099 */ 100 public void flushCollectionCache() { 101 super.flushCollectionCache(); 102 } 103 /** 104 * @apilevel internal 105 * @declaredat ASTNode:48 106 */ 107 public void flushRewriteCache() { 108 super.flushRewriteCache(); 109 } 110 /** 111 * @apilevel internal 112 * @declaredat ASTNode:54 113 */ 114 public BoundFieldAccess clone() throws CloneNotSupportedException { 115 BoundFieldAccess node = (BoundFieldAccess) super.clone(); 116 return node; 117 } 118 /** 119 * @apilevel internal 120 * @declaredat ASTNode:61 121 */ 122 public BoundFieldAccess copy() { 123 try { 124 BoundFieldAccess node = (BoundFieldAccess) clone(); 125 node.parent = null; 126 if (children != null) { 127 node.children = (ASTNode[]) children.clone(); 128 } 129 return node; 130 } catch (CloneNotSupportedException e) { 131 throw new Error("Error: clone not supported for " + getClass().getName()); 132 } 133 } 134 /** 135 * Create a deep copy of the AST subtree at this node. 136 * The copy is dangling, i.e. has no parent. 137 * @return dangling copy of the subtree at this node 138 * @apilevel low-level 139 * @deprecated Please use treeCopy or treeCopyNoTransform instead 140 * @declaredat ASTNode:80 141 */ 142 @Deprecated 143 public BoundFieldAccess fullCopy() { 144 return treeCopyNoTransform(); 145 } 146 /** 147 * Create a deep copy of the AST subtree at this node. 148 * The copy is dangling, i.e. has no parent. 149 * @return dangling copy of the subtree at this node 150 * @apilevel low-level 151 * @declaredat ASTNode:90 152 */ 153 public BoundFieldAccess treeCopyNoTransform() { 154 BoundFieldAccess tree = (BoundFieldAccess) copy(); 155 if (children != null) { 156 for (int i = 0; i < children.length; ++i) { 157 ASTNode child = (ASTNode) children[i]; 158 if (child != null) { 159 child = child.treeCopyNoTransform(); 160 tree.setChild(child, i); 161 } 162 } 163 } 164 return tree; 165 } 166 /** 167 * Create a deep copy of the AST subtree at this node. 168 * The subtree of this node is traversed to trigger rewrites before copy. 169 * The copy is dangling, i.e. has no parent. 170 * @return dangling copy of the subtree at this node 171 * @apilevel low-level 172 * @declaredat ASTNode:110 173 */ 174 public BoundFieldAccess treeCopy() { 175 doFullTraversal(); 176 return treeCopyNoTransform(); 177 } 178 /** 179 * @apilevel internal 180 * @declaredat ASTNode:117 181 */ 182 protected boolean is$Equal(ASTNode node) { 183 return super.is$Equal(node) && (tokenString_ID == ((BoundFieldAccess)node).tokenString_ID) && (tokenFieldDeclaration_FieldDeclaration == ((BoundFieldAccess)node).tokenFieldDeclaration_FieldDeclaration); 184 } 185 /** 186 * Replaces the lexeme ID. 187 * @param value The new value for the lexeme ID. 188 * @apilevel high-level 189 */ 190 public void setID(String value) { 191 tokenString_ID = value; 192 } 193 /** 194 * JastAdd-internal setter for lexeme ID using the Beaver parser. 195 * @param symbol Symbol containing the new value for the lexeme ID 196 * @apilevel internal 197 */ 198 public void setID(beaver.Symbol symbol) { 199 if (symbol.value != null && !(symbol.value instanceof String)) 200 throw new UnsupportedOperationException("setID is only valid for String lexemes"); 201 tokenString_ID = (String)symbol.value; 202 IDstart = symbol.getStart(); 203 IDend = symbol.getEnd(); 204 } 205 /** 206 * Retrieves the value for the lexeme ID. 207 * @return The value for the lexeme ID. 208 * @apilevel high-level 209 */ 210 @ASTNodeAnnotation.Token(name="ID") 211 public String getID() { 212 return tokenString_ID != null ? tokenString_ID : ""; 213 } 214 /** 215 * Replaces the lexeme FieldDeclaration. 216 * @param value The new value for the lexeme FieldDeclaration. 217 * @apilevel high-level 218 */ 219 public void setFieldDeclaration(FieldDeclaration value) { 220 tokenFieldDeclaration_FieldDeclaration = value; 221 } 222 /** 223 * @apilevel internal 224 */ 225 protected FieldDeclaration tokenFieldDeclaration_FieldDeclaration; 226 /** 227 * Retrieves the value for the lexeme FieldDeclaration. 228 * @return The value for the lexeme FieldDeclaration. 229 * @apilevel high-level 230 */ 231 @ASTNodeAnnotation.Token(name="FieldDeclaration") 232 public FieldDeclaration getFieldDeclaration() { 233 return tokenFieldDeclaration_FieldDeclaration; 234 } 235 /** 236 * @apilevel internal 237 */ 238 protected boolean decl_computed = false; 239 /** 240 * @apilevel internal 241 */ 242 protected Variable decl_value; 243 /** 244 * @apilevel internal 245 */ 246 private void decl_reset() { 247 decl_computed = false; 248 decl_value = null; 249 } 250 /** 251 * @attribute syn 252 * @aspect VariableScopePropagation 253 * @declaredat /home/jesper/git/extendj/java4/frontend/LookupVariable.jrag:352 254 */ 255 @ASTNodeAnnotation.Attribute 256 public Variable decl() { 257 ASTNode$State state = state(); 258 if (decl_computed) { 259 return decl_value; 260 } 261 boolean intermediate = state.INTERMEDIATE_VALUE; 262 state.INTERMEDIATE_VALUE = false; 263 int num = state.boundariesCrossed; 264 boolean isFinal = this.is$Final(); 265 decl_value = getFieldDeclaration(); 266 if (isFinal && num == state().boundariesCrossed) { 267 decl_computed = true; 268 } else { 269 } 270 state.INTERMEDIATE_VALUE |= intermediate; 271 272 return decl_value; 273 } 274 /** 275 * @apilevel internal 276 */ 277 public ASTNode rewriteTo() { 278 return super.rewriteTo(); 279 } 280 }