fix existential type param parsing
This commit is contained in:
parent
4ad8a1dc83
commit
0e76a5ace1
@ -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);
|
||||
}
|
||||
|
||||
@ -121,7 +121,7 @@
|
||||
},
|
||||
"params": [
|
||||
{
|
||||
"type": "Identifier",
|
||||
"type": "GenericTypeAnnotation",
|
||||
"start": 23,
|
||||
"end": 24,
|
||||
"loc": {
|
||||
@ -134,7 +134,23 @@
|
||||
"column": 24
|
||||
}
|
||||
},
|
||||
"name": "T"
|
||||
"typeParameters": null,
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 23,
|
||||
"end": 24,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 23
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 24
|
||||
}
|
||||
},
|
||||
"name": "T"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "ExistentialTypeParam",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user