1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:17:45 +00:00

LibJS: Update AST to use completions :^)

This is another major milestone on our journey towards removing global
VM exception state :^)
Does pretty much exactly what it says on the tin: updating
ASTNode::execute() to return a Completion instead of a plain value. This
will *also* allow us to eventually remove the non-standard unwinding
mechanism and purely rely on the various completion types.
This commit is contained in:
Linus Groh 2022-01-02 21:37:50 +01:00
parent 95acb1ce88
commit da856d7742
11 changed files with 507 additions and 692 deletions

View file

@ -59,8 +59,8 @@ void Interpreter::run(GlobalObject& global_object, const Program& program)
execution_context.realm = &realm();
execution_context.is_strict_mode = program.is_strict_mode();
MUST(vm.push_execution_context(execution_context, global_object));
auto value = program.execute(*this, global_object);
vm.set_last_value(Badge<Interpreter> {}, value.value_or(js_undefined()));
auto completion = program.execute(*this, global_object);
vm.set_last_value(Badge<Interpreter> {}, completion.value().value_or(js_undefined()));
// FIXME: We unconditionally stop the unwind here this should be done using completions leaving
// the VM in a cleaner state after executing. For example it does still store the exception.