From 13157f6d67c198a159d398b7f6fd472843906714 Mon Sep 17 00:00:00 2001 From: twanvl Date: Wed, 18 Jun 2008 23:25:26 +0000 Subject: [PATCH] Make ScriptClosure work correctly in combination with ScriptCompose: have a local scope. git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@994 0fc631ac-6414-0410-93d0-97cfa31319b6 --- src/script/value.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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); } }