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

LibJS: Make Environment::has_binding() optionally return binding index

If the caller wants to use the binding index for anything, if there is
such a thing, it can now be obtained via an optional out-parameter.
This commit is contained in:
Andreas Kling 2021-10-06 23:53:22 +02:00
parent 6ef5464015
commit cb696eff08
7 changed files with 13 additions and 8 deletions

View file

@ -25,7 +25,7 @@ void ObjectEnvironment::visit_edges(Cell::Visitor& visitor)
}
// 9.1.1.2.1 HasBinding ( N ), https://tc39.es/ecma262/#sec-object-environment-records-hasbinding-n
bool ObjectEnvironment::has_binding(FlyString const& name) const
bool ObjectEnvironment::has_binding(FlyString const& name, Optional<size_t>*) const
{
auto& vm = this->vm();
bool found_binding = TRY_OR_DISCARD(m_binding_object.has_property(name));