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:15 010 * @production Use : {@link IdUse}; 011 012 */ 013 public class Use extends IdUse implements Cloneable { 014 /** 015 * @apilevel internal 016 */ 017 public Use clone() throws CloneNotSupportedException { 018 Use node = (Use) super.clone(); 019 node.in$Circle(false); 020 node.is$Final(false); 021 return node; 022 } 023 /** 024 * @apilevel internal 025 */ 026 public Use copy() { 027 try { 028 Use node = (Use) clone(); 029 node.parent = null; 030 if(children != null) { 031 node.children = (ASTNode[]) children.clone(); 032 } 033 return node; 034 } catch (CloneNotSupportedException e) { 035 throw new Error("Error: clone not supported for " + getClass().getName()); 036 } 037 } 038 /** 039 * Create a deep copy of the AST subtree at this node. 040 * The copy is dangling, i.e. has no parent. 041 * @return dangling copy of the subtree at this node 042 * @apilevel low-level 043 */ 044 public Use fullCopy() { 045 Use tree = (Use) copy(); 046 if (children != null) { 047 for (int i = 0; i < children.length; ++i) { 048 ASTNode child = (ASTNode) children[i]; 049 if(child != null) { 050 child = child.fullCopy(); 051 tree.setChild(child, i); 052 } 053 } 054 } 055 return tree; 056 } 057 /** 058 */ 059 public Use() { 060 super(); 061 } 062 /** 063 * Initializes the child array to the correct size. 064 * Initializes List and Opt nta children. 065 * @apilevel internal 066 * @ast method 067 */ 068 public void init$Children() { 069 } 070 /** 071 */ 072 public Use(String p0) { 073 setName(p0); 074 } 075 /** 076 * @apilevel low-level 077 */ 078 protected int numChildren() { 079 return 0; 080 } 081 /** 082 * @apilevel internal 083 */ 084 public boolean mayHaveRewrite() { 085 return true; 086 } 087 /** 088 * @apilevel low-level 089 */ 090 public void flushCache() { 091 super.flushCache(); 092 } 093 /** 094 * @apilevel internal 095 */ 096 public void flushCollectionCache() { 097 super.flushCollectionCache(); 098 } 099 /** 100 * Replaces the lexeme Name. 101 * @param value The new value for the lexeme Name. 102 * @apilevel high-level 103 */ 104 public void setName(String value) { 105 tokenString_Name = value; 106 } 107 /** 108 * Retrieves the value for the lexeme Name. 109 * @return The value for the lexeme Name. 110 * @apilevel high-level 111 */ 112 public String getName() { 113 return tokenString_Name != null ? tokenString_Name : ""; 114 } 115 /** 116 * @apilevel internal 117 */ 118 public ASTNode rewriteTo() { // Declared at @declaredat /home/csz-naf/examples/PicoJava/spec/TypeAnalysis.jrag:89 119 if (decl() instanceof VarDecl) { 120 state().duringTypeAnalysis++; 121 ASTNode result = rewriteRule0(); 122 state().duringTypeAnalysis--; 123 return result; 124 } // Declared at @declaredat /home/csz-naf/examples/PicoJava/spec/TypeAnalysis.jrag:98 125 if (decl() instanceof TypeDecl) { 126 state().duringTypeAnalysis++; 127 ASTNode result = rewriteRule1(); 128 state().duringTypeAnalysis--; 129 return result; 130 } return super.rewriteTo(); 131 } /** 132 * @declaredat @declaredat /home/csz-naf/examples/PicoJava/spec/TypeAnalysis.jrag:89 133 * @apilevel internal 134 */ private VariableUse rewriteRule0() { 135 { 136 137 VariableUse use = new VariableUse(getName()); 138 return use; 139 } } 140 /** 141 * @declaredat @declaredat /home/csz-naf/examples/PicoJava/spec/TypeAnalysis.jrag:98 142 * @apilevel internal 143 */ private TypeUse rewriteRule1() { 144 { 145 146 TypeUse use = new TypeUse(getName()); 147 return use; 148 } } 149 }