1
1
mirror of https://github.com/kanaka/mal.git synced 2024-09-21 02:27:10 +03:00
mal/impls/ada.2/types-builtins.adb
Joel Martin 8a19f60386 Move implementations into impls/ dir
- Reorder README to have implementation list after "learning tool"
  bullet.

- This also moves tests/ and libs/ into impls. It would be preferrable
  to have these directories at the top level.  However, this causes
  difficulties with the wasm implementations which need pre-open
  directories and have trouble with paths starting with "../../". So
  in lieu of that, symlink those directories to the top-level.

- Move the run_argv_test.sh script into the tests directory for
  general hygiene.
2020-02-10 23:50:16 -06:00

32 lines
986 B
Ada

package body Types.Builtins is
function Builtin (Item : in Instance) return Builtin_Ptr
is (Item.F_Builtin);
procedure Keep_References (Object : in out Instance) is
begin
Keep (Object.F_Meta);
end Keep_References;
function Meta (Item : in Instance) return T
is (Item.F_Meta);
function With_Meta (Builtin : in Builtin_Ptr;
Metadata : in T) return T
is
-- Builtin is not null and requires an immediate initialization.
Ref : constant Builtin_With_Meta_Ptr
:= new Instance'(Garbage_Collected.Instance with
F_Builtin => Builtin,
F_Meta => Metadata);
begin
Garbage_Collected.Register (Garbage_Collected.Pointer (Ref));
return (Kind_Builtin_With_Meta, Ref);
end With_Meta;
function With_Meta (Builtin : in Instance;
Metadata : in T) return T
is (With_Meta (Builtin.F_Builtin, Metadata));
end Types.Builtins;