fix existential type param parsing

This commit is contained in:
Sebastian McKenzie
2015-11-03 20:04:55 +00:00
parent 4ad8a1dc83
commit 0e76a5ace1
2 changed files with 21 additions and 7 deletions

View File

@@ -164,7 +164,7 @@ pp.flowParseTypeParameterDeclaration = function () {
this.expectRelational("<");
while (!this.isRelational(">")) {
node.params.push(this.parseFlowTypeParam());
node.params.push(this.flowParseExistentialTypeParam() || this.flowParseTypeAnnotatableIdentifier());
if (!this.isRelational(">")) {
this.expect(tt.comma);
}
@@ -174,13 +174,11 @@ pp.flowParseTypeParameterDeclaration = function () {
return this.finishNode(node, "TypeParameterDeclaration");
};
pp.parseFlowTypeParam = function () {
pp.flowParseExistentialTypeParam = function () {
if (this.match(tt.star)) {
let node = this.startNode();
this.next();
return this.finishNode(node, "ExistentialTypeParam");
} else {
return this.flowParseTypeAnnotatableIdentifier();
}
};
@@ -192,7 +190,7 @@ pp.flowParseTypeParameterInstantiation = function () {
this.expectRelational("<");
while (!this.isRelational(">")) {
node.params.push(this.parseFlowTypeParam());
node.params.push(this.flowParseExistentialTypeParam() || this.flowParseType());
if (!this.isRelational(">")) {
this.expect(tt.comma);
}