Skip to content

Commit aeddb1c

Browse files
authored
Get rid of ? true : false (#2575)
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
1 parent 34c5e22 commit aeddb1c

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

jerry-core/ecma/builtin-objects/ecma-builtin-number-prototype.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,7 @@ ecma_builtin_number_prototype_object_to_fixed (ecma_value_t this_arg, /**< this
650650
num_digits + 1,
651651
exponent + frac_digits,
652652
&exponent,
653-
ecma_number_is_zero (this_num) ? true : false);
653+
ecma_number_is_zero (this_num));
654654

655655
/* Buffer that is used to construct the string. */
656656
int buffer_size = (exponent > 0) ? exponent + frac_digits + 2 : frac_digits + 3;

jerry-core/ecma/operations/ecma-function-object.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -666,16 +666,16 @@ ecma_op_function_call (ecma_object_t *func_obj_p, /**< Function object */
666666
const ecma_compiled_code_t *bytecode_data_p = ecma_op_function_get_compiled_code (ext_func_p);
667667

668668
#ifndef CONFIG_DISABLE_ES2015_CLASS
669-
bool is_class_constructor = (bytecode_data_p->status_flags & CBC_CODE_FLAGS_CONSTRUCTOR) ? true : false;
669+
bool is_class_constructor = (bool) (bytecode_data_p->status_flags & CBC_CODE_FLAGS_CONSTRUCTOR);
670670

671671
if (is_class_constructor && !ecma_op_function_has_construct_flag (arguments_list_p))
672672
{
673673
return ecma_raise_type_error (ECMA_ERR_MSG ("Class constructor cannot be invoked without 'new'."));
674674
}
675675
#endif /* !CONFIG_DISABLE_ES2015_CLASS */
676676

677-
bool is_strict = (bytecode_data_p->status_flags & CBC_CODE_FLAGS_STRICT_MODE) ? true : false;
678-
bool is_no_lex_env = (bytecode_data_p->status_flags & CBC_CODE_FLAGS_LEXICAL_ENV_NOT_NEEDED) ? true : false;
677+
bool is_strict = (bool) (bytecode_data_p->status_flags & CBC_CODE_FLAGS_STRICT_MODE);
678+
bool is_no_lex_env = (bool) (bytecode_data_p->status_flags & CBC_CODE_FLAGS_LEXICAL_ENV_NOT_NEEDED);
679679

680680
/* 1. */
681681
if (!is_strict)
@@ -775,7 +775,7 @@ ecma_op_function_call (ecma_object_t *func_obj_p, /**< Function object */
775775

776776
const ecma_compiled_code_t *bytecode_data_p = ecma_op_arrow_function_get_compiled_code (arrow_func_p);
777777

778-
is_no_lex_env = (bytecode_data_p->status_flags & CBC_CODE_FLAGS_LEXICAL_ENV_NOT_NEEDED) ? true : false;
778+
is_no_lex_env = (bool) (bytecode_data_p->status_flags & CBC_CODE_FLAGS_LEXICAL_ENV_NOT_NEEDED);
779779

780780
ecma_object_t *local_env_p = scope_p;
781781

jerry-core/parser/js/js-lexer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2175,7 +2175,7 @@ lexer_construct_regexp_object (parser_context_t *context_p, /**< context */
21752175
current_flags);
21762176
ecma_deref_ecma_string (pattern_str_p);
21772177

2178-
bool is_throw = ECMA_IS_VALUE_ERROR (completion_value) ? true : false;
2178+
bool is_throw = (bool) ECMA_IS_VALUE_ERROR (completion_value);
21792179

21802180
ecma_free_value (completion_value);
21812181

jerry-core/parser/js/js-parser-expr.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ parser_parse_class_literal (parser_context_t *context_p) /**< context */
418418
JERRY_ASSERT (context_p->last_cbc_opcode == CBC_PUSH_LITERAL);
419419

420420
cbc_ext_opcode_t opcode;
421-
bool is_static = (status_flags & PARSER_CLASS_STATIC_FUNCTION) ? true : false;
421+
bool is_static = (bool) (status_flags & PARSER_CLASS_STATIC_FUNCTION);
422422

423423
if (is_computed)
424424
{
@@ -1334,7 +1334,7 @@ parser_parse_unary_expression (parser_context_t *context_p, /**< context */
13341334
break;
13351335
}
13361336

1337-
bool is_static = (context_p->status_flags & PARSER_CLASS_STATIC_FUNCTION) ? true : false;
1337+
bool is_static = (bool) (context_p->status_flags & PARSER_CLASS_STATIC_FUNCTION);
13381338
parser_emit_cbc_ext (context_p, is_static ? CBC_EXT_PUSH_STATIC_SUPER : CBC_EXT_PUSH_SUPER);
13391339
break;
13401340
}

0 commit comments

Comments
 (0)