1
1
mirror of https://github.com/kanaka/mal.git synced 2024-09-21 02:27:10 +03:00
mal/objpascal/mal_func.pas
Joel Martin 0067158f6d Object Pascal: full implementation. Test cleanup.
- Move vector related step4 and step6 tests to optional.
- Fix two step9 tests that weren't checking return value.
2016-03-13 17:12:01 -05:00

58 lines
1.1 KiB
ObjectPascal

unit mal_func;
interface
uses mal_types,
mal_env;
// Some general type definitions
type
TMalCallable = function (Args : TMalArray) : TMal;
type TMalFunc = class(TMal)
public
Val : TMalCallable;
Ast : TMal;
Env : TEnv;
Params : TMalList;
isMacro : Boolean;
Meta : TMal;
constructor Create(V : TMalCallable);
constructor Create(A : TMal;
E : TEnv;
P : TMalList);
constructor Clone(F : TMalFunc);
end;
////////////////////////////////////////////////////////////
implementation
constructor TMalFunc.Create(V : TMalCallable);
begin
inherited Create();
Self.Val := V;
end;
constructor TMalFunc.Create(A : TMal;
E : TEnv;
P : TMalList);
begin
inherited Create();
Self.Ast := A;
Self.Env := E;
Self.Params := P;
end;
constructor TMalFunc.Clone(F : TMalFunc);
begin
Self.Create(F.Ast, F.Env, F.Params);
Self.isMacro := F.isMacro;
Self.Meta := F.Meta;
end;
end.