LibJS: Make String.prototype.slice() generic
This commit is contained in:
parent
cfdb7b8806
commit
8159f45f6e
Notes:
sideshowbarker
2024-07-19 07:10:55 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/8159f45f6ee Pull-request: https://github.com/SerenityOS/serenity/pull/2021
2 changed files with 3 additions and 4 deletions
|
@ -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);
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ try {
|
|||
"concat",
|
||||
"substring",
|
||||
"includes",
|
||||
"slice",
|
||||
];
|
||||
|
||||
genericStringPrototypeFunctions.forEach(name => {
|
||||
|
|
Loading…
Add table
Reference in a new issue