jltools.ext.jl.ast
Class Initializer_c

java.lang.Object
  |
  +--jltools.ext.jl.ast.Node_c
        |
        +--jltools.ext.jl.ast.Initializer_c
All Implemented Interfaces:
ClassMember, java.lang.Cloneable, Copy, Initializer, Node, java.io.Serializable

public class Initializer_c
extends Node_c
implements Initializer

An Initializer is an immutable representation of an initializer block in a Java class (which appears outside of any method). Such a block is executed before the code for any of the constructors. Such a block can optionally be static, in which case it is executed when the class is loaded.

See Also:
Serialized Form

Inner classes inherited from class jltools.ext.jl.ast.Node_c
Node_c.StringCodeWriter
 
Field Summary
protected  <>Block body
           
protected  Flags flags
           
protected  InitializerInstance ii
           
 
Fields inherited from class jltools.ext.jl.ast.Node_c
ext, position
 
Constructor Summary
Initializer_c(Ext ext, Position pos, Flags flags, <>Block body)
           
 
Method Summary
 <>Block body()
          Get the body of the initializer.
 Initializer body(<>Block body)
          Set the body of the initializer.
 Node buildTypesOverride_(TypeBuilder tb)
          Build type objects for the initializer.
 void dump(CodeWriter w)
          Dump the AST node for debugging purposes.
 void enterScope(Context c)
          Adjust the environment on entering the scope of the method.
 Node exceptionCheck_(ExceptionChecker ec)
          Check exceptions thrown by the initializer.
 Flags flags()
          Get the flags of the initializer.
 Initializer flags(Flags flags)
          Set the flags of the initializer.
 InitializerInstance initializerInstance()
          Get the initializer instance of the initializer.
 Initializer initializerInstance(InitializerInstance ii)
          Set the initializer instance of the initializer.
 void leaveScope(Context c)
          Adjust the environment on leaving the scope of the method.
protected  Initializer_c reconstruct(<>Block body)
          Reconstruct the initializer.
 Node reconstructTypes_(NodeFactory nf, TypeSystem ts, Context c)
          Reconstruct the type objects for the initializer.
 java.lang.String toString()
           
 void translate_(CodeWriter w, Translator tr)
          Write the initializer to an output file.
 Node typeCheck_(TypeChecker tc)
          Type check the initializer.
 Node visitChildren(NodeVisitor v)
          Visit the children of the initializer.
 
Methods inherited from class jltools.ext.jl.ast.Node_c
buildTypes_, buildTypes, buildTypesOverride, copy, disambiguate_, disambiguate, disambiguateOverride_, disambiguateOverride, disambiguateTypes_, disambiguateTypes, disambiguateTypesOverride_, disambiguateTypesOverride, exceptionCheck, exceptionCheckOverride_, exceptionCheckOverride, ext, ext, foldConstants_, foldConstants, foldConstantsOverride_, foldConstantsOverride, position, position, reconstructTypes, translate, translateBlock, translateSubstmt, typeCheck, typeCheckOverride_, typeCheckOverride, visit, visitList
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jltools.ast.Initializer
body
 
Methods inherited from interface jltools.ast.Node
buildTypes_, copy, disambiguate_, disambiguateOverride_, disambiguateTypes_, disambiguateTypesOverride_, exceptionCheckOverride_, ext, ext, foldConstants_, foldConstantsOverride_, position, position, typeCheckOverride_, visit
 

Field Detail

flags

protected Flags flags

body

protected <>Block body

ii

protected InitializerInstance ii
Constructor Detail

Initializer_c

public Initializer_c(Ext ext,
                     Position pos,
                     Flags flags,
                     <>Block body)
Method Detail

flags

public Flags flags()
Get the flags of the initializer.
Specified by:
flags in interface Initializer

flags

public Initializer flags(Flags flags)
Set the flags of the initializer.
Specified by:
flags in interface Initializer

initializerInstance

public InitializerInstance initializerInstance()
Get the initializer instance of the initializer.
Specified by:
initializerInstance in interface Initializer

initializerInstance

public Initializer initializerInstance(InitializerInstance ii)
Set the initializer instance of the initializer.

body

public <>Block body()
Get the body of the initializer.
Specified by:
body in interface Initializer

body

public Initializer body(<>Block body)
Set the body of the initializer.

reconstruct

protected Initializer_c reconstruct(<>Block body)
Reconstruct the initializer.

visitChildren

public Node visitChildren(NodeVisitor v)
Visit the children of the initializer.
Specified by:
visitChildren in interface Node
Overrides:
visitChildren in class Node_c

enterScope

public void enterScope(Context c)
Description copied from interface: Node
Adjust the environment on entering the scope of the method.
Specified by:
enterScope in interface Node
Overrides:
enterScope in class Node_c

leaveScope

public void leaveScope(Context c)
Description copied from interface: Node
Adjust the environment on leaving the scope of the method.
Specified by:
leaveScope in interface Node
Overrides:
leaveScope in class Node_c

buildTypesOverride_

public Node buildTypesOverride_(TypeBuilder tb)
Build type objects for the initializer.
Specified by:
buildTypesOverride_ in interface Node
Overrides:
buildTypesOverride_ in class Node_c
Following copied from interface: jltools.ast.Node
Parameters:
cb - The visitor which adds new type objects to the TypeSystem.

typeCheck_

public Node typeCheck_(TypeChecker tc)
                throws SemanticException
Type check the initializer.
Specified by:
typeCheck_ in interface Node
Overrides:
typeCheck_ in class Node_c

exceptionCheck_

public Node exceptionCheck_(ExceptionChecker ec)
                     throws SemanticException
Check exceptions thrown by the initializer.
Specified by:
exceptionCheck_ in interface Node
Overrides:
exceptionCheck_ in class Node_c

translate_

public void translate_(CodeWriter w,
                       Translator tr)
Write the initializer to an output file.
Specified by:
translate_ in interface Node
Overrides:
translate_ in class Node_c
Following copied from interface: jltools.ast.Node
Parameters:
w - The code writer to which to write.
tr - The translation pass. This is not a visitor.

dump

public void dump(CodeWriter w)
Description copied from interface: Node
Dump the AST node for debugging purposes.
Specified by:
dump in interface Node
Overrides:
dump in class Node_c

toString

public java.lang.String toString()
Overrides:
toString in class Node_c

reconstructTypes_

public Node reconstructTypes_(NodeFactory nf,
                              TypeSystem ts,
                              Context c)
                       throws SemanticException
Reconstruct the type objects for the initializer.
Specified by:
reconstructTypes_ in interface Node
Overrides:
reconstructTypes_ in class Node_c