Fixed bug in dependency checker that caused it to overwrite variables outside its scope

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1063 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2008-08-05 17:02:32 +00:00
parent 0ebf7cc1f1
commit dd006b9eca
3 changed files with 20 additions and 7 deletions
+5 -6
View File
@@ -159,7 +159,7 @@ ScriptValueP Context::dependencies(const Dependency& dep, const Script& script)
}
// unify bindings
FOR_EACH(v, j->bindings) {
unify(variables[v.variable].value, v.value.value);
setVariable(v.variable, unified(variables[v.variable].value, v.value.value) );
}
delete j;
}
@@ -368,9 +368,8 @@ void Context::getBindings(size_t scope, vector<Binding>& bindings) {
}
void Context::resetBindings(size_t scope) {
// same as closeScope()
while (shadowed.size() > scope) {
variables[shadowed.back().variable] = shadowed.back().value;
shadowed.pop_back();
}
// close and re-open the scope
closeScope(scope);
size_t same_scope = openScope();
assert(scope == same_scope);
}