Skip to content

Commit 71a898c

Browse files
committed
optimize code-style and update tests
1 parent 2f0a104 commit 71a898c

File tree

3 files changed

+34
-34
lines changed

3 files changed

+34
-34
lines changed

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,9 +300,8 @@ parser_emit_unary_lvalue_opcode (parser_context_t *context_p, /**< context */
300300
}
301301
else if (opcode == CBC_DELETE_PUSH_RESULT)
302302
{
303+
Invalid_LeftHandSide:
303304
/* Invalid LeftHandSide expression. */
304-
Invalid_LeftHandSide:
305-
306305
if (context_p->last_cbc_opcode == PARSER_TO_EXT_OPCODE (CBC_EXT_PUSH_SUPER_PROP_LITERAL)
307306
|| context_p->last_cbc_opcode == PARSER_TO_EXT_OPCODE (CBC_EXT_PUSH_SUPER_PROP))
308307
{

jerry-core/vm/vm.c

Lines changed: 33 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2955,43 +2955,45 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
29552955
case VM_OC_PROP_PRE_DECR:
29562956
case VM_OC_PROP_POST_INCR:
29572957
case VM_OC_PROP_POST_DECR:
2958-
if (JERRY_UNLIKELY (byte_code_start_p - 3 >= frame_ctx_p->byte_code_p
2959-
&& byte_code_start_p[-3] == CBC_EXT_OPCODE
2960-
&& byte_code_start_p[-2] == CBC_EXT_PUSH_PRIVATE_PROP_LITERAL_REFERENCE))
29612958
{
2962-
if (opcode < CBC_PRE_INCR)
2959+
if (JERRY_UNLIKELY (byte_code_start_p - 3 >= frame_ctx_p->byte_code_p
2960+
&& byte_code_start_p[-3] == CBC_EXT_OPCODE
2961+
&& byte_code_start_p[-2] == CBC_EXT_PUSH_PRIVATE_PROP_LITERAL_REFERENCE))
29632962
{
2964-
break;
2963+
if (opcode < CBC_PRE_INCR)
2964+
{
2965+
break;
2966+
}
2967+
result = right_value;
2968+
stack_top_p += 1;
2969+
left_value = right_value;
2970+
/* Use right_value as the marker for private field */
2971+
right_value = ECMA_VALUE_EMPTY;
29652972
}
2966-
result = right_value;
2967-
stack_top_p += 1;
2968-
left_value = right_value;
2969-
/* Use right_value as the marker for private field */
2970-
right_value = ECMA_VALUE_EMPTY;
2971-
}
2972-
else
2973-
{
2974-
result = vm_op_get_value (left_value, right_value);
2975-
2976-
if (opcode < CBC_PRE_INCR)
2973+
else
29772974
{
2978-
left_value = ECMA_VALUE_UNDEFINED;
2979-
right_value = ECMA_VALUE_UNDEFINED;
2980-
}
2975+
result = vm_op_get_value (left_value, right_value);
29812976

2982-
if (ECMA_IS_VALUE_ERROR (result))
2983-
{
2984-
goto error;
2985-
}
2977+
if (opcode < CBC_PRE_INCR)
2978+
{
2979+
left_value = ECMA_VALUE_UNDEFINED;
2980+
right_value = ECMA_VALUE_UNDEFINED;
2981+
}
29862982

2987-
if (opcode < CBC_PRE_INCR)
2988-
{
2989-
break;
2990-
}
2983+
if (ECMA_IS_VALUE_ERROR (result))
2984+
{
2985+
goto error;
2986+
}
29912987

2992-
stack_top_p += 2;
2993-
left_value = result;
2994-
right_value = ECMA_VALUE_UNDEFINED;
2988+
if (opcode < CBC_PRE_INCR)
2989+
{
2990+
break;
2991+
}
2992+
2993+
stack_top_p += 2;
2994+
left_value = result;
2995+
right_value = ECMA_VALUE_UNDEFINED;
2996+
}
29952997
/* FALLTHRU */
29962998
}
29972999
case VM_OC_PRE_INCR:
@@ -3115,7 +3117,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
31153117
{
31163118
result = ecma_update_float_number (result, result_number + increase);
31173119
}
3118-
unary_arithmetic_operation_break:
3120+
unary_arithmetic_operation_break:
31193121
if (JERRY_UNLIKELY (right_value == ECMA_VALUE_EMPTY))
31203122
{
31213123
right_value = ECMA_VALUE_UNDEFINED;

tests/jerry/private_fields.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ check_syntax_error("class A { static *#bar(x) { } #bar }");
5353
check_syntax_error("class A { async *#bar(x) { } #bar }");
5454
check_syntax_error("class A { async #bar(x) { } #bar }");
5555
check_syntax_error("class A { *#bar(x) { } #bar }");
56-
check_syntax_error("class A { #a; foo(){ ++this.#a; --this.#a; this.#a++; this.#a--; }}");
5756

5857

5958
class A {

0 commit comments

Comments
 (0)