Skip to content

Commit

Permalink
Fix location info on FunctionTypeParam nodes (babel#565) (babel#571)
Browse files Browse the repository at this point in the history
  • Loading branch information
danez committed Jun 9, 2017
1 parent eeba714 commit 041e7ef
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
Expand Up @@ -575,7 +575,7 @@ pp.flowParseFunctionTypeParam = function () {
};

pp.reinterpretTypeAsFunctionTypeParam = function (type) {
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 @@ -787,7 +787,7 @@ pp.flowParsePrefixType = function () {
pp.flowParseAnonFunctionWithoutParens = function () {
const param = this.flowParsePrefixType();
if (!this.state.noAnonFunctionType && this.eat(tt.arrow)) {
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
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
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
Expand Up @@ -108,14 +108,8 @@
"end": 27,
"loc": {
"start": {
"start": {
"line": 1,
"column": 14
},
"end": {
"line": 1,
"column": 20
}
"line": 1,
"column": 14
},
"end": {
"line": 1,
Expand All @@ -129,14 +123,8 @@
"end": 23,
"loc": {
"start": {
"start": {
"line": 1,
"column": 14
},
"end": {
"line": 1,
"column": 20
}
"line": 1,
"column": 14
},
"end": {
"line": 1,
Expand Down
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
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
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
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
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
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

0 comments on commit 041e7ef

Please sign in to comment.