mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 11:14:58 +00:00
LibJS: Implement WeakMap changes from 'Symbol as WeakMap Keys Proposal'
This commit is contained in:
parent
22a78e8a2c
commit
a80d3fdf49
8 changed files with 39 additions and 18 deletions
|
@ -68,10 +68,10 @@ TESTJS_GLOBAL_FUNCTION(mark_as_garbage, markAsGarbage)
|
|||
|
||||
auto value = TRY(reference.get_value(global_object));
|
||||
|
||||
if (!value.is_object())
|
||||
return vm.throw_completion<JS::TypeError>(global_object, JS::ErrorType::NotAnObject, String::formatted("Variable with name {}", variable_name.string()));
|
||||
if (!can_be_held_weakly(value))
|
||||
return vm.throw_completion<JS::TypeError>(global_object, JS::ErrorType::CannotBeHeldWeakly, String::formatted("Variable with name {}", variable_name.string()));
|
||||
|
||||
vm.heap().uproot_cell(&value.as_object());
|
||||
vm.heap().uproot_cell(&value.as_cell());
|
||||
TRY(reference.delete_(global_object));
|
||||
|
||||
return JS::js_undefined();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue