Use a separate scope for "for" loops.

Refs #6183
This commit is contained in:
Gunnar Beutner 2014-05-10 12:03:54 +02:00
parent 0e34968e8f
commit 6d7e028f92
1 changed files with 5 additions and 4 deletions

View File

@ -586,11 +586,12 @@ Value AExpression::OpFor(const AExpression* expr, const Dictionary::Ptr& locals)
ObjectLock olock(arr);
BOOST_FOREACH(const Value& value, arr) {
locals->Set(varname, value);
ascope->Evaluate(locals);
}
Dictionary::Ptr xlocals = make_shared<Dictionary>();
xlocals->Set("__parent", locals);
xlocals->Set(varname, value);
locals->Remove(varname);
ascope->Evaluate(xlocals);
}
return Empty;
}