LibJS: Rename VM::get_reference() => resolve_binding()

This function maps to the ResolveBinding operation from the spec,
so let's rename it to match.
This commit is contained in:
Andreas Kling 2021-06-25 11:24:47 +02:00
parent 2b4cab284c
commit 07acdc7be2
Notes: sideshowbarker 2024-07-18 11:32:51 +09:00
3 changed files with 6 additions and 3 deletions

View file

@ -669,7 +669,7 @@ Reference Expression::to_reference(Interpreter&, GlobalObject&) const
Reference Identifier::to_reference(Interpreter& interpreter, GlobalObject&) const
{
return interpreter.vm().get_reference(string());
return interpreter.vm().resolve_binding(string());
}
Reference MemberExpression::to_reference(Interpreter& interpreter, GlobalObject& global_object) const

View file

@ -392,8 +392,11 @@ Value VM::get_variable(const FlyString& name, GlobalObject& global_object)
return value;
}
Reference VM::get_reference(const FlyString& name)
// 9.4.2 ResolveBinding ( name [ , env ] ), https://tc39.es/ecma262/#sec-resolvebinding
Reference VM::resolve_binding(FlyString const& name)
{
// FIXME: This implementation of ResolveBinding is non-conforming.
for (auto* environment_record = lexical_environment(); environment_record && environment_record->outer_environment(); environment_record = environment_record->outer_environment()) {
auto possible_match = environment_record->get_from_environment_record(name);
if (possible_match.has_value())

View file

@ -202,7 +202,7 @@ public:
void assign(const FlyString& target, Value, GlobalObject&, bool first_assignment = false, EnvironmentRecord* specific_scope = nullptr);
void assign(const NonnullRefPtr<BindingPattern>& target, Value, GlobalObject&, bool first_assignment = false, EnvironmentRecord* specific_scope = nullptr);
Reference get_reference(const FlyString& name);
Reference resolve_binding(FlyString const&);
template<typename T, typename... Args>
void throw_exception(GlobalObject& global_object, Args&&... args)