fix: mondo dont mutate (breaks lambdas)

This commit is contained in:
Felix Roos 2025-03-30 11:36:50 +02:00
parent c9cafa37fd
commit b4027fd92a
No known key found for this signature in database

View file

@ -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);
}
}