mirror of
https://github.com/jerryscript-project/jerryscript.git
synced 2025-12-15 16:29:21 +00:00
fix check order in ecma_op_abstract_equality_compare (#4141)
Fixes #4139 JerryScript-DCO-1.0-Signed-off-by: bence gabor kis kisbg@inf.u-szeged.hu
This commit is contained in:
parent
086d1cc127
commit
d9cb2c60f2
@ -151,16 +151,6 @@ ecma_op_abstract_equality_compare (ecma_value_t x, /**< first operand */
|
||||
return ecma_op_abstract_equality_compare (ecma_make_integer_value (ecma_is_value_true (x) ? 1 : 0), y);
|
||||
}
|
||||
|
||||
if (ecma_is_value_undefined (x)
|
||||
|| ecma_is_value_null (x))
|
||||
{
|
||||
/* 1. a., b. */
|
||||
/* 2., 3. */
|
||||
bool is_equal = ecma_is_value_undefined (y) || ecma_is_value_null (y);
|
||||
|
||||
return ecma_make_boolean_value (is_equal);
|
||||
}
|
||||
|
||||
#if ENABLED (JERRY_BUILTIN_BIGINT)
|
||||
if (JERRY_UNLIKELY (ecma_is_value_bigint (x)))
|
||||
{
|
||||
@ -199,6 +189,16 @@ ecma_op_abstract_equality_compare (ecma_value_t x, /**< first operand */
|
||||
}
|
||||
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
|
||||
|
||||
if (ecma_is_value_undefined (x)
|
||||
|| ecma_is_value_null (x))
|
||||
{
|
||||
/* 1. a., b. */
|
||||
/* 2., 3. */
|
||||
bool is_equal = ecma_is_value_undefined (y) || ecma_is_value_null (y);
|
||||
|
||||
return ecma_make_boolean_value (is_equal);
|
||||
}
|
||||
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
if (JERRY_UNLIKELY (ecma_is_value_symbol (x)))
|
||||
{
|
||||
|
||||
16
tests/jerry/es.next/regression-test-issue-4139.js
Normal file
16
tests/jerry/es.next/regression-test-issue-4139.js
Normal file
@ -0,0 +1,16 @@
|
||||
// Copyright JS Foundation and other contributors, http://js.foundation
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
var b;
|
||||
assert(0n !== b);
|
||||
Loading…
x
Reference in New Issue
Block a user