improve error marker placement (#1644)

For AST_UnaryPrefix, points to the operator rather than end of expression.
This commit is contained in:
Alex Lam S.L
2017-03-24 14:28:40 +08:00
committed by GitHub
parent 701035621d
commit 2e0dc97003
2 changed files with 3 additions and 3 deletions

View File

@@ -1457,7 +1457,7 @@ function parse($TEXT, options) {
function make_unary(ctor, op, expr) {
if ((op == "++" || op == "--") && !is_assignable(expr))
croak("Invalid use of " + op + " operator");
croak("Invalid use of " + op + " operator", null, ctor === AST_UnaryPrefix ? expr.start.col - 1 : null);
return new ctor({ operator: op, expression: expr });
};