From ac666a1dda9bf9f9ca53f4543af66a3652fcd70b Mon Sep 17 00:00:00 2001 From: Nicolas Boulenguez Date: Tue, 22 Oct 2024 14:58:32 +0200 Subject: [PATCH] chuck: prevent defmacro! from mutating its argument --- impls/chuck/step8_macros.ck | 1 + impls/chuck/step9_try.ck | 1 + impls/chuck/stepA_mal.ck | 1 + 3 files changed, 3 insertions(+) diff --git a/impls/chuck/step8_macros.ck b/impls/chuck/step8_macros.ck index 00e162aeaa..69a15c5abf 100644 --- a/impls/chuck/step8_macros.ck +++ b/impls/chuck/step8_macros.ck @@ -202,6 +202,7 @@ fun MalObject EVAL(MalObject m, Env env) return value; } + value.clone() @=> value; true => (value$Func).isMacro; env.set(a1, value); diff --git a/impls/chuck/step9_try.ck b/impls/chuck/step9_try.ck index 90ed1739e0..c940fcdec5 100644 --- a/impls/chuck/step9_try.ck +++ b/impls/chuck/step9_try.ck @@ -202,6 +202,7 @@ fun MalObject EVAL(MalObject m, Env env) return value; } + value.clone() @=> value; true => (value$Func).isMacro; env.set(a1, value); diff --git a/impls/chuck/stepA_mal.ck b/impls/chuck/stepA_mal.ck index bbc2e990dd..230adea8a3 100644 --- a/impls/chuck/stepA_mal.ck +++ b/impls/chuck/stepA_mal.ck @@ -202,6 +202,7 @@ fun MalObject EVAL(MalObject m, Env env) return value; } + value.clone() @=> value; true => (value$Func).isMacro; env.set(a1, value);