vhdl: defmacro! doesn't modify existing functions
authorDov Murik <dov.murik@gmail.com>
Wed, 30 Sep 2020 17:28:12 +0000 (20:28 +0300)
committerDov Murik <dov.murik@gmail.com>
Wed, 30 Sep 2020 17:28:12 +0000 (20:28 +0300)
impls/vhdl/step8_macros.vhdl
impls/vhdl/step9_try.vhdl
impls/vhdl/stepA_mal.vhdl

index 9cc740e..8b799ad 100644 (file)
@@ -291,11 +291,12 @@ architecture test of step8_macros is
           next; -- TCO
 
         elsif a0.string_val.all = "defmacro!" then
-          EVAL(ast.seq_val(2), env, val, sub_err);
+          EVAL(ast.seq_val(2), env, fn, sub_err);
           if sub_err /= null then
             err := sub_err;
             return;
           end if;
+          new_fn(fn.func_val.f_body, fn.func_val.f_args, fn.func_val.f_env, val);
           val.func_val.f_is_macro := true;
           env_set(env, ast.seq_val(1), val);
           result := val;
index ad9612f..583acb7 100644 (file)
@@ -331,11 +331,12 @@ architecture test of step9_try is
           next; -- TCO
 
         elsif a0.string_val.all = "defmacro!" then
-          EVAL(ast.seq_val(2), env, val, sub_err);
+          EVAL(ast.seq_val(2), env, fn, sub_err);
           if sub_err /= null then
             err := sub_err;
             return;
           end if;
+          new_fn(fn.func_val.f_body, fn.func_val.f_args, fn.func_val.f_env, val);
           val.func_val.f_is_macro := true;
           env_set(env, ast.seq_val(1), val);
           result := val;
index 3b461d2..bcbaadc 100644 (file)
@@ -331,11 +331,12 @@ architecture test of stepA_mal is
           next; -- TCO
 
         elsif a0.string_val.all = "defmacro!" then
-          EVAL(ast.seq_val(2), env, val, sub_err);
+          EVAL(ast.seq_val(2), env, fn, sub_err);
           if sub_err /= null then
             err := sub_err;
             return;
           end if;
+          new_fn(fn.func_val.f_body, fn.func_val.f_args, fn.func_val.f_env, val);
           val.func_val.f_is_macro := true;
           env_set(env, ast.seq_val(1), val);
           result := val;