mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-12 20:42:21 +00:00
LibJS: Throw on failed PutValue into an environment reference
This should really be handled at a different layer of the stack, but this allows us to make progress on the Object rewrite without breaking strict mode assignment tests.
This commit is contained in:
parent
80170887db
commit
a4897ed7b2
Notes:
sideshowbarker
2024-07-18 11:08:59 +09:00
Author: https://github.com/awesomekling
Commit: a4897ed7b2
1 changed files with 9 additions and 1 deletions
|
@ -60,7 +60,15 @@ void Reference::put_value(GlobalObject& global_object, Value value)
|
|||
return;
|
||||
}
|
||||
|
||||
m_base_environment->put_into_environment(m_name.as_string(), variable);
|
||||
bool succeeded = m_base_environment->put_into_environment(m_name.as_string(), variable);
|
||||
if (vm.exception())
|
||||
return;
|
||||
|
||||
if (!succeeded && m_strict) {
|
||||
// FIXME: This is a hack and will disappear when we support proper variable bindings.
|
||||
vm.throw_exception<TypeError>(global_object, ErrorType::DescWriteNonWritable, m_name.to_value(vm).to_string_without_side_effects());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void Reference::throw_reference_error(GlobalObject& global_object)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue