1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-29 01:52:12 +00:00

LibJS: Update order of steps in CanonicalNumericIndexString

This is an editorial change in the ECMA-262 spec.

See: be5db32
This commit is contained in:
Linus Groh 2022-05-03 21:36:31 +02:00
parent 367e7b4fe5
commit 8b035b80d3

View file

@ -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);
// 4. Return n.
// 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 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