mirror of
https://gitlab.com/niansa/pilang3.git
synced 2025-03-06 20:49:20 +01:00
Fixed evaluation dereference being cached in function
This commit is contained in:
parent
5d835929cb
commit
d185ff9b20
2 changed files with 7 additions and 5 deletions
4
main.cpp
4
main.cpp
|
@ -28,9 +28,9 @@ int main() {
|
|||
std::cout << " ";
|
||||
} catch (exceptions::exit& e) {
|
||||
return e.code;
|
||||
} /*catch (exceptions::langException& e) {
|
||||
} catch (exceptions::langException& e) {
|
||||
std::cout << "E: Language exception: " << e.what() << std::endl;
|
||||
line.clear();
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -321,10 +321,12 @@ namespace Pilang3 {
|
|||
scope[argumentNames[args_idx - 1]] = std::make_shared<Variable>(args[args_idx - 1]);
|
||||
}
|
||||
env->variableScope.push(scope); // Start new scope
|
||||
// Execute all evaluations
|
||||
// Copy, derefer and execute all evaluations
|
||||
for (auto& evaluation : evalChain) {
|
||||
evaluation->derefer(env);
|
||||
fres = evaluation->execute(env);
|
||||
auto thiseval = Evaluation(*evaluation);
|
||||
thiseval.derefer(env);
|
||||
fres = thiseval.execute(env);
|
||||
// Return on return
|
||||
if (fres.type == Variable::id_retval) {
|
||||
auto fresdata = std::get<SharedVariable>(fres.data);
|
||||
env->variableScope.pop(); // End scope
|
||||
|
|
Loading…
Add table
Reference in a new issue