From b4027fd92ac38f9426e29982bd444fa197754f33 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Sun, 30 Mar 2025 11:36:50 +0200 Subject: [PATCH] fix: mondo dont mutate (breaks lambdas) --- packages/mondo/mondo.mjs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/mondo/mondo.mjs b/packages/mondo/mondo.mjs index 673841cd..0e8dc857 100644 --- a/packages/mondo/mondo.mjs +++ b/packages/mondo/mondo.mjs @@ -343,8 +343,9 @@ export class MondoRunner { return this.evaluate(body, scope); }; } - // evaluate all children before evaluating list - ast.children = ast.children.map((arg) => this.evaluate(arg, scope)); - return this.evaluator(ast, scope); + // evaluate all children before evaluating list (dont mutate!!!) + const args = ast.children.map((arg) => this.evaluate(arg, scope)); + const node = { type: 'list', children: args }; + return this.evaluator(node, scope); } }