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:
parent
265424d43f
commit
b62fc3d44f
@ -1649,6 +1649,7 @@ export default (superClass: Class<Parser>): Class<Parser> =>
|
|||||||
const node = this.startNodeAt(param.start, param.loc.start);
|
const node = this.startNodeAt(param.start, param.loc.start);
|
||||||
node.params = [this.reinterpretTypeAsFunctionTypeParam(param)];
|
node.params = [this.reinterpretTypeAsFunctionTypeParam(param)];
|
||||||
node.rest = null;
|
node.rest = null;
|
||||||
|
node.this = null;
|
||||||
node.returnType = this.flowParseType();
|
node.returnType = this.flowParseType();
|
||||||
node.typeParameters = null;
|
node.typeParameters = null;
|
||||||
return this.finishNode(node, "FunctionTypeAnnotation");
|
return this.finishNode(node, "FunctionTypeAnnotation");
|
||||||
|
|||||||
@ -32,6 +32,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"rest": null,
|
"rest": null,
|
||||||
|
"this": null,
|
||||||
"returnType": {
|
"returnType": {
|
||||||
"type": "VoidTypeAnnotation",
|
"type": "VoidTypeAnnotation",
|
||||||
"start":19,"end":23,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":23}}
|
"start":19,"end":23,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":23}}
|
||||||
|
|||||||
@ -47,6 +47,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"rest": null,
|
"rest": null,
|
||||||
|
"this": null,
|
||||||
"returnType": {
|
"returnType": {
|
||||||
"type": "VoidTypeAnnotation",
|
"type": "VoidTypeAnnotation",
|
||||||
"start":26,"end":30,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":30}}
|
"start":26,"end":30,"loc":{"start":{"line":1,"column":26},"end":{"line":1,"column":30}}
|
||||||
|
|||||||
@ -42,6 +42,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"rest": null,
|
"rest": null,
|
||||||
|
"this": null,
|
||||||
"returnType": {
|
"returnType": {
|
||||||
"type": "NumberLiteralTypeAnnotation",
|
"type": "NumberLiteralTypeAnnotation",
|
||||||
"start":24,"end":27,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":27}},
|
"start":24,"end":27,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":27}},
|
||||||
|
|||||||
@ -40,6 +40,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"rest": null,
|
"rest": null,
|
||||||
|
"this": null,
|
||||||
"returnType": {
|
"returnType": {
|
||||||
"type": "BooleanTypeAnnotation",
|
"type": "BooleanTypeAnnotation",
|
||||||
"start":28,"end":35,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":35}}
|
"start":28,"end":35,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":35}}
|
||||||
|
|||||||
@ -40,6 +40,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"rest": null,
|
"rest": null,
|
||||||
|
"this": null,
|
||||||
"returnType": {
|
"returnType": {
|
||||||
"type": "BooleanTypeAnnotation",
|
"type": "BooleanTypeAnnotation",
|
||||||
"start":28,"end":35,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":35}}
|
"start":28,"end":35,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":35}}
|
||||||
|
|||||||
@ -36,6 +36,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"rest": null,
|
"rest": null,
|
||||||
|
"this": null,
|
||||||
"returnType": {
|
"returnType": {
|
||||||
"type": "BooleanTypeAnnotation",
|
"type": "BooleanTypeAnnotation",
|
||||||
"start":20,"end":27,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":27}}
|
"start":20,"end":27,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":27}}
|
||||||
|
|||||||
@ -36,6 +36,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"rest": null,
|
"rest": null,
|
||||||
|
"this": null,
|
||||||
"returnType": {
|
"returnType": {
|
||||||
"type": "BooleanTypeAnnotation",
|
"type": "BooleanTypeAnnotation",
|
||||||
"start":21,"end":28,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":28}}
|
"start":21,"end":28,"loc":{"start":{"line":1,"column":21},"end":{"line":1,"column":28}}
|
||||||
|
|||||||
@ -41,6 +41,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"rest": null,
|
"rest": null,
|
||||||
|
"this": null,
|
||||||
"returnType": {
|
"returnType": {
|
||||||
"type": "BooleanTypeAnnotation",
|
"type": "BooleanTypeAnnotation",
|
||||||
"start":20,"end":27,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":27}}
|
"start":20,"end":27,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":27}}
|
||||||
|
|||||||
@ -32,6 +32,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"rest": null,
|
"rest": null,
|
||||||
|
"this": null,
|
||||||
"returnType": {
|
"returnType": {
|
||||||
"type": "UnionTypeAnnotation",
|
"type": "UnionTypeAnnotation",
|
||||||
"start":19,"end":35,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":35}},
|
"start":19,"end":35,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":35}},
|
||||||
|
|||||||
@ -32,6 +32,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"rest": null,
|
"rest": null,
|
||||||
|
"this": null,
|
||||||
"returnType": {
|
"returnType": {
|
||||||
"type": "FunctionTypeAnnotation",
|
"type": "FunctionTypeAnnotation",
|
||||||
"start":19,"end":36,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":36}},
|
"start":19,"end":36,"loc":{"start":{"line":1,"column":19},"end":{"line":1,"column":36}},
|
||||||
@ -48,6 +49,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"rest": null,
|
"rest": null,
|
||||||
|
"this": null,
|
||||||
"returnType": {
|
"returnType": {
|
||||||
"type": "NumberTypeAnnotation",
|
"type": "NumberTypeAnnotation",
|
||||||
"start":30,"end":36,"loc":{"start":{"line":1,"column":30},"end":{"line":1,"column":36}}
|
"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
@ -182,6 +182,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"rest": null,
|
"rest": null,
|
||||||
|
"this": null,
|
||||||
"returnType": {
|
"returnType": {
|
||||||
"type": "GenericTypeAnnotation",
|
"type": "GenericTypeAnnotation",
|
||||||
"start":163,"end":165,"loc":{"start":{"line":5,"column":28},"end":{"line":5,"column":30}},
|
"start":163,"end":165,"loc":{"start":{"line":5,"column":28},"end":{"line":5,"column":30}},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user