jltools.ext.jl.ast
Class New_c

java.lang.Object
  |
  +--jltools.ext.jl.ast.Node_c
        |
        +--jltools.ext.jl.ast.Expr_c
              |
              +--jltools.ext.jl.ast.AbstractNew_c
                    |
                    +--jltools.ext.jl.ast.New_c
All Implemented Interfaces:
java.lang.Cloneable, Copy, Expr, New, Node, Prefix, Receiver, java.io.Serializable, Typed

public class New_c
extends AbstractNew_c
implements New

A New is an immutable representation of the use of the new operator to create a new instance of a class. In addition to the type of the class being created, a New has a list of arguments to be passed to the constructor of the object and an optional ClassBody used to support anonymous classes.

See Also:
Serialized Form

Inner classes inherited from class jltools.ext.jl.ast.Node_c
Node_c.StringCodeWriter
 
Field Summary
protected  TypeNode tn
           
 
Fields inherited from class jltools.ext.jl.ast.AbstractNew_c
arguments, body, ci
 
Fields inherited from class jltools.ext.jl.ast.Expr_c
type
 
Fields inherited from class jltools.ext.jl.ast.Node_c
ext, position
 
Constructor Summary
New_c(Ext ext, Position pos, TypeNode tn, java.util.List arguments, ClassBody body)
           
 
Method Summary
 New arguments(java.util.List arguments)
          Set the arguments of the expression.
 New body(ClassBody body)
          Set the body of the expression.
 TypeNode objectType()
          Get the type we are instantiating.
 New objectType(TypeNode tn)
          Set the type we are instantiating.
protected  New_c reconstruct(TypeNode tn, java.util.List arguments, ClassBody body)
          Reconstruct the expression.
 java.lang.String toString()
           
 void translate_(CodeWriter w, Translator tr)
          Write the expression to an output file.
 Node typeCheckOverride_(TypeChecker tc)
          Type check the expression.
protected  AbstractNew_c visitNonBodyChildren(NodeVisitor v)
          Visit the children of the expression, except the body.
 
Methods inherited from class jltools.ext.jl.ast.AbstractNew_c
arguments, body, buildTypesOverride_, constructorInstance, constructorInstance, disambiguateOverride_, disambiguateTypesOverride_, exceptionCheck_, foldConstantsOverride_, setArguments, setBody, translateEpilogue, typeCheckBody, typeCheckEpilogue, visitChildren
 
Methods inherited from class jltools.ext.jl.ast.Expr_c
buildTypes_, dump, precedence, reconstructTypes_, translateSubexpr, type, type
 
Methods inherited from class jltools.ext.jl.ast.Node_c
buildTypes, buildTypesOverride, copy, disambiguate_, disambiguate, disambiguateOverride, disambiguateTypes_, disambiguateTypes, disambiguateTypesOverride, enterScope, exceptionCheck, exceptionCheckOverride_, exceptionCheckOverride, ext, ext, foldConstants_, foldConstants, foldConstantsOverride, leaveScope, position, position, reconstructTypes, translate, translateBlock, translateSubstmt, typeCheck_, 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.New
arguments, body, constructorInstance
 
Methods inherited from interface jltools.ast.Expr
precedence, type
 
Methods inherited from interface jltools.ast.Node
buildTypes_, buildTypesOverride_, copy, disambiguate_, disambiguateOverride_, disambiguateTypes_, disambiguateTypesOverride_, dump, enterScope, exceptionCheck_, exceptionCheckOverride_, ext, ext, foldConstants_, foldConstantsOverride_, leaveScope, position, position, reconstructTypes_, typeCheck_, visit, visitChildren
 
Methods inherited from interface jltools.ast.Typed
type
 

Field Detail

tn

protected TypeNode tn
Constructor Detail

New_c

public New_c(Ext ext,
             Position pos,
             TypeNode tn,
             java.util.List arguments,
             ClassBody body)
Method Detail

objectType

public TypeNode objectType()
Get the type we are instantiating.
Specified by:
objectType in interface New

objectType

public New objectType(TypeNode tn)
Set the type we are instantiating.
Specified by:
objectType in interface New

arguments

public New arguments(java.util.List arguments)
Set the arguments of the expression.
Specified by:
arguments in interface New

body

public New body(ClassBody body)
Set the body of the expression.
Specified by:
body in interface New

reconstruct

protected New_c reconstruct(TypeNode tn,
                            java.util.List arguments,
                            ClassBody body)
Reconstruct the expression.

visitNonBodyChildren

protected AbstractNew_c visitNonBodyChildren(NodeVisitor v)
Visit the children of the expression, except the body.
Overrides:
visitNonBodyChildren in class AbstractNew_c

typeCheckOverride_

public Node typeCheckOverride_(TypeChecker tc)
                        throws SemanticException
Type check the expression.
Specified by:
typeCheckOverride_ in interface Node
Overrides:
typeCheckOverride_ in class AbstractNew_c
Following copied from interface: jltools.ast.Node
Parameters:
tc - The type checking visitor.

toString

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

translate_

public void translate_(CodeWriter w,
                       Translator tr)
Write the expression to an output file.
Specified by:
translate_ in interface Node
Overrides:
translate_ in class AbstractNew_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.