mirror of
https://github.com/kanaka/mal.git
synced 2024-10-26 14:22:25 +03:00
ada.2: stop supporting metadata for atoms
This is not required anymore.
This commit is contained in:
parent
5140bf269f
commit
770aae175f
@ -179,10 +179,8 @@ package body Core is
|
|||||||
return A1.Builtin_With_Meta.all.Meta;
|
return A1.Builtin_With_Meta.all.Meta;
|
||||||
when Kind_Builtin =>
|
when Kind_Builtin =>
|
||||||
return Types.Nil;
|
return Types.Nil;
|
||||||
when Kind_Atom =>
|
|
||||||
return A1.Atom.all.Meta;
|
|
||||||
when others =>
|
when others =>
|
||||||
Err.Raise_With ("expected an atom, function, map or sequence");
|
Err.Raise_With ("expected a function, map or sequence");
|
||||||
end case;
|
end case;
|
||||||
end;
|
end;
|
||||||
end Meta;
|
end Meta;
|
||||||
@ -451,8 +449,6 @@ package body Core is
|
|||||||
when Kind_Fn =>
|
when Kind_Fn =>
|
||||||
return (Kind_Fn, Types.Fns.New_Function
|
return (Kind_Fn, Types.Fns.New_Function
|
||||||
(A1.Fn.all.Params, A1.Fn.all.Ast, A1.Fn.all.Env, A2));
|
(A1.Fn.all.Params, A1.Fn.all.Ast, A1.Fn.all.Env, A2));
|
||||||
when Kind_Atom =>
|
|
||||||
return A1.Atom.all.With_Meta (A2);
|
|
||||||
when others =>
|
when others =>
|
||||||
Err.Raise_With
|
Err.Raise_With
|
||||||
("parameter 1 must be a function, map or sequence");
|
("parameter 1 must be a function, map or sequence");
|
||||||
|
@ -29,12 +29,8 @@ package body Types.Atoms is
|
|||||||
procedure Keep_References (Object : in out Instance) is
|
procedure Keep_References (Object : in out Instance) is
|
||||||
begin
|
begin
|
||||||
Keep (Object.Data);
|
Keep (Object.Data);
|
||||||
Keep (Object.Meta);
|
|
||||||
end Keep_References;
|
end Keep_References;
|
||||||
|
|
||||||
function Meta (Item : in Instance) return T
|
|
||||||
is (Item.F_Meta);
|
|
||||||
|
|
||||||
function Reset (Args : in T_Array) return T is
|
function Reset (Args : in T_Array) return T is
|
||||||
begin
|
begin
|
||||||
Err.Check (Args'Length = 2 and then Args (Args'First).Kind = Kind_Atom,
|
Err.Check (Args'Length = 2 and then Args (Args'First).Kind = Kind_Atom,
|
||||||
@ -66,14 +62,4 @@ package body Types.Atoms is
|
|||||||
end;
|
end;
|
||||||
end Swap;
|
end Swap;
|
||||||
|
|
||||||
function With_Meta (Item : in Instance;
|
|
||||||
Metadata : in T) return T is
|
|
||||||
Ref : constant Atom_Ptr := new Instance;
|
|
||||||
begin
|
|
||||||
Garbage_Collected.Register (Garbage_Collected.Pointer (Ref));
|
|
||||||
Ref.all.Data := Item.Data;
|
|
||||||
Ref.all.F_Meta := Metadata;
|
|
||||||
return (Kind_Atom, Ref);
|
|
||||||
end With_Meta;
|
|
||||||
|
|
||||||
end Types.Atoms;
|
end Types.Atoms;
|
||||||
|
@ -13,15 +13,10 @@ package Types.Atoms is
|
|||||||
-- Helper for print.
|
-- Helper for print.
|
||||||
function Deref (Item : in Instance) return T with Inline;
|
function Deref (Item : in Instance) return T with Inline;
|
||||||
|
|
||||||
function With_Meta (Item : in Instance;
|
|
||||||
Metadata : in T) return T;
|
|
||||||
function Meta (Item : in Instance) return T;
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
type Instance is new Garbage_Collected.Instance with record
|
type Instance is new Garbage_Collected.Instance with record
|
||||||
Data : T;
|
Data : T;
|
||||||
F_Meta : T;
|
|
||||||
end record;
|
end record;
|
||||||
|
|
||||||
overriding procedure Keep_References (Object : in out Instance) with Inline;
|
overriding procedure Keep_References (Object : in out Instance) with Inline;
|
||||||
|
Loading…
Reference in New Issue
Block a user