1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 06:27:45 +00:00

LibJS: Fix that non-existent references are unresolvable in strict mode

This commit is contained in:
davidot 2021-07-12 01:38:45 +02:00 committed by Andreas Kling
parent a49b47bfe6
commit f8a869f2fc

View file

@ -414,9 +414,14 @@ Reference VM::get_identifier_reference(Environment* environment, FlyString const
if (possible_match.has_value()) if (possible_match.has_value())
return Reference { *environment, name, strict }; return Reference { *environment, name, strict };
} }
if (global_object.environment().has_binding(name) || !in_strict_mode()) {
return Reference { global_object.environment(), name, strict }; return Reference { global_object.environment(), name, strict };
} }
return Reference { Reference::BaseType::Unresolvable, name, strict };
}
// 9.4.2 ResolveBinding ( name [ , env ] ), https://tc39.es/ecma262/#sec-resolvebinding // 9.4.2 ResolveBinding ( name [ , env ] ), https://tc39.es/ecma262/#sec-resolvebinding
Reference VM::resolve_binding(FlyString const& name, Environment* environment) Reference VM::resolve_binding(FlyString const& name, Environment* environment)
{ {