summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2022-05-03 21:37:01 +0200
committerLinus Groh <mail@linusgroh.de>2022-05-03 22:49:31 +0200
commitf3768705a97ed07423024997fd5224712965acb1 (patch)
tree5475aaf33caf68ddfe9145d1a4a34bc7061c2ea4
parent8b035b80d321e1f743ec355d1f5dba78900d08aa (diff)
downloadserenity-f3768705a97ed07423024997fd5224712965acb1.zip
LibJS: Use consistent phrasing for string length
This is an editorial change in the ECMA-262 spec. See: https://github.com/tc39/ecma262/commit/33ea99e
-rw-r--r--Userland/Libraries/LibJS/Runtime/GlobalObject.cpp2
-rw-r--r--Userland/Libraries/LibJS/Runtime/RegExpPrototype.cpp6
2 files changed, 4 insertions, 4 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/GlobalObject.cpp b/Userland/Libraries/LibJS/Runtime/GlobalObject.cpp
index c15aaa35ed..43e1f4e15c 100644
--- a/Userland/Libraries/LibJS/Runtime/GlobalObject.cpp
+++ b/Userland/Libraries/LibJS/Runtime/GlobalObject.cpp
@@ -495,7 +495,7 @@ static ThrowCompletionOr<String> encode(GlobalObject& global_object, String cons
auto& vm = global_object.vm();
auto utf16_string = Utf16String(string);
- // 1. Let strLen be the number of code units in string.
+ // 1. Let strLen be the length of string.
auto string_length = utf16_string.length_in_code_units();
// 2. Let R be the empty String.
diff --git a/Userland/Libraries/LibJS/Runtime/RegExpPrototype.cpp b/Userland/Libraries/LibJS/Runtime/RegExpPrototype.cpp
index 00d80295ae..9b898ed46c 100644
--- a/Userland/Libraries/LibJS/Runtime/RegExpPrototype.cpp
+++ b/Userland/Libraries/LibJS/Runtime/RegExpPrototype.cpp
@@ -167,7 +167,7 @@ static ThrowCompletionOr<Value> regexp_builtin_exec(GlobalObject& global_object,
{
auto& vm = global_object.vm();
- // 1. Let length be the number of code units in S.
+ // 1. Let length be the length of S.
// 2. Let lastIndex be ℝ(? ToLength(? Get(R, "lastIndex"))).
auto last_index_value = TRY(regexp_object.get(vm.names.lastIndex));
auto last_index = TRY(last_index_value.to_length(global_object));
@@ -391,7 +391,7 @@ size_t advance_string_index(Utf16View const& string, size_t index, bool unicode)
if (!unicode)
return index + 1;
- // 3. Let length be the number of code units in S.
+ // 3. Let length be the length of S.
// 4. If index + 1 ≥ length, return index + 1.
if (index + 1 >= string.length_in_code_units())
return index + 1;
@@ -681,7 +681,7 @@ JS_DEFINE_NATIVE_FUNCTION(RegExpPrototype::symbol_replace)
auto matched_value = TRY(result.get(global_object, 0));
auto matched = TRY(matched_value.to_utf16_string(global_object));
- // d. Let matchLength be the number of code units in matched.
+ // d. Let matchLength be the length of matched.
auto matched_length = matched.length_in_code_units();
// e. Let position be ? ToIntegerOrInfinity(? Get(result, "index")).