mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-08 10:36:02 +00:00
LibJS: Add an else in StringPrototype::substr
No behavior change, but makes the code look more like the spec test for this function.
This commit is contained in:
parent
1b944b4c41
commit
db869a0402
Notes:
sideshowbarker
2024-07-17 22:55:25 +09:00
Author: https://github.com/nico
Commit: db869a0402
Pull-request: https://github.com/SerenityOS/serenity/pull/11884
1 changed files with 1 additions and 1 deletions
|
@ -517,7 +517,7 @@ JS_DEFINE_NATIVE_FUNCTION(StringPrototype::substr)
|
||||||
auto int_start = TRY(vm.argument(0).to_integer_or_infinity(global_object));
|
auto int_start = TRY(vm.argument(0).to_integer_or_infinity(global_object));
|
||||||
if (Value(int_start).is_negative_infinity())
|
if (Value(int_start).is_negative_infinity())
|
||||||
int_start = 0;
|
int_start = 0;
|
||||||
if (int_start < 0)
|
else if (int_start < 0)
|
||||||
int_start = max(size + int_start, 0);
|
int_start = max(size + int_start, 0);
|
||||||
|
|
||||||
auto length = vm.argument(1);
|
auto length = vm.argument(1);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue