1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-02 23:42:13 +00:00

LibJS: Convert set_mutable_binding() to ThrowCompletionOr

Also add spec step comments to it while we're here.
This commit is contained in:
Linus Groh 2021-10-09 19:34:54 +01:00
parent ae397541fb
commit 7652138ce0
11 changed files with 68 additions and 52 deletions

View file

@ -49,10 +49,11 @@ void Reference::put_value(GlobalObject& global_object, Value value)
VERIFY(m_base_type == BaseType::Environment);
VERIFY(m_base_environment);
// These can throw, TRY() when converting put_value() to ThrowCompletionOr
if (m_environment_coordinate.has_value())
static_cast<DeclarativeEnvironment*>(m_base_environment)->set_mutable_binding_direct(global_object, m_environment_coordinate->index, value, m_strict);
(void)static_cast<DeclarativeEnvironment*>(m_base_environment)->set_mutable_binding_direct(global_object, m_environment_coordinate->index, value, m_strict);
else
m_base_environment->set_mutable_binding(global_object, m_name.as_string(), value, m_strict);
(void)m_base_environment->set_mutable_binding(global_object, m_name.as_string(), value, m_strict);
}
void Reference::throw_reference_error(GlobalObject& global_object) const