From 8b035b80d321e1f743ec355d1f5dba78900d08aa Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Tue, 3 May 2022 21:36:31 +0200 Subject: [PATCH] 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 --- .../Libraries/LibJS/Runtime/AbstractOperations.cpp | 10 +++++----- 1 file 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