LibJS: Make String.prototype.slice() generic

This commit is contained in:
Linus Groh 2020-04-29 18:06:36 +01:00 committed by Andreas Kling
parent cfdb7b8806
commit 8159f45f6e
Notes: sideshowbarker 2024-07-19 07:10:55 +09:00
2 changed files with 3 additions and 4 deletions

View file

@ -388,12 +388,10 @@ Value StringPrototype::includes(Interpreter& interpreter)
Value StringPrototype::slice(Interpreter& interpreter)
{
auto* string_object = string_object_from(interpreter);
if (!string_object)
auto string = string_from(interpreter);
if (string.is_null())
return {};
auto& string = string_object->primitive_string().string();
if (interpreter.argument_count() == 0)
return js_string(interpreter, string);

View file

@ -16,6 +16,7 @@ try {
"concat",
"substring",
"includes",
"slice",
];
genericStringPrototypeFunctions.forEach(name => {