diff --git a/src/script/value.cpp b/src/script/value.cpp index f0858bd9..8db071e8 100644 --- a/src/script/value.cpp +++ b/src/script/value.cpp @@ -398,16 +398,18 @@ ScriptValueP ScriptClosure::simplify() { } ScriptValueP ScriptClosure::eval(Context& ctx) const { + LocalScope scope(ctx); applyBindings(ctx); return fun->eval(ctx); } ScriptValueP ScriptClosure::dependencies(Context& ctx, const Dependency& dep) const { + LocalScope scope(ctx); applyBindings(ctx); return fun->dependencies(ctx, dep); } void ScriptClosure::applyBindings(Context& ctx) const { FOR_EACH_CONST(b, bindings) { - if (ctx.getVariableScope(b.first) != 0) { + if (ctx.getVariableScope(b.first) != 1) { ctx.setVariable(b.first, b.second); } }