1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 19:57:44 +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,7 +414,12 @@ Reference VM::get_identifier_reference(Environment* environment, FlyString const
if (possible_match.has_value())
return Reference { *environment, name, strict };
}
return Reference { global_object.environment(), name, strict };
if (global_object.environment().has_binding(name) || !in_strict_mode()) {
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