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:
parent
ed9c6187b4
commit
5452aa2782
@ -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":
|
||||
|
@ -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":
|
||||
|
@ -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":
|
||||
|
Loading…
Reference in New Issue
Block a user