Replace vera++ with clang-format (#4518)

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik robert.fancsik@h-lab.eu
This commit is contained in:
Robert Fancsik
2021-11-05 14:15:47 +01:00
committed by GitHub
parent bc091e1742
commit badfdf4dba
564 changed files with 10195 additions and 15090 deletions
+20 -32
View File
@@ -13,9 +13,10 @@
* limitations under the License.
*/
#include "js-parser-internal.h"
#include "ecma-helpers.h"
#include "js-parser-internal.h"
#if JERRY_PARSER
#if JERRY_LINE_INFO
@@ -79,11 +80,11 @@ parser_emit_two_bytes (parser_context_t *context_p, /**< context */
* @param context_p parser context
* @param byte byte
*/
#define PARSER_APPEND_TO_BYTE_CODE(context_p, byte) \
#define PARSER_APPEND_TO_BYTE_CODE(context_p, byte) \
if ((context_p)->byte_code.last_position >= PARSER_CBC_STREAM_PAGE_SIZE) \
{ \
parser_cbc_stream_alloc_page ((context_p), &(context_p)->byte_code); \
} \
{ \
parser_cbc_stream_alloc_page ((context_p), &(context_p)->byte_code); \
} \
(context_p)->byte_code.last_p->bytes[(context_p)->byte_code.last_position++] = (uint8_t) (byte)
#if JERRY_PARSER_DUMP_BYTE_CODE
@@ -177,16 +178,14 @@ parser_flush_cbc (parser_context_t *context_p) /**< context */
}
JERRY_ASSERT ((flags >> CBC_STACK_ADJUST_SHIFT) >= CBC_STACK_ADJUST_BASE
|| (CBC_STACK_ADJUST_BASE - (flags >> CBC_STACK_ADJUST_SHIFT)) <= context_p->stack_depth);
|| (CBC_STACK_ADJUST_BASE - (flags >> CBC_STACK_ADJUST_SHIFT)) <= context_p->stack_depth);
PARSER_PLUS_EQUAL_U16 (context_p->stack_depth, CBC_STACK_ADJUST_VALUE (flags));
if (flags & (CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2))
{
uint16_t literal_index = context_p->last_cbc.literal_index;
parser_emit_two_bytes (context_p,
(uint8_t) (literal_index & 0xff),
(uint8_t) (literal_index >> 8));
parser_emit_two_bytes (context_p, (uint8_t) (literal_index & 0xff), (uint8_t) (literal_index >> 8));
context_p->byte_code_size += 2;
}
@@ -194,18 +193,14 @@ parser_flush_cbc (parser_context_t *context_p) /**< context */
{
uint16_t literal_index = context_p->last_cbc.value;
parser_emit_two_bytes (context_p,
(uint8_t) (literal_index & 0xff),
(uint8_t) (literal_index >> 8));
parser_emit_two_bytes (context_p, (uint8_t) (literal_index & 0xff), (uint8_t) (literal_index >> 8));
context_p->byte_code_size += 2;
if (!(flags & CBC_HAS_LITERAL_ARG))
{
literal_index = context_p->last_cbc.third_literal_index;
parser_emit_two_bytes (context_p,
(uint8_t) (literal_index & 0xff),
(uint8_t) (literal_index >> 8));
parser_emit_two_bytes (context_p, (uint8_t) (literal_index & 0xff), (uint8_t) (literal_index >> 8));
context_p->byte_code_size += 2;
}
}
@@ -251,13 +246,11 @@ parser_flush_cbc (parser_context_t *context_p) /**< context */
if (flags & CBC_HAS_BYTE_ARG)
{
if (last_opcode == CBC_PUSH_NUMBER_POS_BYTE
|| last_opcode == CBC_PUSH_LITERAL_PUSH_NUMBER_POS_BYTE)
if (last_opcode == CBC_PUSH_NUMBER_POS_BYTE || last_opcode == CBC_PUSH_LITERAL_PUSH_NUMBER_POS_BYTE)
{
JERRY_DEBUG_MSG (" number:%d", (int) context_p->last_cbc.value + 1);
}
else if (last_opcode == CBC_PUSH_NUMBER_NEG_BYTE
|| last_opcode == CBC_PUSH_LITERAL_PUSH_NUMBER_NEG_BYTE)
else if (last_opcode == CBC_PUSH_NUMBER_NEG_BYTE || last_opcode == CBC_PUSH_LITERAL_PUSH_NUMBER_NEG_BYTE)
{
JERRY_DEBUG_MSG (" number:%d", -((int) context_p->last_cbc.value + 1));
}
@@ -434,15 +427,13 @@ parser_emit_cbc_push_number (parser_context_t *context_p, /**< context */
if (lit_value == PARSER_INVALID_LITERAL_INDEX)
{
opcode = (is_negative_number ? CBC_PUSH_NUMBER_NEG_BYTE
: CBC_PUSH_NUMBER_POS_BYTE);
opcode = (is_negative_number ? CBC_PUSH_NUMBER_NEG_BYTE : CBC_PUSH_NUMBER_POS_BYTE);
JERRY_ASSERT (CBC_STACK_ADJUST_VALUE (PARSER_GET_FLAGS (opcode)) == 1);
}
else
{
opcode = (is_negative_number ? CBC_PUSH_LITERAL_PUSH_NUMBER_NEG_BYTE
: CBC_PUSH_LITERAL_PUSH_NUMBER_POS_BYTE);
opcode = (is_negative_number ? CBC_PUSH_LITERAL_PUSH_NUMBER_NEG_BYTE : CBC_PUSH_LITERAL_PUSH_NUMBER_POS_BYTE);
JERRY_ASSERT (CBC_STACK_ADJUST_VALUE (PARSER_GET_FLAGS (opcode)) == 2);
context_p->last_cbc.literal_index = lit_value;
@@ -494,7 +485,7 @@ parser_emit_cbc_forward_branch (parser_context_t *context_p, /**< context */
/* Branch opcodes never push anything onto the stack. */
JERRY_ASSERT ((flags >> CBC_STACK_ADJUST_SHIFT) >= CBC_STACK_ADJUST_BASE
|| (CBC_STACK_ADJUST_BASE - (flags >> CBC_STACK_ADJUST_SHIFT)) <= context_p->stack_depth);
|| (CBC_STACK_ADJUST_BASE - (flags >> CBC_STACK_ADJUST_SHIFT)) <= context_p->stack_depth);
PARSER_PLUS_EQUAL_U16 (context_p->stack_depth, CBC_STACK_ADJUST_VALUE (flags));
#if JERRY_PARSER_DUMP_BYTE_CODE
@@ -606,7 +597,7 @@ parser_emit_cbc_backward_branch (parser_context_t *context_p, /**< context */
/* Branch opcodes never push anything onto the stack. */
JERRY_ASSERT ((flags >> CBC_STACK_ADJUST_SHIFT) >= CBC_STACK_ADJUST_BASE
|| (CBC_STACK_ADJUST_BASE - (flags >> CBC_STACK_ADJUST_SHIFT)) <= context_p->stack_depth);
|| (CBC_STACK_ADJUST_BASE - (flags >> CBC_STACK_ADJUST_SHIFT)) <= context_p->stack_depth);
PARSER_PLUS_EQUAL_U16 (context_p->stack_depth, CBC_STACK_ADJUST_VALUE (flags));
#if JERRY_PARSER_DUMP_BYTE_CODE
@@ -673,7 +664,7 @@ parser_new_ecma_string_from_literal (lexer_literal_t *literal_p) /**< literal */
}
return new_string;
} /* parser_new_ecma_string_from_literal */
} /* parser_new_ecma_string_from_literal */
/**
* Set a branch to the current byte code position
@@ -815,8 +806,7 @@ parser_reverse_class_fields (parser_context_t *context_p, /**< context */
has_fields = true;
context_p->stack_top_uint8 = class_field_type;
}
}
while (current_p < data_end_p);
} while (current_p < data_end_p);
parser_stack_iterator_init (context_p, &iterator);
current_p = data_end_p;
@@ -845,8 +835,7 @@ parser_reverse_class_fields (parser_context_t *context_p, /**< context */
current_p[-1] |= PARSER_CLASS_FIELD_END;
}
current_p -= info_size;
}
while (current_p > data_p);
} while (current_p > data_p);
}
else
{
@@ -872,8 +861,7 @@ parser_reverse_class_fields (parser_context_t *context_p, /**< context */
parser_stack_iterator_write (&iterator, current_p, info_size);
parser_stack_iterator_skip (&iterator, info_size);
}
}
while (current_p > data_p);
} while (current_p > data_p);
}
parser_free (data_p, fields_size);