mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
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
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user