All Implemented Interfaces:
TypeConstants, TypeIds

public class Block extends Statement
  • Field Details

    • statements

      public Statement[] statements
    • explicitDeclarations

      public int explicitDeclarations
    • scope

      public BlockScope scope
  • Constructor Details

    • Block

      public Block(int explicitDeclarations)
  • Method Details

    • analyseCode

      public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo)
      Specified by:
      analyseCode in class Statement
    • generateCode

      public void generateCode(BlockScope currentScope, CodeStream codeStream)
      Code generation for a block
      Specified by:
      generateCode in class Statement
    • isEmptyBlock

      public boolean isEmptyBlock()
      Overrides:
      isEmptyBlock in class Statement
    • printBody

      public StringBuffer printBody(int indent, StringBuffer output)
    • printStatement

      public StringBuffer printStatement(int indent, StringBuffer output)
      Specified by:
      printStatement in class Statement
    • resolve

      public void resolve(BlockScope upperScope)
      Specified by:
      resolve in class Statement
    • resolveUsing

      public void resolveUsing(BlockScope givenScope)
    • traverse

      public void traverse(ASTVisitor visitor, BlockScope blockScope)
      Overrides:
      traverse in class ASTNode
    • branchChainTo

      public void branchChainTo(BranchLabel label)
      Dispatch the call on its last statement.
      Overrides:
      branchChainTo in class Statement
    • doesNotCompleteNormally

      public boolean doesNotCompleteNormally()
      Description copied from class: Statement
      Lambda shape analysis: *Assuming* this is reachable, analyze if this completes normally i.e control flow can reach the textually next statement. For blocks, we don't perform intra-reachability analysis. We assume the lambda body is free of intrinsic control flow errors (if such errors exist they will not be flagged by this analysis, but are guaranteed to surface later on.)
      Overrides:
      doesNotCompleteNormally in class Statement
      See Also:
      doesNotCompleteNormally()
    • completesByContinue

      public boolean completesByContinue()
      Description copied from class: Statement
      Lambda shape analysis: *Assuming* this is reachable, analyze if this completes by continuing i.e control flow cannot reach the textually next statement. This is necessitated by the fact that continue claims to not complete normally. So this is necessary to discriminate between do { continue; } while (false); which completes normally and do { throw new Exception(); } while (false); which does not complete normally.
      Overrides:
      completesByContinue in class Statement
    • canCompleteNormally

      public boolean canCompleteNormally()
      Description copied from class: Statement
      Switch Expression analysis: *Assuming* this is reachable, analyze if this completes normally i.e control flow can reach the textually next statement, as per JLS 14 Sec 14.22 For blocks, we don't perform intra-reachability analysis. Note: delinking this from a similar (opposite) Statement.doesNotCompleteNormally() since that was coded for a specific purpose of Lambda Shape Analysis.
      Overrides:
      canCompleteNormally in class Statement
    • continueCompletes

      public boolean continueCompletes()
      Description copied from class: Statement
      The equivalent function of completesByContinue - implements both the rules concerning continue with and without a label.
      Overrides:
      continueCompletes in class Statement