Package icyllis.arc3d.compiler.tree

# 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.

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from class icyllis.arc3d.compiler.tree.Node

  `Node.ElementKind, Node.ExpressionKind, Node.StatementKind, Node.SymbolKind`

- ## Field Summary

  ### Fields inherited from class icyllis.arc3d.compiler.tree.Node

  `mPosition`

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `Expression(int position, Type type)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `final Expression`
  `clone()`
  Returns a deep copy at the same position.
  `abstract Expression`
  `clone(int position)`
  `final long`
  `getCoercionCost(Type other)`
  `OptionalDouble`
  `getConstantValue(int i)`
  Returns the i'th compile-time constant value within a literal or constructor.
  `abstract Node.ExpressionKind`
  `getKind()`
  `Type`
  `getType()`
  `final boolean`
  `isBooleanLiteral()`
  `boolean`
  `isConstructorCall()`
  `final boolean`
  `isFloatLiteral()`
  `final boolean`
  `isIncomplete(Context context)`
  Returns true if this expression is incomplete.
  `final boolean`
  `isIntLiteral()`
  `boolean`
  `isLiteral()`
  `final String`
  `toString()`
  Returns a description of the expression.
  `abstract String`
  `toString(int parentPrecedence)`

  ### Methods inherited from class icyllis.arc3d.compiler.tree.Node

  `accept, getEndOffset, getStartOffset`

  ### Methods inherited from class java.lang.Object

  `equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### Expression

    protected Expression(int position, Type type)

- ## Method Details

  - ### getKind

    public abstract Node.ExpressionKind getKind()
    See Also:
      - `Node.ExpressionKind`

  - ### 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:
      - `Type.CoercionCost`

  - ### 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)