Fix location info on FunctionTypeParam nodes (#565)

This commit is contained in:
Michal Srb
2017-06-05 17:41:46 +01:00
committed by Henry Zhu
parent e579109f0b
commit bbc3cd45cf
18 changed files with 64 additions and 256 deletions

View File

@@ -708,7 +708,7 @@ export default (superClass: Class<Parser>): Class<Parser> => class extends super
}
reinterpretTypeAsFunctionTypeParam(type: N.FlowType): N.FlowFunctionTypeParam {
const node = this.startNodeAt(type.start, type.loc);
const node = this.startNodeAt(type.start, type.loc.start);
node.name = null;
node.optional = false;
node.typeAnnotation = type;
@@ -921,7 +921,7 @@ export default (superClass: Class<Parser>): Class<Parser> => class extends super
const param = this.flowParsePrefixType();
if (!this.state.noAnonFunctionType && this.eat(tt.arrow)) {
// TODO: This should be a type error. Passing in a SourceLocation, and it expects a Position.
const node = this.startNodeAt(param.start, param.loc);
const node = this.startNodeAt(param.start, param.loc.start);
node.params = [this.reinterpretTypeAsFunctionTypeParam(param)];
node.rest = null;
node.returnType = this.flowParseType();