mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 05:48:12 +00:00
LibJS: Add side-effect-free version of Value::to_string()
There are now two API's on Value: - Value::to_string(Interpreter&) -- may throw. - Value::to_string_without_side_effects() -- will never throw. These are some pretty big sweeping changes, so it's possible that I did some part the wrong way. We'll work it out as we go. :^) Fixes #2123.
This commit is contained in:
parent
d8aa2a6997
commit
c6ddbd1f3e
25 changed files with 285 additions and 112 deletions
|
@ -112,7 +112,9 @@ Value ObjectConstructor::get_own_property_descriptor(Interpreter& interpreter)
|
|||
auto* object = interpreter.argument(0).to_object(interpreter.heap());
|
||||
if (interpreter.exception())
|
||||
return {};
|
||||
auto property_key = interpreter.argument(1).to_string();
|
||||
auto property_key = interpreter.argument(1).to_string(interpreter);
|
||||
if (interpreter.exception())
|
||||
return {};
|
||||
return object->get_own_property_descriptor(property_key);
|
||||
}
|
||||
|
||||
|
@ -123,7 +125,9 @@ Value ObjectConstructor::define_property(Interpreter& interpreter)
|
|||
if (!interpreter.argument(2).is_object())
|
||||
return interpreter.throw_exception<TypeError>("Descriptor argument is not an object");
|
||||
auto& object = interpreter.argument(0).as_object();
|
||||
auto property_key = interpreter.argument(1).to_string();
|
||||
auto property_key = interpreter.argument(1).to_string(interpreter);
|
||||
if (interpreter.exception())
|
||||
return {};
|
||||
auto& descriptor = interpreter.argument(2).as_object();
|
||||
object.define_property(property_key, descriptor);
|
||||
return &object;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue