Improve storing the line info data during parsing (#4735)

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
Zoltan Herczeg
2021-08-17 08:29:30 +02:00
committed by GitHub
parent fc29019165
commit 74e5ccd434
4 changed files with 87 additions and 71 deletions
+2 -14
View File
@@ -1830,10 +1830,6 @@ parser_parse_switch_statement_start (parser_context_t *context_p) /**< context *
switch_case_was_found = false;
default_case_was_found = false;
#if JERRY_LINE_INFO
uint32_t last_line_info_line = context_p->last_line_info_line;
#endif /* JERRY_LINE_INFO */
do
{
scanner_set_location (context_p, &case_info_p->location);
@@ -1904,10 +1900,6 @@ parser_parse_switch_statement_start (parser_context_t *context_p) /**< context *
JERRY_ASSERT (switch_case_was_found || default_case_was_found);
#if JERRY_LINE_INFO
context_p->last_line_info_line = last_line_info_line;
#endif /* JERRY_LINE_INFO */
if (!switch_case_was_found)
{
/* There was no case statement, so the expression result
@@ -2791,10 +2783,6 @@ parser_parse_statements (parser_context_t *context_p) /**< context */
}
#endif /* JERRY_DEBUGGER */
#if JERRY_LINE_INFO
context_p->last_line_info_line = 0;
#endif /* JERRY_LINE_INFO */
while (context_p->token.type == LEXER_LITERAL
&& context_p->token.lit_location.type == LEXER_STRING_LITERAL)
{
@@ -3352,7 +3340,7 @@ parser_parse_statements (parser_context_t *context_p) /**< context */
if (context_p->status_flags & PARSER_IS_CLOSURE)
{
#if JERRY_LINE_INFO
if (context_p->line_info.first_page_p == NULL)
if (context_p->line_info_p == NULL)
{
parser_line_info_append (context_p, context_p->token.line, context_p->token.column);
}
@@ -3522,7 +3510,7 @@ consume_last_statement:
}
#if JERRY_LINE_INFO
if (context_p->line_info.first_page_p == NULL)
if (context_p->line_info_p == NULL)
{
parser_line_info_append (context_p, context_p->token.line, context_p->token.column);
}