summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2022-05-03 21:36:31 +0200
committerLinus Groh <mail@linusgroh.de>2022-05-03 22:49:31 +0200
commit8b035b80d321e1f743ec355d1f5dba78900d08aa (patch)
treea5a126a16756f308c637a4a4981336e0a3756df6 /Userland
parent367e7b4fe5abbda4e4b3dec80a7b3fea12e064a7 (diff)
downloadserenity-8b035b80d321e1f743ec355d1f5dba78900d08aa.zip
LibJS: Update order of steps in CanonicalNumericIndexString
This is an editorial change in the ECMA-262 spec. See: https://github.com/tc39/ecma262/commit/be5db32
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp b/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp
index fdc034aca0..55d28a4500 100644
--- a/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp
+++ b/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp
@@ -1178,12 +1178,12 @@ CanonicalIndex canonical_numeric_index_string(PropertyKey const& property_key, C
if (endptr != argument.characters() + argument.length())
return CanonicalIndex(CanonicalIndex::Type::Undefined, 0);
- // 3. If SameValue(! ToString(n), argument) is false, return undefined.
- if (n.to_string_without_side_effects() != argument)
- return CanonicalIndex(CanonicalIndex::Type::Undefined, 0);
+ // 3. If SameValue(! ToString(n), argument) is true, return n.
+ if (n.to_string_without_side_effects() == argument)
+ return CanonicalIndex(CanonicalIndex::Type::Numeric, 0);
- // 4. Return n.
- return CanonicalIndex(CanonicalIndex::Type::Numeric, 0);
+ // 4. Return undefined.
+ return CanonicalIndex(CanonicalIndex::Type::Undefined, 0);
}
// 22.1.3.17.1 GetSubstitution ( matched, str, position, captures, namedCaptures, replacement ), https://tc39.es/ecma262/#sec-getsubstitution