jltools.ext.jl.ast
Class Expr_c

java.lang.Object
  |
  +--jltools.ext.jl.ast.Node_c
        |
        +--jltools.ext.jl.ast.Expr_c
All Implemented Interfaces:
java.lang.Cloneable, Copy, Expr, Node, Prefix, Receiver, java.io.Serializable, Typed
Direct Known Subclasses:
AbstractNew_c, AmbExpr_c, AmbNewArray_c, ArrayAccess_c, ArrayInit_c, Assign_c, Binary_c, Call_c, Cast_c, Conditional_c, DeclassifyExpr_c, Field_c, Instanceof_c, Lit_c, Local_c, NewArray_c, NewLabel_c, Special_c, Unary_c

public abstract class Expr_c
extends Node_c
implements Expr

An Expr represents any Java expression. All expressions must be subtypes of Expr.

See Also:
Serialized Form

Inner classes inherited from class jltools.ext.jl.ast.Node_c
Node_c.StringCodeWriter
 
Field Summary
protected  Type type
           
 
Fields inherited from class jltools.ext.jl.ast.Node_c
ext, position
 
Constructor Summary
Expr_c(Ext ext, Position pos)
           
 
Method Summary
 Node buildTypes_(TypeBuilder tb)
          Build type objects for the expression.
 void dump(CodeWriter w)
          Dump the AST node for debugging purposes.
 Precedence precedence()
          Get the precedence of the expression.
 Node reconstructTypes_(NodeFactory nf, TypeSystem ts, Context c)
          Reconstruct the type objects for the expression.
 void translateSubexpr(Expr expr, CodeWriter w, Translator tr)
          Correctly parenthesize the subexpression expr given the its precendence and the precedence of the current expression.
 Type type()
          Get the type of the expression.
 Expr type(Type type)
          Set the type of the expression.
 
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, leaveScope, position, position, reconstructTypes, toString, translate_, translate, translateBlock, translateSubstmt, typeCheck_, typeCheck, typeCheckOverride_, typeCheckOverride, visit, visitChildren, 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_, leaveScope, position, position, translate_, typeCheck_, typeCheckOverride_, visit, visitChildren
 

Field Detail

type

protected Type type
Constructor Detail

Expr_c

public Expr_c(Ext ext,
              Position pos)
Method Detail

type

public Type type()
Get the type of the expression. This may return an UnknownType before type-checking, but should return the correct type after type-checking.
Specified by:
type in interface Typed

type

public Expr type(Type type)
Set the type of the expression.
Specified by:
type in interface Expr

buildTypes_

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

reconstructTypes_

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

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

precedence

public Precedence precedence()
Get the precedence of the expression.
Specified by:
precedence in interface Expr

translateSubexpr

public void translateSubexpr(Expr expr,
                             CodeWriter w,
                             Translator tr)
Correctly parenthesize the subexpression expr given the its precendence and the precedence of the current expression.
Parameters:
expr - The subexpression.
c - The context of translation.
w - The output writer.