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 << " ";
|
std::cout << " ";
|
||||||
} catch (exceptions::exit& e) {
|
} catch (exceptions::exit& e) {
|
||||||
return e.code;
|
return e.code;
|
||||||
} /*catch (exceptions::langException& e) {
|
} catch (exceptions::langException& e) {
|
||||||
std::cout << "E: Language exception: " << e.what() << std::endl;
|
std::cout << "E: Language exception: " << e.what() << std::endl;
|
||||||
line.clear();
|
line.clear();
|
||||||
}*/
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -321,10 +321,12 @@ namespace Pilang3 {
|
||||||
scope[argumentNames[args_idx - 1]] = std::make_shared<Variable>(args[args_idx - 1]);
|
scope[argumentNames[args_idx - 1]] = std::make_shared<Variable>(args[args_idx - 1]);
|
||||||
}
|
}
|
||||||
env->variableScope.push(scope); // Start new scope
|
env->variableScope.push(scope); // Start new scope
|
||||||
// Execute all evaluations
|
// Copy, derefer and execute all evaluations
|
||||||
for (auto& evaluation : evalChain) {
|
for (auto& evaluation : evalChain) {
|
||||||
evaluation->derefer(env);
|
auto thiseval = Evaluation(*evaluation);
|
||||||
fres = evaluation->execute(env);
|
thiseval.derefer(env);
|
||||||
|
fres = thiseval.execute(env);
|
||||||
|
// Return on return
|
||||||
if (fres.type == Variable::id_retval) {
|
if (fres.type == Variable::id_retval) {
|
||||||
auto fresdata = std::get<SharedVariable>(fres.data);
|
auto fresdata = std::get<SharedVariable>(fres.data);
|
||||||
env->variableScope.pop(); // End scope
|
env->variableScope.pop(); // End scope
|
||||||
|
|
Loading…
Add table
Reference in a new issue