Improve line info construction (#4718)

- Simplify small encoding
- Better line info for some corner cases

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
Zoltan Herczeg
2021-07-16 16:08:38 +02:00
committed by GitHub
parent d5a7839632
commit 252d68936f
7 changed files with 61 additions and 64 deletions
+14
View File
@@ -3339,6 +3339,13 @@ 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)
{
parser_line_info_append (context_p, context_p->token.line, context_p->token.column);
}
#endif /* JERRY_LINE_INFO */
parser_stack_pop_uint8 (context_p);
context_p->last_statement.current_p = NULL;
/* There is no lexer_next_token here, since the
@@ -3501,6 +3508,13 @@ consume_last_statement:
{
parser_raise_error (context_p, PARSER_ERR_STATEMENT_EXPECTED);
}
#if JERRY_LINE_INFO
if (context_p->line_info.first_page_p == NULL)
{
parser_line_info_append (context_p, context_p->token.line, context_p->token.column);
}
#endif /* JERRY_LINE_INFO */
} /* parser_parse_statements */
/**