Class FunctionCall.Argument

java.lang.Object
nz.org.riskscape.rl.ast.GenericArgument<Expression>
nz.org.riskscape.rl.ast.FunctionCall.Argument
All Implemented Interfaces:
AST
Enclosing class:
FunctionCall

public static final class FunctionCall.Argument extends GenericArgument<Expression>
  • Constructor Details

  • 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 public Expression getExpression()
      Deprecated.
      use getValue() instead.
    • appendSource

      protected static void appendSource(AST ast, StringBuilder appendTo)

      Helper method for appending the source of another ast element to a string builder, efficiently if possible.

    • toString

      public final String toString()

      Returns a simplified view of the ast in a source-like fashion, but with a lot of details left out for conciseness

      Overrides:
      toString in class Object
    • appendString

      protected void appendString(StringBuilder appendTo)

      Append a simplified string representation to the builder. Default implementation uses appendSource. Subclasses can override to provide a more concise representation.

    • toSource

      public final String toSource()
      Specified by:
      toSource in interface AST
      Returns:
      a normalized version of the AST that can be parsed to be exactly the same AST as this