mirror of
https://github.com/kanaka/mal.git
synced 2024-08-17 09:40:21 +03:00
d: prevent defmacro from mutating functions
This commit is contained in:
parent
e3c376ebd5
commit
13a84ba0aa
@ -165,6 +165,7 @@ MalType EVAL(MalType ast, Env env)
|
||||
case "defmacro!":
|
||||
auto a1 = verify_cast!MalSymbol(aste[1]);
|
||||
auto mac = verify_cast!MalFunc(EVAL(aste[2], env));
|
||||
mac = new MalFunc(mac.arg_names, mac.func_body, mac.def_env);
|
||||
mac.is_macro = true;
|
||||
return env.set(a1, mac);
|
||||
|
||||
|
@ -165,6 +165,7 @@ MalType EVAL(MalType ast, Env env)
|
||||
case "defmacro!":
|
||||
auto a1 = verify_cast!MalSymbol(aste[1]);
|
||||
auto mac = verify_cast!MalFunc(EVAL(aste[2], env));
|
||||
mac = new MalFunc(mac.arg_names, mac.func_body, mac.def_env);
|
||||
mac.is_macro = true;
|
||||
return env.set(a1, mac);
|
||||
|
||||
|
@ -166,6 +166,7 @@ MalType EVAL(MalType ast, Env env)
|
||||
case "defmacro!":
|
||||
auto a1 = verify_cast!MalSymbol(aste[1]);
|
||||
auto mac = verify_cast!MalFunc(EVAL(aste[2], env));
|
||||
mac = new MalFunc(mac.arg_names, mac.func_body, mac.def_env);
|
||||
mac.is_macro = true;
|
||||
return env.set(a1, mac);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user