|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpolyglot.ext.jl.ast.Node_c
polyglot.ext.jl.ast.Term_c
polyglot.ext.jl.ast.Expr_c
public abstract class Expr_c
An Expr
represents any Java expression. All expressions
must be subtypes of Expr.
Field Summary | |
---|---|
protected Type |
type
|
Fields inherited from class polyglot.ext.jl.ast.Term_c |
---|
exceptions, reachable |
Fields inherited from class polyglot.ext.jl.ast.Node_c |
---|
del, ext, position |
Constructor Summary | |
---|---|
Expr_c(Position pos)
|
Method Summary | |
---|---|
boolean |
booleanValue()
|
Node |
buildTypes(TypeBuilder tb)
Collects classes, methods, and fields from the AST rooted at this node and constructs type objects for these. |
byte |
byteValue()
|
char |
charValue()
|
java.lang.Object |
constantValue()
Returns the constant value of the expression, if any. |
double |
doubleValue()
|
void |
dump(CodeWriter w)
Dump the AST node for debugging purposes. |
float |
floatValue()
|
int |
intValue()
|
boolean |
isConstant()
Return whether the expression evaluates to a constant. |
long |
longValue()
|
Precedence |
precedence()
Get the precedence of the expression. |
void |
printSubExpr(Expr expr,
boolean associative,
CodeWriter w,
PrettyPrinter pp)
Correctly parenthesize the subexpression expr |
void |
printSubExpr(Expr expr,
CodeWriter w,
PrettyPrinter pp)
Correctly parenthesize the subexpression expr |
short |
shortValue()
|
java.lang.String |
stringValue()
|
Type |
type()
Get the type of the expression. |
Expr |
type(Type type)
Set the type of the expression. |
Methods inherited from class polyglot.ext.jl.ast.Term_c |
---|
acceptCFG, entry, exceptionCheck, exceptions, exceptions, listEntry, reachable, reachable |
Methods inherited from class polyglot.ext.jl.ast.Node_c |
---|
addDecls, addMembers, addMembersEnter, addMembersOverride, buildTypesEnter, buildTypesOverride, childExpectedType, copy, del, del, disambiguate, disambiguateEnter, disambiguateOverride, enterScope, enterScope, exceptionCheckEnter, exceptionCheckOverride, ext, ext, ext, ext, init, node, position, position, prettyPrint, print, printBlock, printSubStmt, throwTypes, toString, translate, typeCheck, typeCheckEnter, typeCheckOverride, visit, visitChild, visitChildren, visitEdge, visitList |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface polyglot.ast.Node |
---|
childExpectedType, del, del, ext, ext, ext, ext, position, position, visit, visitChild, visitEdge, visitList |
Methods inherited from interface polyglot.ast.JL |
---|
init, node |
Methods inherited from interface polyglot.ast.NodeOps |
---|
addDecls, addMembers, addMembersEnter, buildTypesEnter, disambiguate, disambiguateEnter, enterScope, enterScope, exceptionCheck, exceptionCheckEnter, prettyPrint, throwTypes, translate, typeCheck, typeCheckEnter, visitChildren |
Methods inherited from interface polyglot.util.Copy |
---|
copy |
Methods inherited from interface polyglot.ast.Term |
---|
acceptCFG, entry, exceptions, exceptions, reachable, reachable |
Field Detail |
---|
protected Type type
Constructor Detail |
---|
public Expr_c(Position pos)
Method Detail |
---|
public Type type()
UnknownType
before type-checking, but should return the
correct type after type-checking.
type
in interface Typed
public Expr type(Type type)
type
in interface Expr
public void dump(CodeWriter w)
Node
dump
in interface Node
dump
in class Node_c
public Precedence precedence()
precedence
in interface Expr
public boolean isConstant()
Expr
isConstant
in interface Expr
public java.lang.Object constantValue()
Expr
constantValue
in interface Expr
public java.lang.String stringValue()
public boolean booleanValue()
public byte byteValue()
public short shortValue()
public char charValue()
public int intValue()
public long longValue()
public float floatValue()
public double doubleValue()
public Node buildTypes(TypeBuilder tb) throws SemanticException
NodeOps
TypeSystem
.
This method is called by the leave()
method of the
visitor. The method should perform work that should be done
after visiting the children of the node. The method may return
this
or a new copy of the node which will be
installed as a child of the node's parent.
buildTypes
in interface NodeOps
buildTypes
in class Node_c
tb
- The visitor which adds new type objects to the
TypeSystem
.
SemanticException
public void printSubExpr(Expr expr, CodeWriter w, PrettyPrinter pp)
expr given
the its precendence and the precedence of the current expression.
If the sub-expression has the same precedence as this expression
we do not parenthesize.
- Specified by:
printSubExpr
in interface Expr
- Parameters:
expr
- The subexpression.
(right-) associative operator.w
- The output writer.pp
- The pretty printer.
public void printSubExpr(Expr expr, boolean associative, CodeWriter w, PrettyPrinter pp)
expr given
the its precendence and the precedence of the current expression.
If the sub-expression has the same precedence as this expression
we parenthesize if the sub-expression does not associate; e.g.,
we parenthesis the right sub-expression of a left-associative
operator.
- Specified by:
printSubExpr
in interface Expr
- Parameters:
expr
- The subexpression.associative
- Whether expr is the left (right) child of a left-
(right-) associative operator.w
- The output writer.pp
- The pretty printer.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |