AST
node type BasicTWR

General Info

Production
BasicTWR : Stmt ::= Resource:ResourceDeclaration Block;
Type Hierarchy:
java.lang.Object
  extended by beaver.Symbol
      extended by AST.ASTNode<ASTNode>
          extended by AST.Stmt
              extended by AST.BasicTWR
All Implemented Interfaces:
VariableScope, java.lang.Cloneable, java.lang.Iterable<ASTNode>

Description

Source
Declared in Java7Backend/BasicTWR.ast at line 1

Member Filters

API level:

Aspect:

Constructors

public BasicTWR()
 

Attributes

syn SimpleSet localLookup(java.lang.String name)
Source
Declared in Java7Backend/MultiCatch.jrag at line 78
Aspect
MultiCatch
syn VariableDeclaration localVariableDeclaration(java.lang.String name)
Source
Declared in Java7Backend/MultiCatch.jrag at line 83
Aspect
MultiCatch
syn boolean modifiedInScope(Variable var)
Specified by:modifiedInScope in class Stmt
Source
Declared in Java7Frontend/PreciseRethrow.jrag at line 55
Aspect
PreciseRethrow
inh SimpleSet lookupVariable(java.lang.String name)
Specified by:lookupVariable in interface VariableScopeOverrides:lookupVariable in class Stmt
Source
Declared in Java7Backend/MultiCatch.jrag at line 87
Aspect
MultiCatch

Methods

public void flushCache()
Overrides:flushCache in class Stmt
public void flushCollectionCache()
Overrides:flushCollectionCache in class Stmt
public BasicTWR clone()
               throws java.lang.CloneNotSupportedException
Overrides:clone in class Stmt
Throws:
java.lang.CloneNotSupportedException
public BasicTWR copy()
Overrides:copy in class ASTNode<ASTNode>
Create a deep copy of the AST subtree at this node. The copy is dangling, i.e. has no parent.
Overrides:fullCopy in class ASTNode<ASTNode>
Returns:
dangling copy of the subtree at this node
public void createBCode(CodeGeneration gen)
The general structure of the basic try-with-resources:

 RESOURCE
 BLOCK

 Primary Exception Handler
   Automatic Closing of Resource
     Suppressed Exception Handler
   re-throw primary exception
 Automatic Closing of Resource
 
Pseudocode for basic try-with-resources:

 0  .resourceBegin
 1  emit RESOURCE
 0  store resource
 0  .resourceEnd

 0  .blockBegin
 0  emit BLOCK
 0  .blockEnd
 0  goto outerFinally

 1  .resourceException
 1  throw

 #if BLOCK is not empty:

 1  .catchPrimary
 0  store primary

 0  .tryCloseBegin
 1  load resource
 0  ifnull innerFinally
 1  load resource
 0  invoke java.lang.AutoCloseable.close()
 0  .tryCloseEnd

 0  goto innerFinally

 1  .catchSuppressed
 0  store suppressed
 1  load primary
 2  load suppressed
 0  invoke java.lang.Throwable.addSuppressed(Throwable)

 0  .innerFinally
 1  load primary
 1  throw

 #endif BLOCK is not empty

 0  .outerFinally
 1  load resource
 0  ifnull tryEnd
 1  load resource
 0  invoke java.lang.AutoCloseable.close()

 0  .tryEnd

 Exception Table:
 resourceBegin .. resourceEnd : resourceException
 blockBegin .. blockEnd : catchPrimary
 tryCloseBegin .. tryCloseEnd : catchSuppressed
 
Overrides:createBCode in class Stmt
Source
Declared in Java7Backend/TryWithResources.jrag at line 136
Aspect
TryWithResources
public void init$Children()
Initializes the child array to the correct size. Initializes List and Opt nta children.
Overrides:init$Children in class Stmt
protected int numChildren()
Overrides:numChildren in class Stmt
public boolean mayHaveRewrite()
Overrides:mayHaveRewrite in class Stmt
public void setResource(ResourceDeclaration node)
Replaces the Resource child.
Parameters:
node - The new node to replace the Resource child.
Retrieves the Resource child.
Returns:
The current node used as the Resource child.
Retrieves the Resource child.

This method does not invoke AST transformations.

Returns:
The current node used as the Resource child.
public void setBlock(Block node)
Replaces the Block child.
Parameters:
node - The new node to replace the Block child.
public Block getBlock()
Retrieves the Block child.
Returns:
The current node used as the Block child.
Retrieves the Block child.

This method does not invoke AST transformations.

Returns:
The current node used as the Block child.
public SimpleSet Define_SimpleSet_lookupVariable(ASTNode caller,
                                                 ASTNode child,
                                                 java.lang.String name)
Overrides:Define_SimpleSet_lookupVariable in class ASTNode<ASTNode>
Source
Declared in Java7Backend/MultiCatch.jrag at line 76
public int Define_int_localNum(ASTNode caller,
                               ASTNode child)
Overrides:Define_int_localNum in class ASTNode<ASTNode>
Source
Declared in Java7Backend/TryWithResources.jrag at line 292
Overrides:rewriteTo in class Stmt

Fields

protected java.util.Map localLookup_String_values
protected java.util.Map lookupVariable_String_values

Inherited Members

Attributes inherited from AST.Stmt

Attributes inherited from AST.ASTNode

Methods inherited from class AST.Stmt

Methods inherited from class AST.ASTNode

Methods inherited from class beaver.Symbol

getColumn
getEnd
getId
getLine
getStart
makePosition

Methods inherited from class java.lang.Object

equals
finalize
getClass
hashCode
notify
notifyAll
wait
wait
wait

Methods inherited from interface AST.VariableScope

Fields inherited from AST.Stmt

Fields inherited from AST.ASTNode

Fields inherited from beaver.Symbol

end
id
start
value