1
1
mirror of https://github.com/kanaka/mal.git synced 2024-10-05 18:08:55 +03:00

java: prevent defmacro from mutating functions

This commit is contained in:
Nicolas Boulenguez 2021-08-09 13:18:42 +02:00 committed by Joel Martin
parent d4abb633b5
commit e1b778481c
3 changed files with 3 additions and 0 deletions

View File

@ -156,6 +156,7 @@ public class step8_macros {
a1 = ast.nth(1);
a2 = ast.nth(2);
res = EVAL(a2, env);
res = res.copy();
((MalFunction)res).setMacro();
env.set((MalSymbol)a1, res);
return res;

View File

@ -158,6 +158,7 @@ public class step9_try {
a1 = ast.nth(1);
a2 = ast.nth(2);
res = EVAL(a2, env);
res = res.copy();
((MalFunction)res).setMacro();
env.set((MalSymbol)a1, res);
return res;

View File

@ -158,6 +158,7 @@ public class stepA_mal {
a1 = ast.nth(1);
a2 = ast.nth(2);
res = EVAL(a2, env);
res = res.copy();
((MalFunction)res).setMacro();
env.set((MalSymbol)a1, res);
return res;