Merge pull request #65 from danez/fix-syntax-error-pos
Fixes SyntaxError position with flow optional type
This commit is contained in:
@@ -558,7 +558,7 @@ pp.parseParenAndDistinguishExpression = function (startPos, startLoc, canBeArrow
|
||||
if (first) {
|
||||
first = false;
|
||||
} else {
|
||||
this.expect(tt.comma);
|
||||
this.expect(tt.comma, refNeedsArrowPos.start || null);
|
||||
if (this.match(tt.parenR) && this.hasPlugin("trailingFunctionCommas")) {
|
||||
optionalCommaStart = this.state.start;
|
||||
break;
|
||||
|
||||
@@ -71,10 +71,10 @@ pp.semicolon = function () {
|
||||
};
|
||||
|
||||
// Expect a token of a given type. If found, consume it, otherwise,
|
||||
// raise an unexpected token error.
|
||||
// raise an unexpected token error at given pos.
|
||||
|
||||
pp.expect = function (type) {
|
||||
return this.eat(type) || this.unexpected();
|
||||
pp.expect = function (type, pos) {
|
||||
return this.eat(type) || this.unexpected(pos);
|
||||
};
|
||||
|
||||
// Raise an unexpected token error.
|
||||
|
||||
Reference in New Issue
Block a user