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 ContinueStmt : {@link Stmt} ::= <span class="component"><Label:String></span>; 015 * @ast node 016 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/java.ast:213 017 */ 018 public class ContinueStmt extends Stmt 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 ContinueStmt clone() throws CloneNotSupportedException { 034 ContinueStmt node = (ContinueStmt)super.clone(); 035 node.targetStmt_computed = false; 036 node.targetStmt_value = null; 037 node.finallyList_computed = false; 038 node.finallyList_value = null; 039 node.isDAafter_Variable_values = null; 040 node.isDUafterReachedFinallyBlocks_Variable_values = null; 041 node.isDAafterReachedFinallyBlocks_Variable_values = null; 042 node.isDUafter_Variable_values = null; 043 node.canCompleteNormally_computed = false; 044 node.lookupLabel_String_values = null; 045 node.in$Circle(false); 046 node.is$Final(false); 047 return node; 048 } 049 /** 050 * @apilevel internal 051 */ 052 @SuppressWarnings({"unchecked", "cast"}) 053 public ContinueStmt copy() { 054 055 try { 056 ContinueStmt node = (ContinueStmt) clone(); 057 node.parent = null; 058 if(children != null) 059 node.children = (ASTNode[]) children.clone(); 060 061 return node; 062 } catch (CloneNotSupportedException e) { 063 throw new Error("Error: clone not supported for " + getClass().getName()); 064 } 065 066 }/** 067 * Create a deep copy of the AST subtree at this node. 068 * The copy is dangling, i.e. has no parent. 069 * @return dangling copy of the subtree at this node 070 * @apilevel low-level 071 */ 072 @SuppressWarnings({"unchecked", "cast"}) 073 public ContinueStmt fullCopy() { 074 075 ContinueStmt tree = (ContinueStmt) copy(); 076 if (children != null) { 077 for (int i = 0; i < children.length; ++i) { 078 079 ASTNode child = (ASTNode) children[i]; 080 if(child != null) { 081 child = child.fullCopy(); 082 tree.setChild(child, i); 083 } 084 } 085 } 086 return tree; 087 088 } /** 089 * @ast method 090 * @aspect BranchTarget 091 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/BranchTarget.jrag:48 092 */ 093 public void collectBranches(Collection c) { 094 c.add(this); 095 } 096 /** 097 * @ast method 098 * @aspect NameCheck 099 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/NameCheck.jrag:389 100 */ 101 public void nameCheck() { 102 if(!insideLoop()) 103 error("continue outside loop"); 104 else if(hasLabel()) { 105 LabeledStmt label = lookupLabel(getLabel()); 106 if(label == null) 107 error("labeled continue must have visible matching label"); 108 else if(!label.getStmt().continueLabel()) 109 error(getLabel() + " is not a loop label"); 110 } 111 } 112 /** 113 * @ast method 114 * @aspect PrettyPrint 115 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/PrettyPrint.jadd:675 116 */ 117 public void toString(StringBuffer s) { 118 s.append(indent()); 119 s.append("continue "); 120 if(hasLabel()) 121 s.append(getLabel()); 122 s.append(";"); 123 } 124 /** 125 * @ast method 126 * @aspect CreateBCode 127 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Backend/CreateBCode.jrag:1426 128 */ 129 public void createBCode(CodeGeneration gen) { 130 super.createBCode(gen); 131 for(Iterator iter = finallyList().iterator(); iter.hasNext(); ) { 132 FinallyHost stmt = (FinallyHost)iter.next(); 133 gen.emitJsr(stmt.label_finally_block()); 134 } 135 gen.emitGoto(targetStmt().continue_label()); 136 } 137 /** 138 * @ast method 139 * 140 */ 141 public ContinueStmt() { 142 super(); 143 144 145 } 146 /** 147 * Initializes the child array to the correct size. 148 * Initializes List and Opt nta children. 149 * @apilevel internal 150 * @ast method 151 * @ast method 152 * 153 */ 154 public void init$Children() { 155 } 156 /** 157 * @ast method 158 * 159 */ 160 public ContinueStmt(String p0) { 161 setLabel(p0); 162 } 163 /** 164 * @ast method 165 * 166 */ 167 public ContinueStmt(beaver.Symbol p0) { 168 setLabel(p0); 169 } 170 /** 171 * @apilevel low-level 172 * @ast method 173 * 174 */ 175 protected int numChildren() { 176 return 0; 177 } 178 /** 179 * @apilevel internal 180 * @ast method 181 * 182 */ 183 public boolean mayHaveRewrite() { 184 return false; 185 } 186 /** 187 * Replaces the lexeme Label. 188 * @param value The new value for the lexeme Label. 189 * @apilevel high-level 190 * @ast method 191 * 192 */ 193 public void setLabel(String value) { 194 tokenString_Label = value; 195 } 196 /** 197 * @apilevel internal 198 * @ast method 199 * 200 */ 201 202 /** 203 * @apilevel internal 204 */ 205 protected String tokenString_Label; 206 /** 207 * @ast method 208 * 209 */ 210 211 public int Labelstart; 212 /** 213 * @ast method 214 * 215 */ 216 217 public int Labelend; 218 /** 219 * JastAdd-internal setter for lexeme Label using the Beaver parser. 220 * @apilevel internal 221 * @ast method 222 * 223 */ 224 public void setLabel(beaver.Symbol symbol) { 225 if(symbol.value != null && !(symbol.value instanceof String)) 226 throw new UnsupportedOperationException("setLabel is only valid for String lexemes"); 227 tokenString_Label = (String)symbol.value; 228 Labelstart = symbol.getStart(); 229 Labelend = symbol.getEnd(); 230 } 231 /** 232 * Retrieves the value for the lexeme Label. 233 * @return The value for the lexeme Label. 234 * @apilevel high-level 235 * @ast method 236 * 237 */ 238 public String getLabel() { 239 return tokenString_Label != null ? tokenString_Label : ""; 240 } 241 /** 242 * @attribute syn 243 * @aspect BranchTarget 244 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/BranchTarget.jrag:64 245 */ 246 public boolean hasLabel() { 247 ASTNode$State state = state(); 248 try { return !getLabel().equals(""); } 249 finally { 250 } 251 } 252 /** 253 * @apilevel internal 254 */ 255 protected boolean targetStmt_computed = false; 256 /** 257 * @apilevel internal 258 */ 259 protected Stmt targetStmt_value; 260 /** 261 * @attribute syn 262 * @aspect BranchTarget 263 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/BranchTarget.jrag:149 264 */ 265 @SuppressWarnings({"unchecked", "cast"}) 266 public Stmt targetStmt() { 267 if(targetStmt_computed) { 268 return targetStmt_value; 269 } 270 ASTNode$State state = state(); 271 int num = state.boundariesCrossed; 272 boolean isFinal = this.is$Final(); 273 targetStmt_value = targetStmt_compute(); 274 if(isFinal && num == state().boundariesCrossed){ targetStmt_computed = true; } 275 return targetStmt_value; 276 } 277 /** 278 * @apilevel internal 279 */ 280 private Stmt targetStmt_compute() { return branchTarget(this); } 281 /** 282 * @apilevel internal 283 */ 284 protected boolean finallyList_computed = false; 285 /** 286 * @apilevel internal 287 */ 288 protected ArrayList finallyList_value; 289 /** 290 * @attribute syn 291 * @aspect BranchTarget 292 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/BranchTarget.jrag:180 293 */ 294 @SuppressWarnings({"unchecked", "cast"}) 295 public ArrayList finallyList() { 296 if(finallyList_computed) { 297 return finallyList_value; 298 } 299 ASTNode$State state = state(); 300 int num = state.boundariesCrossed; 301 boolean isFinal = this.is$Final(); 302 finallyList_value = finallyList_compute(); 303 if(isFinal && num == state().boundariesCrossed){ finallyList_computed = true; } 304 return finallyList_value; 305 } 306 /** 307 * @apilevel internal 308 */ 309 private ArrayList finallyList_compute() { 310 ArrayList list = new ArrayList(); 311 collectFinally(this, list); 312 return list; 313 } 314 protected java.util.Map isDAafter_Variable_values; 315 /** 316 * @attribute syn 317 * @aspect DA 318 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/DefiniteAssignment.jrag:648 319 */ 320 @SuppressWarnings({"unchecked", "cast"}) 321 public boolean isDAafter(Variable v) { 322 Object _parameters = v; 323 if(isDAafter_Variable_values == null) isDAafter_Variable_values = new java.util.HashMap(4); 324 if(isDAafter_Variable_values.containsKey(_parameters)) { 325 return ((Boolean)isDAafter_Variable_values.get(_parameters)).booleanValue(); 326 } 327 ASTNode$State state = state(); 328 int num = state.boundariesCrossed; 329 boolean isFinal = this.is$Final(); 330 boolean isDAafter_Variable_value = isDAafter_compute(v); 331 if(isFinal && num == state().boundariesCrossed){ isDAafter_Variable_values.put(_parameters, Boolean.valueOf(isDAafter_Variable_value)); } 332 return isDAafter_Variable_value; 333 } 334 /** 335 * @apilevel internal 336 */ 337 private boolean isDAafter_compute(Variable v) { return true; } 338 protected java.util.Map isDUafterReachedFinallyBlocks_Variable_values; 339 /** 340 * @attribute syn 341 * @aspect DU 342 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/DefiniteAssignment.jrag:932 343 */ 344 @SuppressWarnings({"unchecked", "cast"}) 345 public boolean isDUafterReachedFinallyBlocks(Variable v) { 346 Object _parameters = v; 347 if(isDUafterReachedFinallyBlocks_Variable_values == null) isDUafterReachedFinallyBlocks_Variable_values = new java.util.HashMap(4); 348 if(isDUafterReachedFinallyBlocks_Variable_values.containsKey(_parameters)) { 349 return ((Boolean)isDUafterReachedFinallyBlocks_Variable_values.get(_parameters)).booleanValue(); 350 } 351 ASTNode$State state = state(); 352 int num = state.boundariesCrossed; 353 boolean isFinal = this.is$Final(); 354 boolean isDUafterReachedFinallyBlocks_Variable_value = isDUafterReachedFinallyBlocks_compute(v); 355 if(isFinal && num == state().boundariesCrossed){ isDUafterReachedFinallyBlocks_Variable_values.put(_parameters, Boolean.valueOf(isDUafterReachedFinallyBlocks_Variable_value)); } 356 return isDUafterReachedFinallyBlocks_Variable_value; 357 } 358 /** 359 * @apilevel internal 360 */ 361 private boolean isDUafterReachedFinallyBlocks_compute(Variable v) { 362 if(!isDUbefore(v) && finallyList().isEmpty()) 363 return false; 364 for(Iterator iter = finallyList().iterator(); iter.hasNext(); ) { 365 FinallyHost f = (FinallyHost)iter.next(); 366 if(!f.isDUafterFinally(v)) 367 return false; 368 } 369 return true; 370 } 371 protected java.util.Map isDAafterReachedFinallyBlocks_Variable_values; 372 /** 373 * @attribute syn 374 * @aspect DU 375 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/DefiniteAssignment.jrag:966 376 */ 377 @SuppressWarnings({"unchecked", "cast"}) 378 public boolean isDAafterReachedFinallyBlocks(Variable v) { 379 Object _parameters = v; 380 if(isDAafterReachedFinallyBlocks_Variable_values == null) isDAafterReachedFinallyBlocks_Variable_values = new java.util.HashMap(4); 381 if(isDAafterReachedFinallyBlocks_Variable_values.containsKey(_parameters)) { 382 return ((Boolean)isDAafterReachedFinallyBlocks_Variable_values.get(_parameters)).booleanValue(); 383 } 384 ASTNode$State state = state(); 385 int num = state.boundariesCrossed; 386 boolean isFinal = this.is$Final(); 387 boolean isDAafterReachedFinallyBlocks_Variable_value = isDAafterReachedFinallyBlocks_compute(v); 388 if(isFinal && num == state().boundariesCrossed){ isDAafterReachedFinallyBlocks_Variable_values.put(_parameters, Boolean.valueOf(isDAafterReachedFinallyBlocks_Variable_value)); } 389 return isDAafterReachedFinallyBlocks_Variable_value; 390 } 391 /** 392 * @apilevel internal 393 */ 394 private boolean isDAafterReachedFinallyBlocks_compute(Variable v) { 395 if(isDAbefore(v)) 396 return true; 397 if(finallyList().isEmpty()) 398 return false; 399 for(Iterator iter = finallyList().iterator(); iter.hasNext(); ) { 400 FinallyHost f = (FinallyHost)iter.next(); 401 if(!f.isDAafterFinally(v)) 402 return false; 403 } 404 return true; 405 } 406 protected java.util.Map isDUafter_Variable_values; 407 /** 408 * @attribute syn 409 * @aspect DU 410 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/DefiniteAssignment.jrag:1171 411 */ 412 @SuppressWarnings({"unchecked", "cast"}) 413 public boolean isDUafter(Variable v) { 414 Object _parameters = v; 415 if(isDUafter_Variable_values == null) isDUafter_Variable_values = new java.util.HashMap(4); 416 if(isDUafter_Variable_values.containsKey(_parameters)) { 417 return ((Boolean)isDUafter_Variable_values.get(_parameters)).booleanValue(); 418 } 419 ASTNode$State state = state(); 420 int num = state.boundariesCrossed; 421 boolean isFinal = this.is$Final(); 422 boolean isDUafter_Variable_value = isDUafter_compute(v); 423 if(isFinal && num == state().boundariesCrossed){ isDUafter_Variable_values.put(_parameters, Boolean.valueOf(isDUafter_Variable_value)); } 424 return isDUafter_Variable_value; 425 } 426 /** 427 * @apilevel internal 428 */ 429 private boolean isDUafter_compute(Variable v) { return true; } 430 /** 431 * @apilevel internal 432 */ 433 protected boolean canCompleteNormally_computed = false; 434 /** 435 * @apilevel internal 436 */ 437 protected boolean canCompleteNormally_value; 438 /** 439 * @attribute syn 440 * @aspect UnreachableStatements 441 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/UnreachableStatements.jrag:106 442 */ 443 @SuppressWarnings({"unchecked", "cast"}) 444 public boolean canCompleteNormally() { 445 if(canCompleteNormally_computed) { 446 return canCompleteNormally_value; 447 } 448 ASTNode$State state = state(); 449 int num = state.boundariesCrossed; 450 boolean isFinal = this.is$Final(); 451 canCompleteNormally_value = canCompleteNormally_compute(); 452 if(isFinal && num == state().boundariesCrossed){ canCompleteNormally_computed = true; } 453 return canCompleteNormally_value; 454 } 455 /** 456 * @apilevel internal 457 */ 458 private boolean canCompleteNormally_compute() { return false; } 459 /** 460 * @attribute syn 461 * @aspect PreciseRethrow 462 * @declaredat /home/jesper/svn/JastAddJ/Java7Frontend/PreciseRethrow.jrag:55 463 */ 464 public boolean modifiedInScope(Variable var) { 465 ASTNode$State state = state(); 466 try { return false; } 467 finally { 468 } 469 } 470 protected java.util.Map lookupLabel_String_values; 471 /** 472 * @attribute inh 473 * @aspect BranchTarget 474 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/BranchTarget.jrag:169 475 */ 476 @SuppressWarnings({"unchecked", "cast"}) 477 public LabeledStmt lookupLabel(String name) { 478 Object _parameters = name; 479 if(lookupLabel_String_values == null) lookupLabel_String_values = new java.util.HashMap(4); 480 if(lookupLabel_String_values.containsKey(_parameters)) { 481 return (LabeledStmt)lookupLabel_String_values.get(_parameters); 482 } 483 ASTNode$State state = state(); 484 int num = state.boundariesCrossed; 485 boolean isFinal = this.is$Final(); 486 LabeledStmt lookupLabel_String_value = getParent().Define_LabeledStmt_lookupLabel(this, null, name); 487 if(isFinal && num == state().boundariesCrossed){ lookupLabel_String_values.put(_parameters, lookupLabel_String_value); } 488 return lookupLabel_String_value; 489 } 490 /** 491 * @attribute inh 492 * @aspect NameCheck 493 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/NameCheck.jrag:366 494 */ 495 @SuppressWarnings({"unchecked", "cast"}) 496 public boolean insideLoop() { 497 ASTNode$State state = state(); 498 boolean insideLoop_value = getParent().Define_boolean_insideLoop(this, null); 499 return insideLoop_value; 500 } 501 /** 502 * @apilevel internal 503 */ 504 public ASTNode rewriteTo() { 505 return super.rewriteTo(); 506 } 507 }