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

LibJS: Make References see into Environment's bindings as well

'bindings' is the spec-compliant version of 'variables', but we were
simply not even looking at them, which made things using bindings (such
as named function expressions) break in unexpected ways after the move
to using references in call expressions.

Co-Authored-By: davidot <david.tuin@gmail.com>
This commit is contained in:
Ali Mohammad Pur 2021-09-15 04:52:39 +04:30 committed by Andreas Kling
parent 3f31f109b5
commit 53d24fbd65
3 changed files with 25 additions and 5 deletions

View file

@ -417,6 +417,8 @@ Reference VM::get_identifier_reference(Environment* environment, FlyString name,
auto possible_match = environment->get_from_environment(name);
if (possible_match.has_value())
return Reference { *environment, move(name), strict };
if (environment->has_binding(name))
return Reference { *environment, move(name), strict };
}
auto& global_environment = interpreter().realm().global_environment();