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 AssignSimpleExpr : {@link AssignExpr}; 015 * @ast node 016 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/java.ast:108 017 */ 018 public class AssignSimpleExpr extends AssignExpr 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 AssignSimpleExpr clone() throws CloneNotSupportedException { 034 AssignSimpleExpr node = (AssignSimpleExpr)super.clone(); 035 node.in$Circle(false); 036 node.is$Final(false); 037 return node; 038 } 039 /** 040 * @apilevel internal 041 */ 042 @SuppressWarnings({"unchecked", "cast"}) 043 public AssignSimpleExpr copy() { 044 045 try { 046 AssignSimpleExpr node = (AssignSimpleExpr) clone(); 047 node.parent = null; 048 if(children != null) 049 node.children = (ASTNode[]) children.clone(); 050 051 return node; 052 } catch (CloneNotSupportedException e) { 053 throw new Error("Error: clone not supported for " + getClass().getName()); 054 } 055 056 }/** 057 * Create a deep copy of the AST subtree at this node. 058 * The copy is dangling, i.e. has no parent. 059 * @return dangling copy of the subtree at this node 060 * @apilevel low-level 061 */ 062 @SuppressWarnings({"unchecked", "cast"}) 063 public AssignSimpleExpr fullCopy() { 064 065 AssignSimpleExpr tree = (AssignSimpleExpr) copy(); 066 if (children != null) { 067 for (int i = 0; i < children.length; ++i) { 068 069 ASTNode child = (ASTNode) children[i]; 070 if(child != null) { 071 child = child.fullCopy(); 072 tree.setChild(child, i); 073 } 074 } 075 } 076 return tree; 077 078 } /** 079 * @ast method 080 * @aspect TypeCheck 081 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/TypeCheck.jrag:44 082 */ 083 public void typeCheck() { 084 if(!getDest().isVariable()) 085 error("left hand side is not a variable"); 086 else if(!sourceType().assignConversionTo(getDest().type(), getSource()) && !sourceType().isUnknown()) 087 error("can not assign " + getDest() + " of type " + getDest().type().typeName() + 088 " a value of type " + sourceType().typeName()); 089 } 090 /** 091 * @ast method 092 * @aspect CreateBCode 093 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Backend/CreateBCode.jrag:248 094 */ 095 public void createBCode(CodeGeneration gen) { 096 getDest().createAssignSimpleLoadDest(gen); 097 getSource().createBCode(gen); 098 getSource().type().emitAssignConvTo(gen, getDest().type()); // AssignConversion 099 if(needsPush()) { 100 getDest().createPushAssignmentResult(gen); 101 } 102 getDest().emitStore(gen); 103 } 104 /** 105 * @ast method 106 * @aspect UncheckedConversion 107 * @declaredat /home/jesper/svn/JastAddJ/Java7Frontend/UncheckedConversion.jrag:30 108 */ 109 public void checkWarnings() { 110 if (!withinSuppressWarnings("unchecked")) 111 checkUncheckedConversion(getSource().type(), getDest().type()); 112 } 113 /** 114 * @ast method 115 * 116 */ 117 public AssignSimpleExpr() { 118 super(); 119 120 121 } 122 /** 123 * Initializes the child array to the correct size. 124 * Initializes List and Opt nta children. 125 * @apilevel internal 126 * @ast method 127 * @ast method 128 * 129 */ 130 public void init$Children() { 131 children = new ASTNode[2]; 132 } 133 /** 134 * @ast method 135 * 136 */ 137 public AssignSimpleExpr(Expr p0, Expr p1) { 138 setChild(p0, 0); 139 setChild(p1, 1); 140 } 141 /** 142 * @apilevel low-level 143 * @ast method 144 * 145 */ 146 protected int numChildren() { 147 return 2; 148 } 149 /** 150 * @apilevel internal 151 * @ast method 152 * 153 */ 154 public boolean mayHaveRewrite() { 155 return false; 156 } 157 /** 158 * Replaces the Dest child. 159 * @param node The new node to replace the Dest child. 160 * @apilevel high-level 161 * @ast method 162 * 163 */ 164 public void setDest(Expr node) { 165 setChild(node, 0); 166 } 167 /** 168 * Retrieves the Dest child. 169 * @return The current node used as the Dest child. 170 * @apilevel high-level 171 * @ast method 172 * 173 */ 174 public Expr getDest() { 175 return (Expr)getChild(0); 176 } 177 /** 178 * Retrieves the Dest child. 179 * <p><em>This method does not invoke AST transformations.</em></p> 180 * @return The current node used as the Dest child. 181 * @apilevel low-level 182 * @ast method 183 * 184 */ 185 public Expr getDestNoTransform() { 186 return (Expr)getChildNoTransform(0); 187 } 188 /** 189 * Replaces the Source child. 190 * @param node The new node to replace the Source child. 191 * @apilevel high-level 192 * @ast method 193 * 194 */ 195 public void setSource(Expr node) { 196 setChild(node, 1); 197 } 198 /** 199 * Retrieves the Source child. 200 * @return The current node used as the Source child. 201 * @apilevel high-level 202 * @ast method 203 * 204 */ 205 public Expr getSource() { 206 return (Expr)getChild(1); 207 } 208 /** 209 * Retrieves the Source child. 210 * <p><em>This method does not invoke AST transformations.</em></p> 211 * @return The current node used as the Source child. 212 * @apilevel low-level 213 * @ast method 214 * 215 */ 216 public Expr getSourceNoTransform() { 217 return (Expr)getChildNoTransform(1); 218 } 219 /** 220 * @attribute syn 221 * @aspect PrettyPrint 222 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/PrettyPrint.jadd:247 223 */ 224 public String printOp() { 225 ASTNode$State state = state(); 226 try { return " = "; } 227 finally { 228 } 229 } 230 /** 231 * @attribute syn 232 * @aspect TypeCheck 233 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/TypeCheck.jrag:121 234 */ 235 public TypeDecl sourceType() { 236 ASTNode$State state = state(); 237 try { return getSource().type(); } 238 finally { 239 } 240 } 241 /** 242 * @attribute inh 243 * @aspect SuppressWarnings 244 * @declaredat /home/jesper/svn/JastAddJ/Java7Frontend/SuppressWarnings.jrag:15 245 */ 246 @SuppressWarnings({"unchecked", "cast"}) 247 public boolean withinSuppressWarnings(String s) { 248 ASTNode$State state = state(); 249 boolean withinSuppressWarnings_String_value = getParent().Define_boolean_withinSuppressWarnings(this, null, s); 250 return withinSuppressWarnings_String_value; 251 } 252 /** 253 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/DefiniteAssignment.jrag:17 254 * @apilevel internal 255 */ 256 public boolean Define_boolean_isDest(ASTNode caller, ASTNode child) { 257 if(caller == getDestNoTransform()) { 258 return true; 259 } 260 else { return super.Define_boolean_isDest(caller, child); 261 } 262 } 263 /** 264 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/DefiniteAssignment.jrag:27 265 * @apilevel internal 266 */ 267 public boolean Define_boolean_isSource(ASTNode caller, ASTNode child) { 268 if(caller == getDestNoTransform()) { 269 return false; 270 } 271 else { return super.Define_boolean_isSource(caller, child); 272 } 273 } 274 /** 275 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/GenericMethodsInference.jrag:36 276 * @apilevel internal 277 */ 278 public TypeDecl Define_TypeDecl_assignConvertedType(ASTNode caller, ASTNode child) { 279 if(caller == getSourceNoTransform()) { 280 return getDest().type(); 281 } 282 else { return getParent().Define_TypeDecl_assignConvertedType(this, caller); 283 } 284 } 285 /** 286 * @apilevel internal 287 */ 288 public ASTNode rewriteTo() { 289 return super.rewriteTo(); 290 } 291 }