Skip to content

Commit d9cb2c6

Browse files
author
kisbg
authored
fix check order in ecma_op_abstract_equality_compare (#4141)
Fixes #4139 JerryScript-DCO-1.0-Signed-off-by: bence gabor kis [email protected]
1 parent 086d1cc commit d9cb2c6

File tree

2 files changed

+26
-10
lines changed

2 files changed

+26
-10
lines changed

jerry-core/ecma/operations/ecma-comparison.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -151,16 +151,6 @@ ecma_op_abstract_equality_compare (ecma_value_t x, /**< first operand */
151151
return ecma_op_abstract_equality_compare (ecma_make_integer_value (ecma_is_value_true (x) ? 1 : 0), y);
152152
}
153153

154-
if (ecma_is_value_undefined (x)
155-
|| ecma_is_value_null (x))
156-
{
157-
/* 1. a., b. */
158-
/* 2., 3. */
159-
bool is_equal = ecma_is_value_undefined (y) || ecma_is_value_null (y);
160-
161-
return ecma_make_boolean_value (is_equal);
162-
}
163-
164154
#if ENABLED (JERRY_BUILTIN_BIGINT)
165155
if (JERRY_UNLIKELY (ecma_is_value_bigint (x)))
166156
{
@@ -199,6 +189,16 @@ ecma_op_abstract_equality_compare (ecma_value_t x, /**< first operand */
199189
}
200190
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
201191

192+
if (ecma_is_value_undefined (x)
193+
|| ecma_is_value_null (x))
194+
{
195+
/* 1. a., b. */
196+
/* 2., 3. */
197+
bool is_equal = ecma_is_value_undefined (y) || ecma_is_value_null (y);
198+
199+
return ecma_make_boolean_value (is_equal);
200+
}
201+
202202
#if ENABLED (JERRY_ESNEXT)
203203
if (JERRY_UNLIKELY (ecma_is_value_symbol (x)))
204204
{
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright JS Foundation and other contributors, http://js.foundation
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
var b;
16+
assert(0n !== b);

0 commit comments

Comments
 (0)