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

nim: prevent defmacro from mutating functions

This commit is contained in:
Nicolas Boulenguez 2021-08-17 20:28:44 +02:00 committed by Joel Martin
parent ed9c6187b4
commit 5452aa2782
3 changed files with 3 additions and 3 deletions

View File

@ -113,7 +113,7 @@ proc eval(ast: MalType, env: Env): MalType =
of "defmacro!":
var fun = ast.list[2].eval(env)
fun.malfun.is_macro = true
fun = malfun(fun.malfun.fn, fun.malfun.ast, fun.malfun.params, fun.malfun.env, true)
return env.set(ast.list[1].str, fun)
of "macroexpand":

View File

@ -114,7 +114,7 @@ proc eval(ast: MalType, env: Env): MalType =
of "defmacro!":
var fun = ast.list[2].eval(env)
fun.malfun.is_macro = true
fun = malfun(fun.malfun.fn, fun.malfun.ast, fun.malfun.params, fun.malfun.env, true)
return env.set(ast.list[1].str, fun)
of "macroexpand":

View File

@ -114,7 +114,7 @@ proc eval(ast: MalType, env: Env): MalType =
of "defmacro!":
var fun = ast.list[2].eval(env)
fun.malfun.is_macro = true
fun = malfun(fun.malfun.fn, fun.malfun.ast, fun.malfun.params, fun.malfun.env, true)
return env.set(ast.list[1].str, fun)
of "macroexpand":