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:
kisbg 2020-08-18 13:50:58 +02:00 committed by GitHub
parent 086d1cc127
commit d9cb2c60f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 10 deletions

View File

@ -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)))
{

View 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);