public abstract class AstBuiltin<T extends AstBuiltin<T>> extends AstPrimitive<T>
Constructor and Description |
---|
AstBuiltin() |
Modifier and Type | Method and Description |
---|---|
Val |
apply(Env env,
Env.StackHelp stk,
AstRoot[] asts)
Primary method to invoke this function, passing all the parameters
as the `asts` list.
|
protected Val |
exec(Val[] args)
Most Ast* functions will want to override this method.
|
args, description, example, exec, nargs
asBytes, clone, copyOver, frozenType, read, readExternal, readJSON, reloadFromBytes, toJsonBytes, toJsonString, write, writeExternal, writeJSON
public Val apply(Env env, Env.StackHelp stk, AstRoot[] asts)
Primary method to invoke this function, passing all the parameters as the `asts` list.
The default implementation of this method executes all Asts within
the provided environment, and then calls exec(Val[])
passing it
the arguments as the list of Val
s. A derived class will then only
need to override the second `exec()` function which is much simpler.
However for certain functions (such as short-circuit boolean operators) executing all arguments is not desirable -- these functions would have to override this more general method.
apply
in class AstPrimitive<T extends AstBuiltin<T>>
env
- Current execution environment. Variables are looked up here.stk
- TODO need clarificationasts
- List of AstRoot expressions that are arguments to the
function. First element in this list is the function itself.