Class SolaScriptFunction

java.lang.Object
technology.sola.script.runtime.SolaScriptFunction
All Implemented Interfaces:
SolaScriptCallable

@NullMarked public class SolaScriptFunction extends Object implements SolaScriptCallable
SolaScriptFunction is a runtime definition of a function declaration that is callable (implements SolaScriptCallable interface).
  • Constructor Details

    • SolaScriptFunction

      public SolaScriptFunction(Consumer<Stmt> executeStatement, ScriptRuntime scriptRuntime, Stmt.Function declaration)
      Creates an instance of the runtime function declaration.
      Parameters:
      executeStatement - the consumer that handles execution at runtime
      scriptRuntime - the ScriptRuntime state
      declaration - the Stmt.Function declaration
  • Method Details

    • arity

      public int arity()
      Description copied from interface: SolaScriptCallable
      The number of expected arguments.
      Specified by:
      arity in interface SolaScriptCallable
      Returns:
      the number of expected arguments
    • call

      public @Nullable Object call(List<Object> arguments)
      Description copied from interface: SolaScriptCallable
      Calls the function passing along the arguments for the call and returning an evaluated value.
      Specified by:
      call in interface SolaScriptCallable
      Parameters:
      arguments - the arguments for the call
      Returns:
      the evaluated value