jltools.ext.jl.ast
Class LocalDecl_c

java.lang.Object
  |
  +--jltools.ext.jl.ast.Node_c
        |
        +--jltools.ext.jl.ast.Stmt_c
              |
              +--jltools.ext.jl.ast.LocalDecl_c
All Implemented Interfaces:
java.lang.Cloneable, Copy, ForInit, LocalDecl, Node, java.io.Serializable, Stmt

public class LocalDecl_c
extends Stmt_c
implements LocalDecl

A local variable declaration statement: a type, a name and an optional initializer.

See Also:
Serialized Form

Inner classes inherited from class jltools.ext.jl.ast.Node_c
Node_c.StringCodeWriter
 
Fields inherited from class jltools.ext.jl.ast.Node_c
ext, position
 
Constructor Summary
LocalDecl_c(Ext ext, Position pos, Flags flags, TypeNode type, java.lang.String name, Expr init)
           
 
Method Summary
 Node buildTypes_(TypeBuilder tb)
          Build type objects for the declaration.
protected  Declarator decl()
          Get the declarator.
protected  LocalDecl decl(Declarator decl)
          Set the declarator.
 Type declType()
          Get the type of the declaration.
 void dump(CodeWriter w)
          Dump the AST node for debugging purposes.
 Flags flags()
          Get the flags of the declaration.
 LocalDecl flags(Flags flags)
          Set the flags of the declaration.
 Expr init()
          Get the initializer of the declaration.
 LocalDecl init(Expr init)
          Set the initializer of the declaration.
 void leaveScope(Context c)
          Add the variable to the scope after the declaration.
 LocalInstance localInstance()
          Get the local instance of the declaration.
 LocalDecl localInstance(LocalInstance li)
          Set the local instance of the declaration.
 java.lang.String name()
          Get the name of the declaration.
 LocalDecl name(java.lang.String name)
          Set the name of the declaration.
protected  LocalDecl_c reconstruct(TypeNode type, Expr init)
          Reconstruct the declaration.
 Node reconstructTypes_(NodeFactory nf, TypeSystem ts, Context c)
          Reconstruct the type objects for the declaration.
 java.lang.String toString()
           
 void translate_(CodeWriter w, Translator tr)
          Write the declaration to an output file.
 TypeNode type()
          Get the type node of the declaration.
 LocalDecl type(TypeNode type)
          Set the type node of the declaration.
 Node typeCheck_(TypeChecker tc)
          Type check the declaration.
 Node typeCheckOverride_(TypeChecker tc)
          Type check the declaration.
 Node visitChildren(NodeVisitor v)
          Visit the children of the declaration.
 
Methods inherited from class jltools.ext.jl.ast.Node_c
buildTypes, buildTypesOverride_, buildTypesOverride, copy, disambiguate_, disambiguate, disambiguateOverride_, disambiguateOverride, disambiguateTypes_, disambiguateTypes, disambiguateTypesOverride_, disambiguateTypesOverride, enterScope, exceptionCheck_, exceptionCheck, exceptionCheckOverride_, exceptionCheckOverride, ext, ext, foldConstants_, foldConstants, foldConstantsOverride_, foldConstantsOverride, position, position, reconstructTypes, translate, translateBlock, translateSubstmt, typeCheck, 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.Node
buildTypesOverride_, copy, disambiguate_, disambiguateOverride_, disambiguateTypes_, disambiguateTypesOverride_, enterScope, exceptionCheck_, exceptionCheckOverride_, ext, ext, foldConstants_, foldConstantsOverride_, position, position, visit
 

Constructor Detail

LocalDecl_c

public LocalDecl_c(Ext ext,
                   Position pos,
                   Flags flags,
                   TypeNode type,
                   java.lang.String name,
                   Expr init)
Method Detail

declType

public Type declType()
Get the type of the declaration.
Specified by:
declType in interface LocalDecl

flags

public Flags flags()
Get the flags of the declaration.
Specified by:
flags in interface LocalDecl

flags

public LocalDecl flags(Flags flags)
Set the flags of the declaration.
Specified by:
flags in interface LocalDecl

type

public TypeNode type()
Get the type node of the declaration.
Specified by:
type in interface LocalDecl

type

public LocalDecl type(TypeNode type)
Set the type node of the declaration.
Specified by:
type in interface LocalDecl

name

public java.lang.String name()
Get the name of the declaration.
Specified by:
name in interface LocalDecl

name

public LocalDecl name(java.lang.String name)
Set the name of the declaration.
Specified by:
name in interface LocalDecl

init

public Expr init()
Get the initializer of the declaration.
Specified by:
init in interface LocalDecl

init

public LocalDecl init(Expr init)
Set the initializer of the declaration.
Specified by:
init in interface LocalDecl

localInstance

public LocalInstance localInstance()
Get the local instance of the declaration.
Specified by:
localInstance in interface LocalDecl

localInstance

public LocalDecl localInstance(LocalInstance li)
Set the local instance of the declaration.
Specified by:
localInstance in interface LocalDecl

decl

protected Declarator decl()
Get the declarator.

decl

protected LocalDecl decl(Declarator decl)
Set the declarator.

reconstruct

protected LocalDecl_c reconstruct(TypeNode type,
                                  Expr init)
Reconstruct the declaration.

visitChildren

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

leaveScope

public void leaveScope(Context c)
Add the variable to the scope after the declaration.
Specified by:
leaveScope in interface Node
Overrides:
leaveScope in class Node_c

buildTypes_

public Node buildTypes_(TypeBuilder tb)
                 throws SemanticException
Build type objects for the declaration.
Specified by:
buildTypes_ in interface Node
Overrides:
buildTypes_ in class Node_c

typeCheckOverride_

public Node typeCheckOverride_(TypeChecker tc)
                        throws SemanticException
Type check the declaration. Override so we can do this test before we enter scope. Return null to let the traversal continue.
Specified by:
typeCheckOverride_ in interface Node
Overrides:
typeCheckOverride_ in class Node_c
Following copied from interface: jltools.ast.Node
Parameters:
tc - The type checking visitor.

typeCheck_

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

toString

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

translate_

public void translate_(CodeWriter w,
                       Translator tr)
Write the declaration 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

reconstructTypes_

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