Skip to content

Commit

Permalink
babel-parser(flow): Set this property to null for FunctionTypeAnn…
Browse files Browse the repository at this point in the history
…otation without parens (#12930)

* Add null property to FunctionTypeAnnotation without parens

* Update tests

* Update tests
  • Loading branch information
sosukesuzuki committed Mar 1, 2021
1 parent 265424d commit b62fc3d
Show file tree
Hide file tree
Showing 13 changed files with 348 additions and 334 deletions.
1 change: 1 addition & 0 deletions packages/babel-parser/src/plugins/flow/index.js
Expand Up @@ -1649,6 +1649,7 @@ export default (superClass: Class<Parser>): Class<Parser> =>
const node = this.startNodeAt(param.start, param.loc.start);
node.params = [this.reinterpretTypeAsFunctionTypeParam(param)];
node.rest = null;
node.this = null;
node.returnType = this.flowParseType();
node.typeParameters = null;
return this.finishNode(node, "FunctionTypeAnnotation");
Expand Down
Expand Up @@ -32,6 +32,7 @@
}
],
"rest": null,
"this": null,
"returnType": {
"type": "VoidTypeAnnotation",
"start":19,"end":23,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":23}}
Expand Down
Expand Up @@ -47,6 +47,7 @@
}
],
"rest": null,
"this": null,
"returnType": {
"type": "VoidTypeAnnotation",
"start":26,"end":30,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":30}}
Expand Down
Expand Up @@ -42,6 +42,7 @@
}
],
"rest": null,
"this": null,
"returnType": {
"type": "NumberLiteralTypeAnnotation",
"start":24,"end":27,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":27}},
Expand Down
Expand Up @@ -40,6 +40,7 @@
}
],
"rest": null,
"this": null,
"returnType": {
"type": "BooleanTypeAnnotation",
"start":28,"end":35,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":35}}
Expand Down
Expand Up @@ -40,6 +40,7 @@
}
],
"rest": null,
"this": null,
"returnType": {
"type": "BooleanTypeAnnotation",
"start":28,"end":35,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":35}}
Expand Down
Expand Up @@ -36,6 +36,7 @@
}
],
"rest": null,
"this": null,
"returnType": {
"type": "BooleanTypeAnnotation",
"start":20,"end":27,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":27}}
Expand Down
Expand Up @@ -36,6 +36,7 @@
}
],
"rest": null,
"this": null,
"returnType": {
"type": "BooleanTypeAnnotation",
"start":21,"end":28,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":28}}
Expand Down
Expand Up @@ -41,6 +41,7 @@
}
],
"rest": null,
"this": null,
"returnType": {
"type": "BooleanTypeAnnotation",
"start":20,"end":27,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":27}}
Expand Down
Expand Up @@ -32,6 +32,7 @@
}
],
"rest": null,
"this": null,
"returnType": {
"type": "UnionTypeAnnotation",
"start":19,"end":35,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":35}},
Expand Down
Expand Up @@ -32,6 +32,7 @@
}
],
"rest": null,
"this": null,
"returnType": {
"type": "FunctionTypeAnnotation",
"start":19,"end":36,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":36}},
Expand All @@ -48,6 +49,7 @@
}
],
"rest": null,
"this": null,
"returnType": {
"type": "NumberTypeAnnotation",
"start":30,"end":36,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":36}}
Expand Down

0 comments on commit b62fc3d

Please sign in to comment.