Class Expression

java.lang.Object
gw.internal.gosu.parser.ParsedElement
gw.internal.gosu.parser.Expression
All Implemented Interfaces:
IExpression, IHasType, IParsedElement
Direct Known Subclasses:
AnnotationUseSiteTargetClause, ArgumentListClause, ArithmeticExpression, ArrayAccess, BadInitializerExpression, BeanMethodCallExpression, BinaryExpression, BindingExpression, BlockExpression, BlockInvocation, CaseClause, ClassDeclaration, CollectionInitializerExpression, ConditionalTernaryExpression, DefaultArgLiteral, DirectiveExpression, EvalExpression, FeatureLiteral, Identifier, InterfacesClause, Literal, LocalVarDeclaration, MapAccess, MapInitializerExpression, MemberAccess, MethodCallExpression, ModifierListClause, NameInDeclaration, NewExpression, ObjectInitializerExpression, ParameterListClause, ParenthesizedExpression, Program, StaticTypeOfExpression, SuperAccess, SuperTypeClause, TemplateStringLiteral, TypeAsExpression, TypeIsExpression, TypeOfExpression, TypeParameterListClause, TypeVariableDefinition, TypeVariableListClause, UnaryExpression, UnaryNotPlusMinusExpression

public abstract class Expression extends ParsedElement implements IExpression
The root class for all Expressions represented in a parse tree as specified in the Gosu grammar.
See Also:
  • Field Details

    • _type

      protected IType _type
  • Constructor Details

    • Expression

      public Expression()
  • Method Details

    • getType

      public IType getType()
      Returns this Expression's IType.
      Specified by:
      getType in interface IHasType
    • getTypeImpl

      protected IType getTypeImpl()
    • setType

      public void setType(IType type)
      Sets this Expression's IType.
    • isNullSafe

      public boolean isNullSafe()
      Specified by:
      isNullSafe in interface IExpression
    • isUnchecked

      public boolean isUnchecked()
      Specified by:
      isUnchecked in interface IExpression
    • evaluate

      public Object evaluate()
      Description copied from interface: IExpression
      Evaluates this Expression and returns the result.
      Specified by:
      evaluate in interface IExpression
    • evaluate

      public Object evaluate(IExternalSymbolMap externalSymbols)
      Specified by:
      evaluate in interface IExpression
    • getReturnType

      public IType getReturnType()
      Specified by:
      getReturnType in interface IParsedElement
    • getContextType

      public IType getContextType()
      Context type is the type this literal value evaluates as in the context of a containing expression e.g., given the expression, n == "42", the literal "42" is always converted to a Number. This feature is most useful for source code tools that provide source-sensitive help (e.g., rule composer).
      Specified by:
      getContextType in interface IExpression
    • toString

      public abstract String toString()
      Subclasses should return a String representing the parsed expression.
      Overrides:
      toString in class Object