fix range generation for template tokens - fixes babel/babel-eslint#156
This commit is contained in:
parent
39e9fc9e40
commit
2c868efbad
@ -119,7 +119,8 @@ function convertTemplateType(tokens) {
|
|||||||
var templateToken = {
|
var templateToken = {
|
||||||
type: "Template",
|
type: "Template",
|
||||||
value: createTemplateValue(start, end),
|
value: createTemplateValue(start, end),
|
||||||
range: [tokens[start].start, tokens[end].end],
|
start: tokens[start].start,
|
||||||
|
end: tokens[end].end,
|
||||||
loc: {
|
loc: {
|
||||||
start: tokens[start].loc.start,
|
start: tokens[start].loc.start,
|
||||||
end: tokens[end].loc.end
|
end: tokens[end].loc.end
|
||||||
@ -175,12 +176,12 @@ function convertTemplateType(tokens) {
|
|||||||
var astTransformVisitor = {
|
var astTransformVisitor = {
|
||||||
noScope: true,
|
noScope: true,
|
||||||
enter: function (node) {
|
enter: function (node) {
|
||||||
|
node.range = [node.start, node.end];
|
||||||
|
|
||||||
// private var to track original node type
|
// private var to track original node type
|
||||||
node._babelType = node.type;
|
node._babelType = node.type;
|
||||||
},
|
},
|
||||||
exit: function (node) { /* parent */
|
exit: function (node) { /* parent */
|
||||||
node.range = [node.start, node.end];
|
|
||||||
|
|
||||||
if (this.isSpreadProperty()) {
|
if (this.isSpreadProperty()) {
|
||||||
node.type = "Property";
|
node.type = "Property";
|
||||||
node.kind = "init";
|
node.kind = "init";
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user