445 446 return Node.replaceInLexicalContext(lc, this, new Block(this, finish, statements, flags | NEEDS_SCOPE, symbols, conversion)); 447 } 448 449 /** 450 * Computationally determine the next slot for this block, 451 * indexed from 0. Use this as a relative base when computing 452 * frames 453 * @return next slot 454 */ 455 public int nextSlot() { 456 int next = 0; 457 for (final Symbol symbol : getSymbols()) { 458 if (symbol.hasSlot()) { 459 next += symbol.slotCount(); 460 } 461 } 462 return next; 463 } 464 465 @Override 466 public boolean isBreakableWithoutLabel() { 467 return false; 468 } 469 470 @Override 471 public List<Label> getLabels() { 472 return Collections.unmodifiableList(Arrays.asList(entryLabel, breakLabel)); 473 } 474 475 @Override 476 public Node accept(final NodeVisitor<? extends LexicalContext> visitor) { 477 return Acceptor.accept(this, visitor); 478 } 479 } | 445 446 return Node.replaceInLexicalContext(lc, this, new Block(this, finish, statements, flags | NEEDS_SCOPE, symbols, conversion)); 447 } 448 449 /** 450 * Computationally determine the next slot for this block, 451 * indexed from 0. Use this as a relative base when computing 452 * frames 453 * @return next slot 454 */ 455 public int nextSlot() { 456 int next = 0; 457 for (final Symbol symbol : getSymbols()) { 458 if (symbol.hasSlot()) { 459 next += symbol.slotCount(); 460 } 461 } 462 return next; 463 } 464 465 /** 466 * Determine whether this block needs to provide its scope object creator for use by its child nodes. 467 * This is only necessary for synthetic parent blocks of for-in loops with lexical declarations. 468 * 469 * @return true if child nodes need access to this block's scope creator 470 */ 471 public boolean providesScopeCreator() { 472 return needsScope() && isSynthetic() 473 && (getLastStatement() instanceof ForNode) 474 && ((ForNode) getLastStatement()).needsScopeCreator(); 475 } 476 477 @Override 478 public boolean isBreakableWithoutLabel() { 479 return false; 480 } 481 482 @Override 483 public List<Label> getLabels() { 484 return Collections.unmodifiableList(Arrays.asList(entryLabel, breakLabel)); 485 } 486 487 @Override 488 public Node accept(final NodeVisitor<? extends LexicalContext> visitor) { 489 return Acceptor.accept(this, visitor); 490 } 491 } |