fix(compiler): make unary plus operator consistent to JavaScript (#22154)

fixes #22089

PR Close #22154
This commit is contained in:
Trotyl
2018-02-12 00:02:24 +08:00
committed by Miško Hevery
parent 20a900b648
commit 72f8abd7b3
2 changed files with 6 additions and 2 deletions

View File

@ -477,7 +477,9 @@ export class _ParseAST {
switch (operator) {
case '+':
this.advance();
return this.parsePrefix();
result = this.parsePrefix();
return new Binary(
this.span(start), '-', result, new LiteralPrimitive(new ParseSpan(start, start), 0));
case '-':
this.advance();
result = this.parsePrefix();