Package nz.org.riskscape.rl.ast
Class FunctionCall.Argument
java.lang.Object
nz.org.riskscape.rl.ast.FunctionCall.Argument
- Enclosing class:
- FunctionCall
-
Constructor Summary
ConstructorsConstructorDescriptionArgument(Expression expression) Argument(Expression expression, String keyword) Argument(Expression expression, Optional<Token> nameToken) -
Method Summary
Modifier and TypeMethodDescriptionvoidappendSource(StringBuilder appendTo) boolean<T> ResultOrProblems<T>evaluateConstant(RealizationContext context, Class<T> requiredJavaType, Type requiredType) Attempts to realize and evaluate this argument's expression against an emptyStruct, returning useful problems if the expression wasn't constant or if the returned type doesn't match the expected java type.getName()inthashCode()booleantoSource()toString()
-
Constructor Details
-
Argument
-
Argument
-
Argument
-
-
Method Details
-
getName
-
getNameToken
-
appendSource
-
isKeywordArgument
public boolean isKeywordArgument()- Returns:
- if this argument has a keyword, e.g.
foo(bar: baz)vsfoo(baz)
-
toSource
-
evaluateConstant
public <T> ResultOrProblems<T> evaluateConstant(RealizationContext context, Class<T> requiredJavaType, Type requiredType) Attempts to realize and evaluate this argument's expression 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
-
equals
-
hashCode
public int hashCode() -
toString
-