|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--com.go.tea.parsetree.Node
|
+--com.go.tea.parsetree.Expression
An Expression is a piece of code that, when executed, produces a value. All expressions have a type which represents the type of value is produces.
| Inner Class Summary | |
static class |
Expression.Conversion
|
| Constructor Summary | |
Expression(SourceInfo info)
|
|
| Method Summary | |
java.lang.Object |
accept(NodeVisitor visitor)
Every subclass of Node must override this method with the following: return visitor.visit(this). |
java.lang.Object |
clone()
Returns a clone of this Node and all its children. |
void |
convertTo(Type toType)
Applies a type conversion to this expression which is chained to all previous conversions. |
void |
convertTo(Type toType,
boolean preferCast)
Applies a type conversion to this expression which is chained to all previous conversions. |
java.util.LinkedList |
getConversionChain()
Returns a list of Conversion objects representing the all the conversions that have been applied to this Expression. |
Type |
getInitialType()
Returns the type of this expression before any conversions were applied, or null if the type isn't set. |
Type |
getType()
The type of an expression is not necessarily set by a parser. |
java.lang.Object |
getValue()
Most expressions can't generate a value at compile-time, so this method simply returns null. |
boolean |
isExceptionPossible()
Returns true if an exception can be thrown while executing this Expression. |
boolean |
isValueKnown()
Returns true if the value generated by this expression is known at compile-time. |
void |
setInitialType(Type type)
Sets the intial type in the conversion chain, but does not clear the conversions. |
void |
setType(Type type)
Sets the type of this expression, clearing the conversion chain. |
| Methods inherited from class com.go.tea.parsetree.Node |
getSourceInfo, toString |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public Expression(SourceInfo info)
| Method Detail |
public java.lang.Object accept(NodeVisitor visitor)
Nodereturn visitor.visit(this).accept in class Nodecom.go.tea.parsetree.Nodevisitor - A visitor of this NodeNodeVisitorpublic java.lang.Object clone()
Nodeclone in class Nodepublic boolean isExceptionPossible()
public Type getType()
public Type getInitialType()
public final void convertTo(Type toType)
toType - the type to convert to.
public void convertTo(Type toType,
boolean preferCast)
toType - the type to convert to.preferCast - a hint that the conversion should be performed by a
type cast operation, by default is true.java.lang.IllegalArgumentException - when the conversion is illegal.public java.util.LinkedList getConversionChain()
convertTo(com.go.tea.compiler.Type).public void setType(Type type)
public void setInitialType(Type type)
public boolean isValueKnown()
Literalpublic java.lang.Object getValue()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||