Skip to content
This repository has been archived by the owner on May 19, 2018. It is now read-only.

Commit

Permalink
Fix location info on FunctionTypeParam nodes (#565)
Browse files Browse the repository at this point in the history
  • Loading branch information
xixixao authored and hzoo committed Jun 5, 2017
1 parent e579109 commit bbc3cd4
Show file tree
Hide file tree
Showing 18 changed files with 64 additions and 256 deletions.
4 changes: 2 additions & 2 deletions src/plugins/flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,8 @@
"end": 23,
"loc": {
"start": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 15
}
"line": 1,
"column": 9
},
"end": {
"line": 1,
Expand All @@ -87,14 +81,8 @@
"end": 18,
"loc": {
"start": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 15
}
"line": 1,
"column": 9
},
"end": {
"line": 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,8 @@
"end": 30,
"loc": {
"start": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 22
}
"line": 1,
"column": 9
},
"end": {
"line": 1,
Expand All @@ -87,14 +81,8 @@
"end": 25,
"loc": {
"start": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 22
}
"line": 1,
"column": 9
},
"end": {
"line": 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,8 @@
"end": 27,
"loc": {
"start": {
"start": {
"line": 1,
"column": 14
},
"end": {
"line": 1,
"column": 20
}
"line": 1,
"column": 14
},
"end": {
"line": 1,
Expand All @@ -130,14 +124,8 @@
"end": 23,
"loc": {
"start": {
"start": {
"line": 1,
"column": 14
},
"end": {
"line": 1,
"column": 20
}
"line": 1,
"column": 14
},
"end": {
"line": 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,8 @@
"end": 35,
"loc": {
"start": {
"start": {
"line": 1,
"column": 18
},
"end": {
"line": 1,
"column": 24
}
"line": 1,
"column": 18
},
"end": {
"line": 1,
Expand All @@ -117,14 +111,8 @@
"end": 27,
"loc": {
"start": {
"start": {
"line": 1,
"column": 18
},
"end": {
"line": 1,
"column": 24
}
"line": 1,
"column": 18
},
"end": {
"line": 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,8 @@
"end": 35,
"loc": {
"start": {
"start": {
"line": 1,
"column": 18
},
"end": {
"line": 1,
"column": 24
}
"line": 1,
"column": 18
},
"end": {
"line": 1,
Expand All @@ -117,14 +111,8 @@
"end": 27,
"loc": {
"start": {
"start": {
"line": 1,
"column": 18
},
"end": {
"line": 1,
"column": 24
}
"line": 1,
"column": 18
},
"end": {
"line": 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,8 @@
"end": 27,
"loc": {
"start": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 16
}
"line": 1,
"column": 9
},
"end": {
"line": 1,
Expand All @@ -87,14 +81,8 @@
"end": 19,
"loc": {
"start": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 16
}
"line": 1,
"column": 9
},
"end": {
"line": 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,8 @@
"end": 28,
"loc": {
"start": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 17
}
"line": 1,
"column": 9
},
"end": {
"line": 1,
Expand All @@ -87,14 +81,8 @@
"end": 20,
"loc": {
"start": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 17
}
"line": 1,
"column": 9
},
"end": {
"line": 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,20 +81,8 @@
"end": 27,
"loc": {
"start": {
"start": {
"start": {
"line": 1,
"column": 10
},
"end": {
"line": 1,
"column": 16
}
},
"end": {
"line": 1,
"column": 27
}
"line": 1,
"column": 10
},
"end": {
"line": 1,
Expand All @@ -109,14 +97,8 @@
"end": 27,
"loc": {
"start": {
"start": {
"line": 1,
"column": 10
},
"end": {
"line": 1,
"column": 16
}
"line": 1,
"column": 10
},
"end": {
"line": 1,
Expand All @@ -130,14 +112,8 @@
"end": 19,
"loc": {
"start": {
"start": {
"line": 1,
"column": 10
},
"end": {
"line": 1,
"column": 16
}
"line": 1,
"column": 10
},
"end": {
"line": 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,8 @@
"end": 35,
"loc": {
"start": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 15
}
"line": 1,
"column": 9
},
"end": {
"line": 1,
Expand All @@ -87,14 +81,8 @@
"end": 18,
"loc": {
"start": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 15
}
"line": 1,
"column": 9
},
"end": {
"line": 1,
Expand Down
Loading

0 comments on commit bbc3cd4

Please sign in to comment.