Class TypeAsExpression
- java.lang.Object
-
- gw.internal.gosu.parser.ParsedElement
-
- gw.internal.gosu.parser.Expression
-
- gw.internal.gosu.parser.expressions.TypeAsExpression
-
- All Implemented Interfaces:
ITypeAsExpression,IExpression,IHasType,IParsedElement
- Direct Known Subclasses:
ImplicitTypeAsExpression
public class TypeAsExpression extends Expression implements ITypeAsExpression
Represents a typeas expression in the Gosu grammar:typeas-expression <conditional-or-expression> typeas <type-literal>
- See Also:
IGosuParser
-
-
Field Summary
Fields Modifier and Type Field Description protected Expression_lhs-
Fields inherited from class gw.internal.gosu.parser.Expression
_type
-
Fields inherited from class gw.internal.gosu.parser.ParsedElement
_tokens, UNDEF_FILE, UNDEF_FUNCTION, UNDEF_MODULE
-
Fields inherited from interface gw.lang.parser.IExpression
EMPTY_ARRAY
-
-
Constructor Summary
Constructors Constructor Description TypeAsExpression()Base constructor sets type to BooleanType.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Objectevaluate()Perform a type cast.ICoercergetCoercer()ExpressiongetLHS()booleanisCompileTimeConstant()voidsetCoercer(ICoercer coercer)voidsetLHS(Expression e)StringtoString()Subclasses should return a String representing the parsed expression.-
Methods inherited from class gw.internal.gosu.parser.Expression
evaluate, getContextType, getReturnType, getType, getTypeImpl, isNullSafe, isUnchecked, setType
-
Methods inherited from class gw.internal.gosu.parser.ParsedElement
addExceptionsFrom, addParseException, addParseException, addParseException, addParseExceptions, addParseIssues, addParseWarning, addParseWarning, addParseWarnings, addToken, adjustColumn, adjustLineNum, assignTokens, clearParseExceptions, clearParseTreeInformation, clearParseWarnings, compactParseTree, findAncestorParsedElementByType, findDeclaringStatement, findLineNumberOfDeclaration, findRootParsedElement, getAnnotations, getColumn, getContainedParsedElementsByType, getContainedParsedElementsByTypes, getContainedParsedElementsByTypesWithIgnoreSet, getEnclosingFeatureInfo, getFunctionName, getGosuClass, getGosuProgram, getImmediateParseIssue, getImmediateParseIssues, getLineNum, getLocation, getModule, getParent, getParseExceptions, getParseIssues, getParseWarnings, getQualifyingEnclosingTypeInfo, getTokens, hasImmediateParseIssue, hasImmediateParseWarning, hasImmediateParseWarnings, hasParseException, hasParseExceptions, hasParseIssue, hasParseIssues, hasParseWarning, hasParseWarnings, initEmptyParseTree, initLocation, isSuppressed, isSuppressed, isSynthetic, makeDoubleValue, makeFloatValue, makeInteger, makeLong, removeParseException, removeParseWarning, removeParseWarningRecursively, setGosuProgram, setLineNum, setLocation, setParent, setSynthetic, shouldClearParseInfo, visit
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface gw.lang.parser.IExpression
evaluate, getContextType, isNullSafe, isUnchecked
-
Methods inherited from interface gw.lang.parser.IParsedElement
addExceptionsFrom, addParseException, addParseException, addParseWarning, addParseWarning, clearParseExceptions, clearParseTreeInformation, clearParseWarnings, findAncestorParsedElementByType, findDeclaringStatement, findRootParsedElement, getColumn, getContainedParsedElementsByType, getContainedParsedElementsByTypes, getContainedParsedElementsByTypesWithIgnoreSet, getFunctionName, getGosuClass, getGosuProgram, getImmediateParseIssue, getImmediateParseIssues, getLineNum, getLocation, getModule, getParent, getParseExceptions, getParseIssues, getParseWarnings, getReturnType, getTokens, hasImmediateParseIssue, hasImmediateParseWarnings, hasParseException, hasParseExceptions, hasParseIssue, hasParseIssues, hasParseWarning, hasParseWarnings, isSuppressed, isSynthetic, setLocation, setParent, visit
-
-
-
-
Field Detail
-
_lhs
protected Expression _lhs
-
-
Method Detail
-
getLHS
public Expression getLHS()
- Specified by:
getLHSin interfaceITypeAsExpression- Returns:
- The expression for the left-hand-side operand.
-
setLHS
public void setLHS(Expression e)
- Parameters:
e- The expression for the left-hand-side operand.
-
isCompileTimeConstant
public boolean isCompileTimeConstant()
- Specified by:
isCompileTimeConstantin interfaceIParsedElement- Overrides:
isCompileTimeConstantin classParsedElement
-
evaluate
public Object evaluate()
Perform a type cast.- Specified by:
evaluatein interfaceIExpression- Overrides:
evaluatein classExpression
-
setCoercer
public void setCoercer(ICoercer coercer)
-
getCoercer
public ICoercer getCoercer()
- Specified by:
getCoercerin interfaceITypeAsExpression
-
toString
public String toString()
Description copied from class:ExpressionSubclasses should return a String representing the parsed expression.- Specified by:
toStringin classExpression
-
-