Skip to content

Commit

Permalink
🐛 fix wrong locations for filters syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
mysticatea committed Dec 1, 2018
1 parent 4cea141 commit 41cf264
Show file tree
Hide file tree
Showing 8 changed files with 1,188 additions and 89 deletions.
2 changes: 1 addition & 1 deletion src/script/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,7 @@ export function parseExpression(
ret.references.push(...retF.references)
}

prevLoc += 1 + filterCodes.length
prevLoc += 1 + filterCode.length
}

// Update range.
Expand Down
152 changes: 76 additions & 76 deletions test/fixtures/ast/filters-2/ast.json
Original file line number Diff line number Diff line change
Expand Up @@ -194,33 +194,33 @@
{
"type": "VFilter",
"range": [
35,
39
36,
40
],
"loc": {
"start": {
"line": 2,
"column": 24
"column": 25
},
"end": {
"line": 2,
"column": 28
"column": 29
}
},
"callee": {
"type": "Identifier",
"range": [
35,
37
36,
38
],
"loc": {
"start": {
"line": 2,
"column": 24
"column": 25
},
"end": {
"line": 2,
"column": 26
"column": 27
}
},
"name": "f2"
Expand All @@ -230,55 +230,55 @@
{
"type": "VFilter",
"range": [
39,
46
43,
50
],
"loc": {
"start": {
"line": 2,
"column": 28
"column": 32
},
"end": {
"line": 2,
"column": 35
"column": 39
}
},
"callee": {
"type": "Identifier",
"range": [
39,
41
43,
45
],
"loc": {
"start": {
"line": 2,
"column": 28
"column": 32
},
"end": {
"line": 2,
"column": 30
"column": 34
}
},
"name": "f3"
},
"arguments": [
{
"type": "Identifier",
"start": 42,
"end": 45,
"start": 46,
"end": 49,
"loc": {
"start": {
"line": 2,
"column": 31
"column": 35
},
"end": {
"line": 2,
"column": 34
"column": 38
}
},
"range": [
42,
45
46,
49
],
"name": "ref"
}
Expand All @@ -287,7 +287,7 @@
],
"range": [
23,
46
50
],
"loc": {
"start": {
Expand All @@ -296,7 +296,7 @@
},
"end": {
"line": 2,
"column": 35
"column": 39
}
}
},
Expand Down Expand Up @@ -327,21 +327,21 @@
{
"id": {
"type": "Identifier",
"start": 42,
"end": 45,
"start": 46,
"end": 49,
"loc": {
"start": {
"line": 2,
"column": 31
"column": 35
},
"end": {
"line": 2,
"column": 34
"column": 38
}
},
"range": [
42,
45
46,
49
],
"name": "ref"
},
Expand Down Expand Up @@ -575,172 +575,172 @@
"type": "Punctuator",
"value": "|",
"range": [
33,
34
34,
35
],
"loc": {
"start": {
"line": 2,
"column": 22
"column": 23
},
"end": {
"line": 2,
"column": 23
"column": 24
}
}
},
{
"type": "Identifier",
"value": " f2",
"range": [
35,
37
36,
38
],
"loc": {
"start": {
"line": 2,
"column": 24
"column": 25
},
"end": {
"line": 2,
"column": 26
"column": 27
}
}
},
{
"type": "Punctuator",
"value": "(",
"start": 37,
"end": 38,
"start": 38,
"end": 39,
"loc": {
"start": {
"line": 2,
"column": 26
"column": 27
},
"end": {
"line": 2,
"column": 27
"column": 28
}
},
"range": [
37,
38
38,
39
]
},
{
"type": "Punctuator",
"value": ")",
"start": 38,
"end": 39,
"start": 39,
"end": 40,
"loc": {
"start": {
"line": 2,
"column": 27
"column": 28
},
"end": {
"line": 2,
"column": 28
"column": 29
}
},
"range": [
38,
39
39,
40
]
},
{
"type": "Punctuator",
"value": "|",
"range": [
37,
38
41,
42
],
"loc": {
"start": {
"line": 2,
"column": 26
"column": 30
},
"end": {
"line": 2,
"column": 27
"column": 31
}
}
},
{
"type": "Identifier",
"value": " f3",
"range": [
39,
41
43,
45
],
"loc": {
"start": {
"line": 2,
"column": 28
"column": 32
},
"end": {
"line": 2,
"column": 30
"column": 34
}
}
},
{
"type": "Punctuator",
"value": "(",
"start": 41,
"end": 42,
"start": 45,
"end": 46,
"loc": {
"start": {
"line": 2,
"column": 30
"column": 34
},
"end": {
"line": 2,
"column": 31
"column": 35
}
},
"range": [
41,
42
45,
46
]
},
{
"type": "Identifier",
"value": "ref",
"start": 42,
"end": 45,
"start": 46,
"end": 49,
"loc": {
"start": {
"line": 2,
"column": 31
"column": 35
},
"end": {
"line": 2,
"column": 34
"column": 38
}
},
"range": [
42,
45
46,
49
]
},
{
"type": "Punctuator",
"value": ")",
"start": 45,
"end": 46,
"start": 49,
"end": 50,
"loc": {
"start": {
"line": 2,
"column": 34
"column": 38
},
"end": {
"line": 2,
"column": 35
"column": 39
}
},
"range": [
45,
46
49,
50
]
},
{
Expand Down
Loading

0 comments on commit 41cf264

Please sign in to comment.