1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 12:48:10 +00:00

LibJS: Port (most of) String.prototype to String

The locations that haven't been ported have a much wider footprint than
just the String.prototype files, so they've been left alone for now.
This commit is contained in:
Timothy Flynn 2023-01-14 10:40:08 -05:00 committed by Linus Groh
parent ceaec41726
commit 9f78e8728a
6 changed files with 73 additions and 70 deletions

View file

@ -43,7 +43,7 @@ ThrowCompletionOr<Value> StringConstructor::call()
{
auto& vm = this->vm();
if (!vm.argument_count())
return PrimitiveString::create(vm, "");
return PrimitiveString::create(vm, String {});
if (vm.argument(0).is_symbol())
return PrimitiveString::create(vm, vm.argument(0).as_symbol().to_deprecated_string());
return TRY(vm.argument(0).to_primitive_string(vm));