Fix closures
This commit is contained in:
parent
aa25c31bcf
commit
a40fc2f2d8
@ -79,6 +79,14 @@ void Memory::update(string identifier, EvalResult value) {
|
|||||||
scope.vars[identifier].initialized = true;
|
scope.vars[identifier].initialized = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (scope.type == ScopeType::Function) {
|
||||||
|
Closure closure = std::get<1>(std::get<Function>(scope.fn->value));
|
||||||
|
if (closure.contains(identifier)) {
|
||||||
|
MemoryVar& var = closure.at(identifier);
|
||||||
|
var.value = value;
|
||||||
|
var.initialized = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
throw exception();
|
throw exception();
|
||||||
|
Loading…
Reference in New Issue
Block a user