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 ForStmt : {@link BranchTargetStmt} ::= <span class="component">InitStmt:{@link Stmt}*</span> <span class="component">[Condition:{@link Expr}]</span> <span class="component">UpdateStmt:{@link Stmt}*</span> <span class="component">{@link Stmt}</span>; 015 * @ast node 016 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/java.ast:210 017 */ 018 public class ForStmt extends BranchTargetStmt implements Cloneable, VariableScope { 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 ForStmt clone() throws CloneNotSupportedException { 034 ForStmt node = (ForStmt)super.clone(); 035 node.targetOf_ContinueStmt_values = null; 036 node.targetOf_BreakStmt_values = null; 037 node.isDAafter_Variable_values = null; 038 node.isDUafter_Variable_values = null; 039 node.isDUbeforeCondition_Variable_values = null; 040 node.localLookup_String_values = null; 041 node.localVariableDeclaration_String_values = null; 042 node.canCompleteNormally_computed = false; 043 node.variableScopeEndLabel_CodeGeneration_values = null; 044 node.cond_label_computed = false; 045 node.begin_label_computed = false; 046 node.update_label_computed = false; 047 node.end_label_computed = false; 048 node.lookupVariable_String_values = null; 049 node.in$Circle(false); 050 node.is$Final(false); 051 return node; 052 } 053 /** 054 * @apilevel internal 055 */ 056 @SuppressWarnings({"unchecked", "cast"}) 057 public ForStmt copy() { 058 059 try { 060 ForStmt node = (ForStmt) clone(); 061 node.parent = null; 062 if(children != null) 063 node.children = (ASTNode[]) children.clone(); 064 065 return node; 066 } catch (CloneNotSupportedException e) { 067 throw new Error("Error: clone not supported for " + getClass().getName()); 068 } 069 070 }/** 071 * Create a deep copy of the AST subtree at this node. 072 * The copy is dangling, i.e. has no parent. 073 * @return dangling copy of the subtree at this node 074 * @apilevel low-level 075 */ 076 @SuppressWarnings({"unchecked", "cast"}) 077 public ForStmt fullCopy() { 078 079 ForStmt tree = (ForStmt) copy(); 080 if (children != null) { 081 for (int i = 0; i < children.length; ++i) { 082 083 ASTNode child = (ASTNode) children[i]; 084 if(child != null) { 085 child = child.fullCopy(); 086 tree.setChild(child, i); 087 } 088 } 089 } 090 return tree; 091 092 } /** 093 * @ast method 094 * @aspect PrettyPrint 095 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/PrettyPrint.jadd:604 096 */ 097 public void toString(StringBuffer s) { 098 s.append(indent()); 099 s.append("for("); 100 if(getNumInitStmt() > 0) { 101 if(getInitStmt(0) instanceof VariableDeclaration) { 102 int minDimension = Integer.MAX_VALUE; 103 for(int i = 0; i < getNumInitStmt(); i++) { 104 VariableDeclaration v = (VariableDeclaration)getInitStmt(i); 105 minDimension = Math.min(minDimension, v.type().dimension()); 106 } 107 VariableDeclaration v = (VariableDeclaration)getInitStmt(0); 108 v.getModifiers().toString(s); 109 s.append(v.type().elementType().typeName()); 110 for(int i = minDimension; i > 0; i--) 111 s.append("[]"); 112 113 for(int i = 0; i < getNumInitStmt(); i++) { 114 if(i != 0) 115 s.append(","); 116 v = (VariableDeclaration)getInitStmt(i); 117 s.append(" " + v.name()); 118 for(int j = v.type().dimension() - minDimension; j > 0; j--) 119 s.append("[]"); 120 if(v.hasInit()) { 121 s.append(" = "); 122 v.getInit().toString(s); 123 } 124 } 125 } 126 else if(getInitStmt(0) instanceof ExprStmt) { 127 ExprStmt stmt = (ExprStmt)getInitStmt(0); 128 stmt.getExpr().toString(s); 129 for(int i = 1; i < getNumInitStmt(); i++) { 130 s.append(", "); 131 stmt = (ExprStmt)getInitStmt(i); 132 stmt.getExpr().toString(s); 133 } 134 } 135 else { 136 throw new Error("Unexpected initializer in for loop: " + getInitStmt(0)); 137 } 138 } 139 140 s.append("; "); 141 if(hasCondition()) { 142 getCondition().toString(s); 143 } 144 s.append("; "); 145 146 if(getNumUpdateStmt() > 0) { 147 ExprStmt stmt = (ExprStmt)getUpdateStmt(0); 148 stmt.getExpr().toString(s); 149 for(int i = 1; i < getNumUpdateStmt(); i++) { 150 s.append(", "); 151 stmt = (ExprStmt)getUpdateStmt(i); 152 stmt.getExpr().toString(s); 153 } 154 } 155 156 s.append(") "); 157 getStmt().toString(s); 158 } 159 /** 160 * @ast method 161 * @aspect TypeCheck 162 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/TypeCheck.jrag:334 163 */ 164 public void typeCheck() { 165 if(hasCondition()) { 166 TypeDecl cond = getCondition().type(); 167 if(!cond.isBoolean()) { 168 error("the type of \"" + getCondition() + "\" is " + cond.name() + " which is not boolean"); 169 } 170 } 171 } 172 /** 173 * @ast method 174 * @aspect CreateBCode 175 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Backend/CreateBCode.jrag:1377 176 */ 177 public void createBCode(CodeGeneration gen) { 178 super.createBCode(gen); 179 for (int i=0; i<getNumInitStmt(); i++) { 180 getInitStmt(i).createBCode(gen); 181 } 182 gen.addLabel(cond_label()); 183 getCondition().emitEvalBranch(gen); 184 if(getCondition().canBeTrue()) { 185 gen.addLabel(begin_label()); 186 getStmt().createBCode(gen); 187 gen.addLabel(update_label()); 188 for (int i=0; i<getNumUpdateStmt(); i++) 189 getUpdateStmt(i).createBCode(gen); 190 gen.emitGoto(cond_label()); 191 } 192 if(canCompleteNormally()) { 193 gen.addLabel(end_label()); 194 } 195 gen.addVariableScopeLabel(variableScopeEndLabel(gen)); 196 } 197 /** 198 * @ast method 199 * 200 */ 201 public ForStmt() { 202 super(); 203 204 205 } 206 /** 207 * Initializes the child array to the correct size. 208 * Initializes List and Opt nta children. 209 * @apilevel internal 210 * @ast method 211 * @ast method 212 * 213 */ 214 public void init$Children() { 215 children = new ASTNode[4]; 216 setChild(new List(), 0); 217 setChild(new Opt(), 1); 218 setChild(new List(), 2); 219 } 220 /** 221 * @ast method 222 * 223 */ 224 public ForStmt(List<Stmt> p0, Opt<Expr> p1, List<Stmt> p2, Stmt p3) { 225 setChild(p0, 0); 226 setChild(p1, 1); 227 setChild(p2, 2); 228 setChild(p3, 3); 229 } 230 /** 231 * @apilevel low-level 232 * @ast method 233 * 234 */ 235 protected int numChildren() { 236 return 4; 237 } 238 /** 239 * @apilevel internal 240 * @ast method 241 * 242 */ 243 public boolean mayHaveRewrite() { 244 return true; 245 } 246 /** 247 * Replaces the InitStmt list. 248 * @param list The new list node to be used as the InitStmt list. 249 * @apilevel high-level 250 * @ast method 251 * 252 */ 253 public void setInitStmtList(List<Stmt> list) { 254 setChild(list, 0); 255 } 256 /** 257 * Retrieves the number of children in the InitStmt list. 258 * @return Number of children in the InitStmt list. 259 * @apilevel high-level 260 * @ast method 261 * 262 */ 263 public int getNumInitStmt() { 264 return getInitStmtList().getNumChild(); 265 } 266 /** 267 * Retrieves the number of children in the InitStmt list. 268 * Calling this method will not trigger rewrites.. 269 * @return Number of children in the InitStmt list. 270 * @apilevel low-level 271 * @ast method 272 * 273 */ 274 public int getNumInitStmtNoTransform() { 275 return getInitStmtListNoTransform().getNumChildNoTransform(); 276 } 277 /** 278 * Retrieves the element at index {@code i} in the InitStmt list.. 279 * @param i Index of the element to return. 280 * @return The element at position {@code i} in the InitStmt list. 281 * @apilevel high-level 282 * @ast method 283 * 284 */ 285 @SuppressWarnings({"unchecked", "cast"}) 286 public Stmt getInitStmt(int i) { 287 return (Stmt)getInitStmtList().getChild(i); 288 } 289 /** 290 * Append an element to the InitStmt list. 291 * @param node The element to append to the InitStmt list. 292 * @apilevel high-level 293 * @ast method 294 * 295 */ 296 public void addInitStmt(Stmt node) { 297 List<Stmt> list = (parent == null || state == null) ? getInitStmtListNoTransform() : getInitStmtList(); 298 list.addChild(node); 299 } 300 /** 301 * @apilevel low-level 302 * @ast method 303 * 304 */ 305 public void addInitStmtNoTransform(Stmt node) { 306 List<Stmt> list = getInitStmtListNoTransform(); 307 list.addChild(node); 308 } 309 /** 310 * Replaces the InitStmt list element at index {@code i} with the new node {@code node}. 311 * @param node The new node to replace the old list element. 312 * @param i The list index of the node to be replaced. 313 * @apilevel high-level 314 * @ast method 315 * 316 */ 317 public void setInitStmt(Stmt node, int i) { 318 List<Stmt> list = getInitStmtList(); 319 list.setChild(node, i); 320 } 321 /** 322 * Retrieves the InitStmt list. 323 * @return The node representing the InitStmt list. 324 * @apilevel high-level 325 * @ast method 326 * 327 */ 328 public List<Stmt> getInitStmts() { 329 return getInitStmtList(); 330 } 331 /** 332 * Retrieves the InitStmt list. 333 * <p><em>This method does not invoke AST transformations.</em></p> 334 * @return The node representing the InitStmt list. 335 * @apilevel low-level 336 * @ast method 337 * 338 */ 339 public List<Stmt> getInitStmtsNoTransform() { 340 return getInitStmtListNoTransform(); 341 } 342 /** 343 * Retrieves the InitStmt list. 344 * @return The node representing the InitStmt list. 345 * @apilevel high-level 346 * @ast method 347 * 348 */ 349 @SuppressWarnings({"unchecked", "cast"}) 350 public List<Stmt> getInitStmtList() { 351 List<Stmt> list = (List<Stmt>)getChild(0); 352 list.getNumChild(); 353 return list; 354 } 355 /** 356 * Retrieves the InitStmt list. 357 * <p><em>This method does not invoke AST transformations.</em></p> 358 * @return The node representing the InitStmt list. 359 * @apilevel low-level 360 * @ast method 361 * 362 */ 363 @SuppressWarnings({"unchecked", "cast"}) 364 public List<Stmt> getInitStmtListNoTransform() { 365 return (List<Stmt>)getChildNoTransform(0); 366 } 367 /** 368 * Replaces the optional node for the Condition child. This is the {@code Opt} node containing the child Condition, not the actual child! 369 * @param opt The new node to be used as the optional node for the Condition child. 370 * @apilevel low-level 371 * @ast method 372 * 373 */ 374 public void setConditionOpt(Opt<Expr> opt) { 375 setChild(opt, 1); 376 } 377 /** 378 * Check whether the optional Condition child exists. 379 * @return {@code true} if the optional Condition child exists, {@code false} if it does not. 380 * @apilevel high-level 381 * @ast method 382 * 383 */ 384 public boolean hasCondition() { 385 return getConditionOpt().getNumChild() != 0; 386 } 387 /** 388 * Retrieves the (optional) Condition child. 389 * @return The Condition child, if it exists. Returns {@code null} otherwise. 390 * @apilevel low-level 391 * @ast method 392 * 393 */ 394 @SuppressWarnings({"unchecked", "cast"}) 395 public Expr getCondition() { 396 return (Expr)getConditionOpt().getChild(0); 397 } 398 /** 399 * Replaces the (optional) Condition child. 400 * @param node The new node to be used as the Condition child. 401 * @apilevel high-level 402 * @ast method 403 * 404 */ 405 public void setCondition(Expr node) { 406 getConditionOpt().setChild(node, 0); 407 } 408 /** 409 * @apilevel low-level 410 * @ast method 411 * 412 */ 413 @SuppressWarnings({"unchecked", "cast"}) 414 public Opt<Expr> getConditionOpt() { 415 return (Opt<Expr>)getChild(1); 416 } 417 /** 418 * Retrieves the optional node for child Condition. This is the {@code Opt} node containing the child Condition, not the actual child! 419 * <p><em>This method does not invoke AST transformations.</em></p> 420 * @return The optional node for child Condition. 421 * @apilevel low-level 422 * @ast method 423 * 424 */ 425 @SuppressWarnings({"unchecked", "cast"}) 426 public Opt<Expr> getConditionOptNoTransform() { 427 return (Opt<Expr>)getChildNoTransform(1); 428 } 429 /** 430 * Replaces the UpdateStmt list. 431 * @param list The new list node to be used as the UpdateStmt list. 432 * @apilevel high-level 433 * @ast method 434 * 435 */ 436 public void setUpdateStmtList(List<Stmt> list) { 437 setChild(list, 2); 438 } 439 /** 440 * Retrieves the number of children in the UpdateStmt list. 441 * @return Number of children in the UpdateStmt list. 442 * @apilevel high-level 443 * @ast method 444 * 445 */ 446 public int getNumUpdateStmt() { 447 return getUpdateStmtList().getNumChild(); 448 } 449 /** 450 * Retrieves the number of children in the UpdateStmt list. 451 * Calling this method will not trigger rewrites.. 452 * @return Number of children in the UpdateStmt list. 453 * @apilevel low-level 454 * @ast method 455 * 456 */ 457 public int getNumUpdateStmtNoTransform() { 458 return getUpdateStmtListNoTransform().getNumChildNoTransform(); 459 } 460 /** 461 * Retrieves the element at index {@code i} in the UpdateStmt list.. 462 * @param i Index of the element to return. 463 * @return The element at position {@code i} in the UpdateStmt list. 464 * @apilevel high-level 465 * @ast method 466 * 467 */ 468 @SuppressWarnings({"unchecked", "cast"}) 469 public Stmt getUpdateStmt(int i) { 470 return (Stmt)getUpdateStmtList().getChild(i); 471 } 472 /** 473 * Append an element to the UpdateStmt list. 474 * @param node The element to append to the UpdateStmt list. 475 * @apilevel high-level 476 * @ast method 477 * 478 */ 479 public void addUpdateStmt(Stmt node) { 480 List<Stmt> list = (parent == null || state == null) ? getUpdateStmtListNoTransform() : getUpdateStmtList(); 481 list.addChild(node); 482 } 483 /** 484 * @apilevel low-level 485 * @ast method 486 * 487 */ 488 public void addUpdateStmtNoTransform(Stmt node) { 489 List<Stmt> list = getUpdateStmtListNoTransform(); 490 list.addChild(node); 491 } 492 /** 493 * Replaces the UpdateStmt list element at index {@code i} with the new node {@code node}. 494 * @param node The new node to replace the old list element. 495 * @param i The list index of the node to be replaced. 496 * @apilevel high-level 497 * @ast method 498 * 499 */ 500 public void setUpdateStmt(Stmt node, int i) { 501 List<Stmt> list = getUpdateStmtList(); 502 list.setChild(node, i); 503 } 504 /** 505 * Retrieves the UpdateStmt list. 506 * @return The node representing the UpdateStmt list. 507 * @apilevel high-level 508 * @ast method 509 * 510 */ 511 public List<Stmt> getUpdateStmts() { 512 return getUpdateStmtList(); 513 } 514 /** 515 * Retrieves the UpdateStmt list. 516 * <p><em>This method does not invoke AST transformations.</em></p> 517 * @return The node representing the UpdateStmt list. 518 * @apilevel low-level 519 * @ast method 520 * 521 */ 522 public List<Stmt> getUpdateStmtsNoTransform() { 523 return getUpdateStmtListNoTransform(); 524 } 525 /** 526 * Retrieves the UpdateStmt list. 527 * @return The node representing the UpdateStmt list. 528 * @apilevel high-level 529 * @ast method 530 * 531 */ 532 @SuppressWarnings({"unchecked", "cast"}) 533 public List<Stmt> getUpdateStmtList() { 534 List<Stmt> list = (List<Stmt>)getChild(2); 535 list.getNumChild(); 536 return list; 537 } 538 /** 539 * Retrieves the UpdateStmt list. 540 * <p><em>This method does not invoke AST transformations.</em></p> 541 * @return The node representing the UpdateStmt list. 542 * @apilevel low-level 543 * @ast method 544 * 545 */ 546 @SuppressWarnings({"unchecked", "cast"}) 547 public List<Stmt> getUpdateStmtListNoTransform() { 548 return (List<Stmt>)getChildNoTransform(2); 549 } 550 /** 551 * Replaces the Stmt child. 552 * @param node The new node to replace the Stmt child. 553 * @apilevel high-level 554 * @ast method 555 * 556 */ 557 public void setStmt(Stmt node) { 558 setChild(node, 3); 559 } 560 /** 561 * Retrieves the Stmt child. 562 * @return The current node used as the Stmt child. 563 * @apilevel high-level 564 * @ast method 565 * 566 */ 567 public Stmt getStmt() { 568 return (Stmt)getChild(3); 569 } 570 /** 571 * Retrieves the Stmt child. 572 * <p><em>This method does not invoke AST transformations.</em></p> 573 * @return The current node used as the Stmt child. 574 * @apilevel low-level 575 * @ast method 576 * 577 */ 578 public Stmt getStmtNoTransform() { 579 return (Stmt)getChildNoTransform(3); 580 } 581 protected java.util.Map targetOf_ContinueStmt_values; 582 /** 583 * @attribute syn 584 * @aspect BranchTarget 585 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/BranchTarget.jrag:71 586 */ 587 @SuppressWarnings({"unchecked", "cast"}) 588 public boolean targetOf(ContinueStmt stmt) { 589 Object _parameters = stmt; 590 if(targetOf_ContinueStmt_values == null) targetOf_ContinueStmt_values = new java.util.HashMap(4); 591 if(targetOf_ContinueStmt_values.containsKey(_parameters)) { 592 return ((Boolean)targetOf_ContinueStmt_values.get(_parameters)).booleanValue(); 593 } 594 ASTNode$State state = state(); 595 int num = state.boundariesCrossed; 596 boolean isFinal = this.is$Final(); 597 boolean targetOf_ContinueStmt_value = targetOf_compute(stmt); 598 if(isFinal && num == state().boundariesCrossed){ targetOf_ContinueStmt_values.put(_parameters, Boolean.valueOf(targetOf_ContinueStmt_value)); } 599 return targetOf_ContinueStmt_value; 600 } 601 /** 602 * @apilevel internal 603 */ 604 private boolean targetOf_compute(ContinueStmt stmt) { return !stmt.hasLabel(); } 605 protected java.util.Map targetOf_BreakStmt_values; 606 /** 607 * @attribute syn 608 * @aspect BranchTarget 609 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/BranchTarget.jrag:79 610 */ 611 @SuppressWarnings({"unchecked", "cast"}) 612 public boolean targetOf(BreakStmt stmt) { 613 Object _parameters = stmt; 614 if(targetOf_BreakStmt_values == null) targetOf_BreakStmt_values = new java.util.HashMap(4); 615 if(targetOf_BreakStmt_values.containsKey(_parameters)) { 616 return ((Boolean)targetOf_BreakStmt_values.get(_parameters)).booleanValue(); 617 } 618 ASTNode$State state = state(); 619 int num = state.boundariesCrossed; 620 boolean isFinal = this.is$Final(); 621 boolean targetOf_BreakStmt_value = targetOf_compute(stmt); 622 if(isFinal && num == state().boundariesCrossed){ targetOf_BreakStmt_values.put(_parameters, Boolean.valueOf(targetOf_BreakStmt_value)); } 623 return targetOf_BreakStmt_value; 624 } 625 /** 626 * @apilevel internal 627 */ 628 private boolean targetOf_compute(BreakStmt stmt) { return !stmt.hasLabel(); } 629 protected java.util.Map isDAafter_Variable_values; 630 /** 631 * @attribute syn 632 * @aspect DA 633 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/DefiniteAssignment.jrag:612 634 */ 635 @SuppressWarnings({"unchecked", "cast"}) 636 public boolean isDAafter(Variable v) { 637 Object _parameters = v; 638 if(isDAafter_Variable_values == null) isDAafter_Variable_values = new java.util.HashMap(4); 639 if(isDAafter_Variable_values.containsKey(_parameters)) { 640 return ((Boolean)isDAafter_Variable_values.get(_parameters)).booleanValue(); 641 } 642 ASTNode$State state = state(); 643 int num = state.boundariesCrossed; 644 boolean isFinal = this.is$Final(); 645 boolean isDAafter_Variable_value = isDAafter_compute(v); 646 if(isFinal && num == state().boundariesCrossed){ isDAafter_Variable_values.put(_parameters, Boolean.valueOf(isDAafter_Variable_value)); } 647 return isDAafter_Variable_value; 648 } 649 /** 650 * @apilevel internal 651 */ 652 private boolean isDAafter_compute(Variable v) { 653 if(!(!hasCondition() || getCondition().isDAafterFalse(v))) 654 return false; 655 for(Iterator iter = targetBreaks().iterator(); iter.hasNext(); ) { 656 BreakStmt stmt = (BreakStmt)iter.next(); 657 if(!stmt.isDAafterReachedFinallyBlocks(v)) 658 return false; 659 } 660 return true; 661 } 662 /** 663 * @attribute syn 664 * @aspect DA 665 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/DefiniteAssignment.jrag:625 666 */ 667 public boolean isDAafterInitialization(Variable v) { 668 ASTNode$State state = state(); 669 try { return getNumInitStmt() == 0 ? isDAbefore(v) : getInitStmt(getNumInitStmt()-1).isDAafter(v); } 670 finally { 671 } 672 } 673 protected java.util.Map isDUafter_Variable_values; 674 /** 675 * @attribute syn 676 * @aspect DU 677 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/DefiniteAssignment.jrag:1096 678 */ 679 @SuppressWarnings({"unchecked", "cast"}) 680 public boolean isDUafter(Variable v) { 681 Object _parameters = v; 682 if(isDUafter_Variable_values == null) isDUafter_Variable_values = new java.util.HashMap(4); 683 if(isDUafter_Variable_values.containsKey(_parameters)) { 684 return ((Boolean)isDUafter_Variable_values.get(_parameters)).booleanValue(); 685 } 686 ASTNode$State state = state(); 687 int num = state.boundariesCrossed; 688 boolean isFinal = this.is$Final(); 689 boolean isDUafter_Variable_value = isDUafter_compute(v); 690 if(isFinal && num == state().boundariesCrossed){ isDUafter_Variable_values.put(_parameters, Boolean.valueOf(isDUafter_Variable_value)); } 691 return isDUafter_Variable_value; 692 } 693 /** 694 * @apilevel internal 695 */ 696 private boolean isDUafter_compute(Variable v) { 697 if(!isDUbeforeCondition(v)) // start a circular evaluation here 698 return false; 699 if(!(!hasCondition() || getCondition().isDUafterFalse(v))) { 700 return false; 701 } 702 for(Iterator iter = targetBreaks().iterator(); iter.hasNext(); ) { 703 BreakStmt stmt = (BreakStmt)iter.next(); 704 if(!stmt.isDUafterReachedFinallyBlocks(v)) 705 return false; 706 } 707 //if(!isDUafterUpdate(v)) 708 // return false; 709 return true; 710 } 711 /** 712 * @attribute syn 713 * @aspect DU 714 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/DefiniteAssignment.jrag:1116 715 */ 716 public boolean isDUafterInit(Variable v) { 717 ASTNode$State state = state(); 718 try { return getNumInitStmt() == 0 ? isDUbefore(v) : getInitStmt(getNumInitStmt()-1).isDUafter(v); } 719 finally { 720 } 721 } 722 protected java.util.Map isDUbeforeCondition_Variable_values; 723 /** 724 * @attribute syn 725 * @aspect DU 726 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/DefiniteAssignment.jrag:1118 727 */ 728 @SuppressWarnings({"unchecked", "cast"}) 729 public boolean isDUbeforeCondition(Variable v) { 730 Object _parameters = v; 731 if(isDUbeforeCondition_Variable_values == null) isDUbeforeCondition_Variable_values = new java.util.HashMap(4); 732 ASTNode$State.CircularValue _value; 733 if(isDUbeforeCondition_Variable_values.containsKey(_parameters)) { 734 Object _o = isDUbeforeCondition_Variable_values.get(_parameters); 735 if(!(_o instanceof ASTNode$State.CircularValue)) { 736 return ((Boolean)_o).booleanValue(); 737 } 738 else 739 _value = (ASTNode$State.CircularValue)_o; 740 } 741 else { 742 _value = new ASTNode$State.CircularValue(); 743 isDUbeforeCondition_Variable_values.put(_parameters, _value); 744 _value.value = Boolean.valueOf(true); 745 } 746 ASTNode$State state = state(); 747 if (!state.IN_CIRCLE) { 748 state.IN_CIRCLE = true; 749 int num = state.boundariesCrossed; 750 boolean isFinal = this.is$Final(); 751 boolean new_isDUbeforeCondition_Variable_value; 752 do { 753 _value.visited = new Integer(state.CIRCLE_INDEX); 754 state.CHANGE = false; 755 new_isDUbeforeCondition_Variable_value = isDUbeforeCondition_compute(v); 756 if (new_isDUbeforeCondition_Variable_value!=((Boolean)_value.value).booleanValue()) { 757 state.CHANGE = true; 758 _value.value = Boolean.valueOf(new_isDUbeforeCondition_Variable_value); 759 } 760 state.CIRCLE_INDEX++; 761 } while (state.CHANGE); 762 if(isFinal && num == state().boundariesCrossed) { 763 isDUbeforeCondition_Variable_values.put(_parameters, new_isDUbeforeCondition_Variable_value); 764 } 765 else { 766 isDUbeforeCondition_Variable_values.remove(_parameters); 767 state.RESET_CYCLE = true; 768 isDUbeforeCondition_compute(v); 769 state.RESET_CYCLE = false; 770 } 771 state.IN_CIRCLE = false; 772 return new_isDUbeforeCondition_Variable_value; 773 } 774 if(!new Integer(state.CIRCLE_INDEX).equals(_value.visited)) { 775 _value.visited = new Integer(state.CIRCLE_INDEX); 776 boolean new_isDUbeforeCondition_Variable_value = isDUbeforeCondition_compute(v); 777 if (state.RESET_CYCLE) { 778 isDUbeforeCondition_Variable_values.remove(_parameters); 779 } 780 else if (new_isDUbeforeCondition_Variable_value!=((Boolean)_value.value).booleanValue()) { 781 state.CHANGE = true; 782 _value.value = new_isDUbeforeCondition_Variable_value; 783 } 784 return new_isDUbeforeCondition_Variable_value; 785 } 786 return ((Boolean)_value.value).booleanValue(); 787 } 788 /** 789 * @apilevel internal 790 */ 791 private boolean isDUbeforeCondition_compute(Variable v) { 792 if(!isDUafterInit(v)) 793 return false; 794 else if(!isDUafterUpdate(v)) 795 return false; 796 return true; 797 } 798 /** 799 * @attribute syn 800 * @aspect DU 801 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/DefiniteAssignment.jrag:1129 802 */ 803 public boolean isDUafterUpdate(Variable v) { 804 ASTNode$State state = state(); 805 try { 806 if(!isDUbeforeCondition(v)) // start a circular evaluation here 807 return false; 808 if(getNumUpdateStmt() > 0) 809 return getUpdateStmt(getNumUpdateStmt()-1).isDUafter(v); 810 if(!getStmt().isDUafter(v)) 811 return false; 812 for(Iterator iter = targetContinues().iterator(); iter.hasNext(); ) { 813 ContinueStmt stmt = (ContinueStmt)iter.next(); 814 if(!stmt.isDUafterReachedFinallyBlocks(v)) 815 return false; 816 } 817 return true; 818 } 819 finally { 820 } 821 } 822 protected java.util.Map localLookup_String_values; 823 /** 824 * @attribute syn 825 * @aspect VariableScope 826 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/LookupVariable.jrag:91 827 */ 828 @SuppressWarnings({"unchecked", "cast"}) 829 public SimpleSet localLookup(String name) { 830 Object _parameters = name; 831 if(localLookup_String_values == null) localLookup_String_values = new java.util.HashMap(4); 832 if(localLookup_String_values.containsKey(_parameters)) { 833 return (SimpleSet)localLookup_String_values.get(_parameters); 834 } 835 ASTNode$State state = state(); 836 int num = state.boundariesCrossed; 837 boolean isFinal = this.is$Final(); 838 SimpleSet localLookup_String_value = localLookup_compute(name); 839 if(isFinal && num == state().boundariesCrossed){ localLookup_String_values.put(_parameters, localLookup_String_value); } 840 return localLookup_String_value; 841 } 842 /** 843 * @apilevel internal 844 */ 845 private SimpleSet localLookup_compute(String name) { 846 VariableDeclaration v = localVariableDeclaration(name); 847 if(v != null) return v; 848 return lookupVariable(name); 849 } 850 protected java.util.Map localVariableDeclaration_String_values; 851 /** 852 * @attribute syn 853 * @aspect VariableScope 854 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/LookupVariable.jrag:123 855 */ 856 @SuppressWarnings({"unchecked", "cast"}) 857 public VariableDeclaration localVariableDeclaration(String name) { 858 Object _parameters = name; 859 if(localVariableDeclaration_String_values == null) localVariableDeclaration_String_values = new java.util.HashMap(4); 860 if(localVariableDeclaration_String_values.containsKey(_parameters)) { 861 return (VariableDeclaration)localVariableDeclaration_String_values.get(_parameters); 862 } 863 ASTNode$State state = state(); 864 int num = state.boundariesCrossed; 865 boolean isFinal = this.is$Final(); 866 VariableDeclaration localVariableDeclaration_String_value = localVariableDeclaration_compute(name); 867 if(isFinal && num == state().boundariesCrossed){ localVariableDeclaration_String_values.put(_parameters, localVariableDeclaration_String_value); } 868 return localVariableDeclaration_String_value; 869 } 870 /** 871 * @apilevel internal 872 */ 873 private VariableDeclaration localVariableDeclaration_compute(String name) { 874 for(int i = 0; i < getNumInitStmt(); i++) 875 if(getInitStmt(i).declaresVariable(name)) 876 return (VariableDeclaration)getInitStmt(i); 877 return null; 878 } 879 /** 880 * @attribute syn 881 * @aspect NameCheck 882 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/NameCheck.jrag:401 883 */ 884 public boolean continueLabel() { 885 ASTNode$State state = state(); 886 try { return true; } 887 finally { 888 } 889 } 890 /** 891 * @apilevel internal 892 */ 893 protected boolean canCompleteNormally_computed = false; 894 /** 895 * @apilevel internal 896 */ 897 protected boolean canCompleteNormally_value; 898 /** 899 * @attribute syn 900 * @aspect UnreachableStatements 901 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/UnreachableStatements.jrag:102 902 */ 903 @SuppressWarnings({"unchecked", "cast"}) 904 public boolean canCompleteNormally() { 905 if(canCompleteNormally_computed) { 906 return canCompleteNormally_value; 907 } 908 ASTNode$State state = state(); 909 int num = state.boundariesCrossed; 910 boolean isFinal = this.is$Final(); 911 canCompleteNormally_value = canCompleteNormally_compute(); 912 if(isFinal && num == state().boundariesCrossed){ canCompleteNormally_computed = true; } 913 return canCompleteNormally_value; 914 } 915 /** 916 * @apilevel internal 917 */ 918 private boolean canCompleteNormally_compute() { return reachable() && hasCondition() && (!getCondition().isConstant() || !getCondition().isTrue()) || reachableBreak(); } 919 protected java.util.Map variableScopeEndLabel_CodeGeneration_values; 920 /** 921 * @attribute syn 922 * @aspect CodeGeneration 923 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Backend/CodeGeneration.jrag:45 924 */ 925 @SuppressWarnings({"unchecked", "cast"}) 926 public int variableScopeEndLabel(CodeGeneration gen) { 927 Object _parameters = gen; 928 if(variableScopeEndLabel_CodeGeneration_values == null) variableScopeEndLabel_CodeGeneration_values = new java.util.HashMap(4); 929 if(variableScopeEndLabel_CodeGeneration_values.containsKey(_parameters)) { 930 return ((Integer)variableScopeEndLabel_CodeGeneration_values.get(_parameters)).intValue(); 931 } 932 ASTNode$State state = state(); 933 int num = state.boundariesCrossed; 934 boolean isFinal = this.is$Final(); 935 int variableScopeEndLabel_CodeGeneration_value = variableScopeEndLabel_compute(gen); 936 if(isFinal && num == state().boundariesCrossed){ variableScopeEndLabel_CodeGeneration_values.put(_parameters, Integer.valueOf(variableScopeEndLabel_CodeGeneration_value)); } 937 return variableScopeEndLabel_CodeGeneration_value; 938 } 939 /** 940 * @apilevel internal 941 */ 942 private int variableScopeEndLabel_compute(CodeGeneration gen) { return gen.variableScopeLabel(); } 943 /** 944 * @attribute syn 945 * @aspect CreateBCode 946 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Backend/CreateBCode.jrag:946 947 */ 948 public boolean definesLabel() { 949 ASTNode$State state = state(); 950 try { return true; } 951 finally { 952 } 953 } 954 /** 955 * @apilevel internal 956 */ 957 protected boolean cond_label_computed = false; 958 /** 959 * @apilevel internal 960 */ 961 protected int cond_label_value; 962 /** 963 * @attribute syn 964 * @aspect CreateBCode 965 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Backend/CreateBCode.jrag:1372 966 */ 967 @SuppressWarnings({"unchecked", "cast"}) 968 public int cond_label() { 969 if(cond_label_computed) { 970 return cond_label_value; 971 } 972 ASTNode$State state = state(); 973 int num = state.boundariesCrossed; 974 boolean isFinal = this.is$Final(); 975 cond_label_value = cond_label_compute(); 976 if(isFinal && num == state().boundariesCrossed){ cond_label_computed = true; } 977 return cond_label_value; 978 } 979 /** 980 * @apilevel internal 981 */ 982 private int cond_label_compute() { return hostType().constantPool().newLabel(); } 983 /** 984 * @apilevel internal 985 */ 986 protected boolean begin_label_computed = false; 987 /** 988 * @apilevel internal 989 */ 990 protected int begin_label_value; 991 /** 992 * @attribute syn 993 * @aspect CreateBCode 994 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Backend/CreateBCode.jrag:1373 995 */ 996 @SuppressWarnings({"unchecked", "cast"}) 997 public int begin_label() { 998 if(begin_label_computed) { 999 return begin_label_value; 1000 } 1001 ASTNode$State state = state(); 1002 int num = state.boundariesCrossed; 1003 boolean isFinal = this.is$Final(); 1004 begin_label_value = begin_label_compute(); 1005 if(isFinal && num == state().boundariesCrossed){ begin_label_computed = true; } 1006 return begin_label_value; 1007 } 1008 /** 1009 * @apilevel internal 1010 */ 1011 private int begin_label_compute() { return hostType().constantPool().newLabel(); } 1012 /** 1013 * @apilevel internal 1014 */ 1015 protected boolean update_label_computed = false; 1016 /** 1017 * @apilevel internal 1018 */ 1019 protected int update_label_value; 1020 /** 1021 * @attribute syn 1022 * @aspect CreateBCode 1023 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Backend/CreateBCode.jrag:1374 1024 */ 1025 @SuppressWarnings({"unchecked", "cast"}) 1026 public int update_label() { 1027 if(update_label_computed) { 1028 return update_label_value; 1029 } 1030 ASTNode$State state = state(); 1031 int num = state.boundariesCrossed; 1032 boolean isFinal = this.is$Final(); 1033 update_label_value = update_label_compute(); 1034 if(isFinal && num == state().boundariesCrossed){ update_label_computed = true; } 1035 return update_label_value; 1036 } 1037 /** 1038 * @apilevel internal 1039 */ 1040 private int update_label_compute() { return hostType().constantPool().newLabel(); } 1041 /** 1042 * @apilevel internal 1043 */ 1044 protected boolean end_label_computed = false; 1045 /** 1046 * @apilevel internal 1047 */ 1048 protected int end_label_value; 1049 /** 1050 * @attribute syn 1051 * @aspect CreateBCode 1052 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Backend/CreateBCode.jrag:1375 1053 */ 1054 @SuppressWarnings({"unchecked", "cast"}) 1055 public int end_label() { 1056 if(end_label_computed) { 1057 return end_label_value; 1058 } 1059 ASTNode$State state = state(); 1060 int num = state.boundariesCrossed; 1061 boolean isFinal = this.is$Final(); 1062 end_label_value = end_label_compute(); 1063 if(isFinal && num == state().boundariesCrossed){ end_label_computed = true; } 1064 return end_label_value; 1065 } 1066 /** 1067 * @apilevel internal 1068 */ 1069 private int end_label_compute() { return hostType().constantPool().newLabel(); } 1070 /** 1071 * @attribute syn 1072 * @aspect CreateBCode 1073 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Backend/CreateBCode.jrag:1398 1074 */ 1075 public int break_label() { 1076 ASTNode$State state = state(); 1077 try { return end_label(); } 1078 finally { 1079 } 1080 } 1081 /** 1082 * @attribute syn 1083 * @aspect CreateBCode 1084 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Backend/CreateBCode.jrag:1417 1085 */ 1086 public int continue_label() { 1087 ASTNode$State state = state(); 1088 try { return update_label(); } 1089 finally { 1090 } 1091 } 1092 /** 1093 * @attribute syn 1094 * @aspect PreciseRethrow 1095 * @declaredat /home/jesper/svn/JastAddJ/Java7Frontend/PreciseRethrow.jrag:55 1096 */ 1097 public boolean modifiedInScope(Variable var) { 1098 ASTNode$State state = state(); 1099 try { 1100 for (Stmt stmt : getInitStmtList()) 1101 if (stmt.modifiedInScope(var)) 1102 return true; 1103 for (Stmt stmt : getUpdateStmtList()) 1104 if (stmt.modifiedInScope(var)) 1105 return true; 1106 return getStmt().modifiedInScope(var); 1107 } 1108 finally { 1109 } 1110 } 1111 protected java.util.Map lookupVariable_String_values; 1112 /** 1113 * @attribute inh 1114 * @aspect VariableScope 1115 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/LookupVariable.jrag:18 1116 */ 1117 @SuppressWarnings({"unchecked", "cast"}) 1118 public SimpleSet lookupVariable(String name) { 1119 Object _parameters = name; 1120 if(lookupVariable_String_values == null) lookupVariable_String_values = new java.util.HashMap(4); 1121 if(lookupVariable_String_values.containsKey(_parameters)) { 1122 return (SimpleSet)lookupVariable_String_values.get(_parameters); 1123 } 1124 ASTNode$State state = state(); 1125 int num = state.boundariesCrossed; 1126 boolean isFinal = this.is$Final(); 1127 SimpleSet lookupVariable_String_value = getParent().Define_SimpleSet_lookupVariable(this, null, name); 1128 if(isFinal && num == state().boundariesCrossed){ lookupVariable_String_values.put(_parameters, lookupVariable_String_value); } 1129 return lookupVariable_String_value; 1130 } 1131 /** 1132 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/DefiniteAssignment.jrag:636 1133 * @apilevel internal 1134 */ 1135 public boolean Define_boolean_isDAbefore(ASTNode caller, ASTNode child, Variable v) { 1136 if(caller == getUpdateStmtListNoTransform()) { 1137 int childIndex = caller.getIndexOfChild(child); 1138 { 1139 if(!getStmt().isDAafter(v)) 1140 return false; 1141 for(Iterator iter = targetContinues().iterator(); iter.hasNext(); ) { 1142 ContinueStmt stmt = (ContinueStmt)iter.next(); 1143 if(!stmt.isDAafterReachedFinallyBlocks(v)) 1144 return false; 1145 } 1146 return true; 1147 } 1148 } 1149 else if(caller == getStmtNoTransform()){ 1150 if(hasCondition() && getCondition().isDAafterTrue(v)) 1151 return true; 1152 if(!hasCondition() && isDAafterInitialization(v)) 1153 return true; 1154 return false; 1155 } 1156 else if(caller == getConditionOptNoTransform()) { 1157 return isDAafterInitialization(v); 1158 } 1159 else if(caller == getInitStmtListNoTransform()) { 1160 int i = caller.getIndexOfChild(child); 1161 return i == 0 ? isDAbefore(v) : getInitStmt(i-1).isDAafter(v); 1162 } 1163 else { return getParent().Define_boolean_isDAbefore(this, caller, v); 1164 } 1165 } 1166 /** 1167 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/DefiniteAssignment.jrag:1145 1168 * @apilevel internal 1169 */ 1170 public boolean Define_boolean_isDUbefore(ASTNode caller, ASTNode child, Variable v) { 1171 if(caller == getUpdateStmtListNoTransform()) { 1172 int i = caller.getIndexOfChild(child); 1173 { 1174 if(!isDUbeforeCondition(v)) // start a circular evaluation here 1175 return false; 1176 if(i == 0) { 1177 if(!getStmt().isDUafter(v)) 1178 return false; 1179 for(Iterator iter = targetContinues().iterator(); iter.hasNext(); ) { 1180 ContinueStmt stmt = (ContinueStmt)iter.next(); 1181 if(!stmt.isDUafterReachedFinallyBlocks(v)) 1182 return false; 1183 } 1184 return true; 1185 } 1186 else 1187 return getUpdateStmt(i-1).isDUafter(v); 1188 } 1189 } 1190 else if(caller == getStmtNoTransform()) { 1191 return isDUbeforeCondition(v) && (hasCondition() ? 1192 getCondition().isDUafterTrue(v) : isDUafterInit(v)); 1193 } 1194 else if(caller == getConditionOptNoTransform()) { 1195 return isDUbeforeCondition(v); 1196 } 1197 else if(caller == getInitStmtListNoTransform()) { 1198 int childIndex = caller.getIndexOfChild(child); 1199 return childIndex == 0 ? isDUbefore(v) : getInitStmt(childIndex-1).isDUafter(v); 1200 } 1201 else { return getParent().Define_boolean_isDUbefore(this, caller, v); 1202 } 1203 } 1204 /** 1205 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/LookupVariable.jrag:90 1206 * @apilevel internal 1207 */ 1208 public SimpleSet Define_SimpleSet_lookupVariable(ASTNode caller, ASTNode child, String name) { 1209 if(caller == getStmtNoTransform()) { 1210 return localLookup(name); 1211 } 1212 else if(caller == getUpdateStmtListNoTransform()) { 1213 int childIndex = caller.getIndexOfChild(child); 1214 return localLookup(name); 1215 } 1216 else if(caller == getConditionOptNoTransform()) { 1217 return localLookup(name); 1218 } 1219 else if(caller == getInitStmtListNoTransform()) { 1220 int childIndex = caller.getIndexOfChild(child); 1221 return localLookup(name); 1222 } 1223 else { return getParent().Define_SimpleSet_lookupVariable(this, caller, name); 1224 } 1225 } 1226 /** 1227 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/NameCheck.jrag:299 1228 * @apilevel internal 1229 */ 1230 public VariableScope Define_VariableScope_outerScope(ASTNode caller, ASTNode child) { 1231 if(caller == getStmtNoTransform()) { 1232 return this; 1233 } 1234 else if(caller == getInitStmtListNoTransform()) { 1235 int childIndex = caller.getIndexOfChild(child); 1236 return this; 1237 } 1238 else { return getParent().Define_VariableScope_outerScope(this, caller); 1239 } 1240 } 1241 /** 1242 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/NameCheck.jrag:370 1243 * @apilevel internal 1244 */ 1245 public boolean Define_boolean_insideLoop(ASTNode caller, ASTNode child) { 1246 if(caller == getStmtNoTransform()) { 1247 return true; 1248 } 1249 else { return getParent().Define_boolean_insideLoop(this, caller); 1250 } 1251 } 1252 /** 1253 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/UnreachableStatements.jrag:103 1254 * @apilevel internal 1255 */ 1256 public boolean Define_boolean_reachable(ASTNode caller, ASTNode child) { 1257 if(caller == getStmtNoTransform()) { 1258 return reachable() && (!hasCondition() || (!getCondition().isConstant() || !getCondition().isFalse())); 1259 } 1260 else { return getParent().Define_boolean_reachable(this, caller); 1261 } 1262 } 1263 /** 1264 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/UnreachableStatements.jrag:151 1265 * @apilevel internal 1266 */ 1267 public boolean Define_boolean_reportUnreachable(ASTNode caller, ASTNode child) { 1268 if(caller == getStmtNoTransform()) { 1269 return reachable(); 1270 } 1271 else { return getParent().Define_boolean_reportUnreachable(this, caller); 1272 } 1273 } 1274 /** 1275 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Backend/CodeGeneration.jrag:46 1276 * @apilevel internal 1277 */ 1278 public int Define_int_variableScopeEndLabel(ASTNode caller, ASTNode child, CodeGeneration gen) { 1279 if(caller == getInitStmtListNoTransform()) { 1280 int i = caller.getIndexOfChild(child); 1281 return variableScopeEndLabel(gen); 1282 } 1283 else { return getParent().Define_int_variableScopeEndLabel(this, caller, gen); 1284 } 1285 } 1286 /** 1287 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Backend/CreateBCode.jrag:969 1288 * @apilevel internal 1289 */ 1290 public int Define_int_condition_false_label(ASTNode caller, ASTNode child) { 1291 if(caller == getConditionOptNoTransform()) { 1292 return end_label(); 1293 } 1294 else { return getParent().Define_int_condition_false_label(this, caller); 1295 } 1296 } 1297 /** 1298 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Backend/CreateBCode.jrag:970 1299 * @apilevel internal 1300 */ 1301 public int Define_int_condition_true_label(ASTNode caller, ASTNode child) { 1302 if(caller == getConditionOptNoTransform()) { 1303 return begin_label(); 1304 } 1305 else { return getParent().Define_int_condition_true_label(this, caller); 1306 } 1307 } 1308 /** 1309 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Backend/LocalNum.jrag:102 1310 * @apilevel internal 1311 */ 1312 public int Define_int_localNum(ASTNode caller, ASTNode child) { 1313 if(caller == getInitStmtListNoTransform()) { 1314 int index = caller.getIndexOfChild(child); 1315 { 1316 if(index == 0) 1317 return localNum(); 1318 if(getInitStmt(index-1) instanceof VariableDeclaration) 1319 return getInitStmt(index-1).localNum() + ((VariableDeclaration)getInitStmt(index-1)).type().variableSize(); 1320 return getInitStmt(index-1).localNum(); 1321 } 1322 } 1323 else if(caller == getStmtNoTransform()){ 1324 if(getNumInitStmt() == 0) 1325 return localNum(); 1326 if(getInitStmt(getNumInitStmt()-1) instanceof VariableDeclaration) 1327 return getInitStmt(getNumInitStmt()-1).localNum() + ((VariableDeclaration)getInitStmt(getNumInitStmt()-1)).type().variableSize(); 1328 return getInitStmt(getNumInitStmt()-1).localNum(); 1329 } 1330 else { return getParent().Define_int_localNum(this, caller); 1331 } 1332 } 1333 /** 1334 * @apilevel internal 1335 */ 1336 public ASTNode rewriteTo() { 1337 // Declared in /home/jesper/svn/JastAddJ/Java1.4Frontend/DefiniteAssignment.jrag at line 1163 1338 if(!hasCondition()) { 1339 state().duringDU++; 1340 ASTNode result = rewriteRule0(); 1341 state().duringDU--; 1342 return result; 1343 } 1344 1345 return super.rewriteTo(); 1346 } 1347 /** 1348 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/DefiniteAssignment.jrag:1163 1349 * @apilevel internal 1350 */ private ForStmt rewriteRule0() { 1351 { 1352 setCondition(new BooleanLiteral("true")); 1353 return this; 1354 } } 1355 }