Skip to content

Commit 635433f

Browse files
authored
Merge pull request bellard#7 from openwebf/feat/column
fix: some column number cases passed
2 parents e295f77 + 0712b59 commit 635433f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/core/parser.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,11 @@ int __attribute__((format(printf, 2, 3))) js_parse_error(JSParseState *s, const
141141
backtrace_flags = 0;
142142
if (s->cur_func && s->cur_func->backtrace_barrier)
143143
backtrace_flags = JS_BACKTRACE_FLAG_SINGLE_LEVEL;
144+
145+
int column_num = s->column_last_ptr - s->column_ptr;
144146
build_backtrace(ctx, ctx->rt->current_exception,
145147
s->filename, s->line_num,
146-
s->column_last_ptr - s->column_ptr,
148+
column_num < 0 ? -1 : column_num,
147149
backtrace_flags);
148150
return -1;
149151
}
@@ -4719,10 +4721,7 @@ static __exception int js_parse_postfix_expr(JSParseState *s, int parse_flags)
47194721
return -1;
47204722
}
47214723

4722-
/** new expr should location at 'new' keywords */
4723-
if (call_type == FUNC_CALL_NEW) {
4724-
emit_column(s, column_num);
4725-
}
4724+
emit_column(s, column_num);
47264725

47274726
if (s->token.val == TOK_ELLIPSIS) {
47284727
emit_op(s, OP_array_from);
@@ -4869,7 +4868,8 @@ static __exception int js_parse_postfix_expr(JSParseState *s, int parse_flags)
48694868
if (next_token(s))
48704869
return -1;
48714870

4872-
emit_column(s, s->token.column_num);
4871+
column_num = s->token.column_num;
4872+
emit_column(s, column_num);
48734873
parse_property:
48744874
if (s->token.val == TOK_PRIVATE_NAME) {
48754875
/* private class field */

0 commit comments

Comments
 (0)