mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 06:38:10 +00:00
LibJS: Convert to_string() to ThrowCompletionOr
Also update get_function_name() to use ThrowCompletionOr, but this is not a standard AO and should be refactored out of existence eventually.
This commit is contained in:
parent
5d38cf4973
commit
4d8912a92b
48 changed files with 171 additions and 415 deletions
|
@ -44,7 +44,7 @@ Value SymbolConstructor::call()
|
|||
{
|
||||
if (vm().argument(0).is_undefined())
|
||||
return js_symbol(heap(), {}, false);
|
||||
return js_symbol(heap(), vm().argument(0).to_string(global_object()), false);
|
||||
return js_symbol(heap(), TRY_OR_DISCARD(vm().argument(0).to_string(global_object())), false);
|
||||
}
|
||||
|
||||
// 20.4.1.1 Symbol ( [ description ] ), https://tc39.es/ecma262/#sec-symbol-description
|
||||
|
@ -57,7 +57,7 @@ Value SymbolConstructor::construct(FunctionObject&)
|
|||
// 20.4.2.2 Symbol.for ( key ), https://tc39.es/ecma262/#sec-symbol.for
|
||||
JS_DEFINE_NATIVE_FUNCTION(SymbolConstructor::for_)
|
||||
{
|
||||
String description = vm.argument(0).to_string(global_object);
|
||||
auto description = TRY_OR_DISCARD(vm.argument(0).to_string(global_object));
|
||||
return global_object.vm().get_global_symbol(description);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue