Package icyllis.arc3d.compiler.tree
Class Literal
java.lang.Object
icyllis.arc3d.compiler.tree.Node
icyllis.arc3d.compiler.tree.Expression
icyllis.arc3d.compiler.tree.Literal
A constant value. These can contain ints, floats, or booleans.
-
Nested Class Summary
Nested classes/interfaces inherited from class icyllis.arc3d.compiler.tree.Node
Node.ElementKind, Node.ExpressionKind, Node.StatementKind, Node.SymbolKind
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescription@NonNull Expression
copy
(int position) boolean
@NonNull OptionalDouble
getConstantValue
(int i) Returns the i'th compile-time constant value within a literal or constructor.float
long
getKind()
double
getValue()
boolean
static @NonNull Literal
static @NonNull Literal
makeBoolean
(int position, boolean value, Type type) static @NonNull Literal
makeBoolean
(@NonNull Context context, int position, boolean value) static @NonNull Literal
static @NonNull Literal
static @NonNull Literal
makeInteger
(int position, long value, Type type) static @NonNull Literal
makeInteger
(@NonNull Context context, int position, long value, boolean signed) @NonNull String
toString
(int parentPrecedence) Methods inherited from class icyllis.arc3d.compiler.tree.Expression
accept, copy, getCoercionCost, getType, isBooleanLiteral, isConstructorCall, isFloatLiteral, isIncomplete, isIntLiteral, toString
Methods inherited from class icyllis.arc3d.compiler.tree.Node
getEndOffset, getStartOffset
-
Method Details
-
makeFloat
-
makeFloat
-
makeInteger
-
makeInteger
-
makeBoolean
-
makeBoolean
-
make
-
getKind
- Specified by:
getKind
in classExpression
- See Also:
-
isLiteral
public boolean isLiteral()- Overrides:
isLiteral
in classExpression
-
getFloatValue
public float getFloatValue() -
getIntegerValue
public long getIntegerValue() -
getBooleanValue
public boolean getBooleanValue() -
getValue
public double getValue() -
getConstantValue
Description copied from class:Expression
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)- Overrides:
getConstantValue
in classExpression
-
copy
- Specified by:
copy
in classExpression
-
toString
- Specified by:
toString
in classExpression
-