jltools.ext.jl.ast
Class AbstractNew_c

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

public abstract class AbstractNew_c
extends Expr_c

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 ClassDecl used to support anonymous classes. Such an expression may also be proceeded by an primary expression which specifies the context in which the object is being created.

See Also:
Serialized Form

Inner classes inherited from class jltools.ext.jl.ast.Node_c
Node_c.StringCodeWriter
 
Field Summary
protected  java.util.List arguments
           
protected  ClassBody body
           
protected  ConstructorInstance 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
AbstractNew_c(Ext ext, Position pos, java.util.List arguments, ClassBody body)
           
 
Method Summary
 java.util.List arguments()
           
 ClassBody body()
           
 Node buildTypesOverride_(TypeBuilder tb)
          Collects classes, methods, and fields from the AST rooted at this node and constructs type objects for these.
 ConstructorInstance constructorInstance()
           
 AbstractNew_c constructorInstance(ConstructorInstance ci)
           
 Node disambiguateOverride_(AmbiguityRemover ar)
          Remove any remaining ambiguities from the AST.
 Node disambiguateTypesOverride_(TypeAmbiguityRemover sc)
          Constructs a context for each type declared in the AST.
 Node exceptionCheck_(ExceptionChecker ec)
           
 Node foldConstantsOverride_(ConstantFolder cf)
          Fold constants in the AST.
protected  Expr setArguments(java.util.List arguments)
           
protected  AbstractNew_c setBody(ClassBody body)
           
abstract  void translate_(CodeWriter w, Translator tr)
          Translate the AST using the given code writer.
protected  void translateEpilogue(CodeWriter w, Translator tr)
           
 ClassBody typeCheckBody(TypeChecker tc, ParsedClassType ct)
           
protected  Node typeCheckEpilogue(ClassType ct, TypeChecker tc)
           
abstract  Node typeCheckOverride_(TypeChecker tc)
          Type check the AST.
 Node visitChildren(NodeVisitor v)
          Visit the children of the node.
protected abstract  AbstractNew_c visitNonBodyChildren(NodeVisitor v)
           
 
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, toString, 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.Node
copy, disambiguate_, disambiguateTypes_, enterScope, exceptionCheckOverride_, ext, ext, foldConstants_, leaveScope, position, position, typeCheck_, visit
 

Field Detail

arguments

protected java.util.List arguments

body

protected ClassBody body

ci

protected ConstructorInstance ci
Constructor Detail

AbstractNew_c

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

constructorInstance

public ConstructorInstance constructorInstance()

constructorInstance

public AbstractNew_c constructorInstance(ConstructorInstance ci)

arguments

public java.util.List arguments()

setArguments

protected Expr setArguments(java.util.List arguments)

body

public ClassBody body()

setBody

protected AbstractNew_c setBody(ClassBody body)

visitNonBodyChildren

protected abstract AbstractNew_c visitNonBodyChildren(NodeVisitor v)

visitChildren

public Node visitChildren(NodeVisitor v)
Description copied from interface: Node
Visit the children of the node.
Overrides:
visitChildren in class Node_c

buildTypesOverride_

public Node buildTypesOverride_(TypeBuilder tb)
Description copied from interface: Node
Collects classes, methods, and fields from the AST rooted at this node and constructs type objects for these. These type objects may be ambiguous.
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.

disambiguateTypesOverride_

public Node disambiguateTypesOverride_(TypeAmbiguityRemover sc)
Description copied from interface: Node
Constructs a context for each type declared in the AST. A context is used to look up names when cleaning class signatures.
Overrides:
disambiguateTypesOverride_ in class Node_c
Following copied from interface: jltools.ast.Node
Parameters:
cb - The visitor which builds contexts.

disambiguateOverride_

public Node disambiguateOverride_(AmbiguityRemover ar)
Description copied from interface: Node
Remove any remaining ambiguities from the AST.
Overrides:
disambiguateOverride_ in class Node_c
Following copied from interface: jltools.ast.Node
Parameters:
ar - The visitor which disambiguates.

foldConstantsOverride_

public Node foldConstantsOverride_(ConstantFolder cf)
Description copied from interface: Node
Fold constants in the AST.
Overrides:
foldConstantsOverride_ in class Node_c
Following copied from interface: jltools.ast.Node
Parameters:
cf - The constant folding visitor.

typeCheckOverride_

public abstract Node typeCheckOverride_(TypeChecker tc)
                                 throws SemanticException
Description copied from interface: Node
Type check the AST.
Overrides:
typeCheckOverride_ in class Node_c
Following copied from interface: jltools.ast.Node
Parameters:
tc - The type checking visitor.

typeCheckEpilogue

protected Node typeCheckEpilogue(ClassType ct,
                                 TypeChecker tc)
                          throws SemanticException

typeCheckBody

public ClassBody typeCheckBody(TypeChecker tc,
                               ParsedClassType ct)
                        throws SemanticException

exceptionCheck_

public Node exceptionCheck_(ExceptionChecker ec)
                     throws SemanticException
Overrides:
exceptionCheck_ in class Node_c

translate_

public abstract void translate_(CodeWriter w,
                                Translator tr)
Description copied from interface: Node
Translate the AST using the given code writer.
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.

translateEpilogue

protected void translateEpilogue(CodeWriter w,
                                 Translator tr)