babel-parser(flow): Set this property to null for FunctionTypeAnnotation without parens (#12930)

* Add null property to FunctionTypeAnnotation without parens

* Update tests

* Update tests
This commit is contained in:
Sosuke Suzuki 2021-03-01 23:15:43 +09:00 committed by GitHub
parent 265424d43f
commit b62fc3d44f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 388 additions and 374 deletions

View File

@ -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");

View File

@ -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}}

View File

@ -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}}

View File

@ -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}},

View File

@ -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}}

View File

@ -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}}

View File

@ -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}}

View File

@ -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}}

View File

@ -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}}

View File

@ -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}},

View File

@ -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}},
@ -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}}

File diff suppressed because it is too large Load Diff

View File

@ -182,6 +182,7 @@
}
],
"rest": null,
"this": null,
"returnType": {
"type": "GenericTypeAnnotation",
"start":163,"end":165,"loc":{"start":{"line":5,"column":28},"end":{"line":5,"column":30}},