summaryrefslogtreecommitdiff
path: root/Tests/LibJS
diff options
context:
space:
mode:
authordavidot <davidot@serenityos.org>2021-12-30 14:13:20 +0100
committerLinus Groh <mail@linusgroh.de>2021-12-30 15:29:33 +0100
commit676554d3f86d7c429f1969942190427666b5423e (patch)
tree6d598d4a12ab310167d7143d815962c0d299934c /Tests/LibJS
parentdfaa6c910cda9fd49e681f10c7efbabed74ef0a6 (diff)
downloadserenity-676554d3f86d7c429f1969942190427666b5423e.zip
LibJS: Convert resolve_binding() to ThrowCompletionOr
The spec has a note stating that resolve binding will always return a reference whose [[ReferencedName]] field is name. However this is not correct as the underlying method GetIdentifierReference may throw on env.HasBinding(name) thus it can throw. However, there are some scenarios where it cannot throw because the reference is known to exist in that case we use MUST with a comment.
Diffstat (limited to 'Tests/LibJS')
-rw-r--r--Tests/LibJS/test-js.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/Tests/LibJS/test-js.cpp b/Tests/LibJS/test-js.cpp
index e8fb258ba8..54e98eef0e 100644
--- a/Tests/LibJS/test-js.cpp
+++ b/Tests/LibJS/test-js.cpp
@@ -63,7 +63,7 @@ TESTJS_GLOBAL_FUNCTION(mark_as_garbage, markAsGarbage)
if (!outer_environment.has_value())
return vm.throw_completion<JS::ReferenceError>(global_object, JS::ErrorType::UnknownIdentifier, variable_name.string());
- auto reference = vm.resolve_binding(variable_name.string(), outer_environment.value()->lexical_environment);
+ auto reference = TRY(vm.resolve_binding(variable_name.string(), outer_environment.value()->lexical_environment));
auto value = TRY(reference.get_value(global_object));