mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 08:07:34 +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:
parent
95acb1ce88
commit
da856d7742
11 changed files with 507 additions and 692 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2021, Linus Groh <linusg@serenityos.org>
|
||||
* Copyright (c) 2021-2022, Linus Groh <linusg@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -117,13 +117,7 @@ ThrowCompletionOr<Value> perform_shadow_realm_eval(GlobalObject& global_object,
|
|||
// TODO: Optionally use bytecode interpreter?
|
||||
// FIXME: We need to use evaluate_statements() here because Program::execute() calls global_declaration_instantiation() when it shouldn't
|
||||
// a. Set result to the result of evaluating body.
|
||||
auto result_value = program->evaluate_statements(vm.interpreter(), eval_realm.global_object());
|
||||
if (auto* exception = vm.exception())
|
||||
result = throw_completion(exception->value());
|
||||
else if (!result_value.is_empty())
|
||||
result = normal_completion(result_value);
|
||||
else
|
||||
result = Completion {}; // Normal completion with no value
|
||||
result = program->evaluate_statements(vm.interpreter(), eval_realm.global_object());
|
||||
}
|
||||
|
||||
// 21. If result.[[Type]] is normal and result.[[Value]] is empty, then
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue