Class Expression

java.lang.Object
icyllis.arc3d.compiler.tree.Node
icyllis.arc3d.compiler.tree.Expression
Direct Known Subclasses:
BinaryExpression, ConditionalExpression, ConstructorCall, FieldAccess, FunctionCall, FunctionReference, IndexExpression, Literal, Poison, PostfixExpression, PrefixExpression, Swizzle, TypeReference, VariableReference

public abstract class Expression extends Node
Abstract superclass of all expressions.
  • Constructor Details

    • Expression

      protected Expression(int position, Type type)
  • Method Details

    • getKind

      public abstract Node.ExpressionKind getKind()
      See Also:
    • getType

      @Nonnull public Type getType()
    • isConstructorCall

      public boolean isConstructorCall()
    • isLiteral

      public boolean isLiteral()
    • isIntLiteral

      public final boolean isIntLiteral()
    • isFloatLiteral

      public final boolean isFloatLiteral()
    • isBooleanLiteral

      public final boolean isBooleanLiteral()
    • getCoercionCost

      public final long getCoercionCost(Type other)
      See Also:
    • isIncomplete

      public final boolean isIncomplete(@Nonnull Context context)
      Returns true if this expression is incomplete. Specifically, dangling function/method-call references that were never invoked, or type references that were never constructed, are considered incomplete expressions and should result in an error.
    • getConstantValue

      public OptionalDouble getConstantValue(int i)
      Returns the i'th compile-time constant value within a literal or constructor. Indices which do not contain compile-time constant values will return empty. `vec4(1, vec2(2), 3)` contains four compile-time constants: (1, 2, 2, 3) `mat2(f)` contains four slots, and two are constant: (empty, 0, 0, empty)
    • clone

      @Nonnull public final Expression clone()
      Returns a deep copy at the same position.
      Overrides:
      clone in class Object
    • clone

      @Nonnull public abstract Expression clone(int position)
    • toString

      @Nonnull public final String toString()
      Returns a description of the expression.
      Specified by:
      toString in class Node
      Returns:
      a string representation of this AST node
    • toString

      @Nonnull public abstract String toString(int parentPrecedence)