1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 08:38:12 +00:00

LibJS: Replace GlobalObject with VM in Reference AOs [Part 6/19]

This commit is contained in:
Linus Groh 2022-08-21 15:39:13 +01:00
parent 275a7a0c0a
commit ae9e031f56
10 changed files with 88 additions and 77 deletions

View file

@ -66,13 +66,13 @@ TESTJS_GLOBAL_FUNCTION(mark_as_garbage, markAsGarbage)
auto reference = TRY(vm.resolve_binding(variable_name.string(), outer_environment.value()->lexical_environment));
auto value = TRY(reference.get_value(global_object));
auto value = TRY(reference.get_value(vm));
if (!can_be_held_weakly(value))
return vm.throw_completion<JS::TypeError>(JS::ErrorType::CannotBeHeldWeakly, String::formatted("Variable with name {}", variable_name.string()));
vm.heap().uproot_cell(&value.as_cell());
TRY(reference.delete_(global_object));
TRY(reference.delete_(vm));
return JS::js_undefined();
}