Package nz.org.riskscape.rl.ast
Class FunctionCall.Argument
- All Implemented Interfaces:
AST
- Enclosing class:
- FunctionCall
-
Constructor Summary
ConstructorsConstructorDescriptionArgument(Expression expression) Argument(Expression expression, String keyword) Argument(Expression expression, Optional<Token> token) -
Method Summary
Modifier and TypeMethodDescriptionprotected static voidappendSource(AST ast, StringBuilder appendTo) Helper method for appending the source of another ast element to a string builder, efficiently if possible.protected voidappendString(StringBuilder appendTo) Append a simplified string representation to the builder.<T> ResultOrProblems<T>evaluateConstant(RealizationContext context, Class<T> requiredJavaType, Type requiredType) Attempts to realize and evaluate this argument against an emptyStruct, returning useful problems if the expression wasn't constant or if the returned type doesn't match the expected java type.Deprecated.use getValue() instead.final StringtoSource()final StringtoString()Returns a simplified view of the ast in a source-like fashion, but with a lot of details left out for concisenessMethods inherited from class nz.org.riskscape.rl.ast.GenericArgument
appendSource, equals, getBoundary, getName, getNameToken, getValue, hashCode, isKeywordArgumentMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface nz.org.riskscape.rl.ast.AST
isA, switchType
-
Constructor Details
-
Argument
-
Argument
-
Argument
-
-
Method Details
-
evaluateConstant
public <T> ResultOrProblems<T> evaluateConstant(RealizationContext context, Class<T> requiredJavaType, Type requiredType) Attempts to realize and evaluate this argument against an empty
Struct, returning useful problems if the expression wasn't constant or if the returned type doesn't match the expected java type.ExpressionRealizer.realizeConstant(Expression)has more details.- Type Parameters:
T- the expected object- Parameters:
requiredJavaType- the java type that we expect the expression to yield. Checked against the expression's return type, not the actual constant value's class type.requiredType- a riskscape type to use in any error message that's generated
-
getExpression
Deprecated.use getValue() instead. -
appendSource
Helper method for appending the source of another ast element to a string builder, efficiently if possible.
-
toString
Returns a simplified view of the ast in a source-like fashion, but with a lot of details left out for conciseness
-
appendString
Append a simplified string representation to the builder. Default implementation uses appendSource. Subclasses can override to provide a more concise representation.
-
toSource
-