diff --git a/jerry-core/ecma/operations/ecma-comparison.c b/jerry-core/ecma/operations/ecma-comparison.c index fe097c82b..3699fe252 100644 --- a/jerry-core/ecma/operations/ecma-comparison.c +++ b/jerry-core/ecma/operations/ecma-comparison.c @@ -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))) { diff --git a/tests/jerry/es.next/regression-test-issue-4139.js b/tests/jerry/es.next/regression-test-issue-4139.js new file mode 100644 index 000000000..6f176f495 --- /dev/null +++ b/tests/jerry/es.next/regression-test-issue-4139.js @@ -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);