Class EzrFunction
- Namespace
- EzrSquared.Runtime.Types.Executables
- Assembly
- ezrSquared-lib.dll
The function type object.
public class EzrFunction : EzrRuntimeExecutable, IEzrMutableObject, IMutable<IEzrMutableObject>, IEzrObject
- Inheritance
-
objectEzrFunction
- Implements
- Inherited Members
Constructors
EzrFunction(string?, Node, (string Name, Node Node)[], (Position StartPosition, Position EndPosition, string Name)?, (Position StartPosition, Position EndPosition, string Name)?, bool, Context, Position, Position)
public EzrFunction(string? name, Node body, (string Name, Node Node)[] parameters, (Position StartPosition, Position EndPosition, string Name)? extraKeywordArguments, (Position StartPosition, Position EndPosition, string Name)? extraPositionalArguments, bool returnLast, Context parentContext, Position startPosition, Position endPosition)
Parameters
name
stringThe name of the executable.
body
NodeThe source code body of the executable.
parameters
(string Name, Node Node)[]The source code of the executable's parameters and their default values.
extraKeywordArguments
(Position StartPosition, Position EndPosition, string Name)?The position in source code and name of the variable for the executable's extra keyword arguments.
extraPositionalArguments
(Position StartPosition, Position EndPosition, string Name)?The position in source code and name of the variable for the executable's extra positional arguments.
returnLast
boolShould the function return its last expression as the result?
parentContext
ContextThe parent context.
startPosition
PositionThe starting position of the object.
endPosition
PositionThe ending position of the object.
Fields
ReturnLast
Should the function return its last expression as the result?
public readonly bool ReturnLast
Field Value
- bool
_runtimeMethodContext
The context used to run the method's code in.
private readonly Context _runtimeMethodContext
Field Value
Remarks
Do not use this, it's cleared after the method is run.
Properties
Tag
The tag of the type of this object, similar to C# namespace naming conventions.
public override string Tag { get; protected internal set; }
Property Value
- string
TypeName
The name of the type of this object, in plain text, all lowercase. Spaces are allowed.
public override string TypeName { get; protected internal set; }
Property Value
- string
Methods
DeepCopy(RuntimeResult)
Creates a deep copy of the IMutable<T>.
public IMutable<IEzrMutableObject>? DeepCopy(RuntimeResult result)
Parameters
result
RuntimeResultRuntime result for raising errors./
Returns
- IMutable<IEzrMutableObject>
The copy, or, null if failed.
Remarks
The deep copy here means that all IMutable<T> properties and fields in the object are also copied.
Execute(Reference[], Interpreter, RuntimeResult)
Executes the current object, like a function.
public override void Execute(Reference[] arguments, Interpreter interpreter, RuntimeResult result)
Parameters
arguments
Reference[]The arguments of the execution.
interpreter
InterpreterThe interpreter to be used in execution.
result
RuntimeResultRuntime result for carrying the result and any errors.
Execute(Reference[], Interpreter, RuntimeResult, bool)
Executes the current function.
public void Execute(Reference[] arguments, Interpreter interpreter, RuntimeResult result, bool ignoreExtraArguments)
Parameters
arguments
Reference[]The arguments of the execution.
interpreter
InterpreterThe interpreter to be used in execution.
result
RuntimeResultRuntime result for carrying the result and any errors.
ignoreExtraArguments
boolShould the function ignore extra arguments?