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
commit 53d24fbd65
Notes: sideshowbarker 2024-07-18 03:57:08 +09:00
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();