Skip to content

Commit 97109a6

Browse files
committed
Fix for bang-tilde-call parsing
1 parent 33e044c commit 97109a6

File tree

3 files changed

+124
-2
lines changed

3 files changed

+124
-2
lines changed

src/plugins/tildeCall.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ export default function(parser) {
2323
// Allow bang tilde calls
2424
if (this.hasPlugin("bangCall") && this.isAdjacentBang()) {
2525
const next = this.parseBangCall(node, "CallExpression");
26+
node.arguments.unshift(firstArg);
27+
node.tilde = true;
2628
if (next) {
27-
next.arguments.unshift(firstArg);
28-
next.tilde = true;
2929
return next;
3030
} else {
3131
return false;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
a~b! c
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
{
2+
"type": "File",
3+
"start": 0,
4+
"end": 6,
5+
"loc": {
6+
"start": {
7+
"line": 1,
8+
"column": 0
9+
},
10+
"end": {
11+
"line": 1,
12+
"column": 6
13+
}
14+
},
15+
"program": {
16+
"type": "Program",
17+
"start": 0,
18+
"end": 6,
19+
"loc": {
20+
"start": {
21+
"line": 1,
22+
"column": 0
23+
},
24+
"end": {
25+
"line": 1,
26+
"column": 6
27+
}
28+
},
29+
"sourceType": "script",
30+
"body": [
31+
{
32+
"type": "ExpressionStatement",
33+
"start": 0,
34+
"end": 6,
35+
"loc": {
36+
"start": {
37+
"line": 1,
38+
"column": 0
39+
},
40+
"end": {
41+
"line": 1,
42+
"column": 6
43+
}
44+
},
45+
"expression": {
46+
"type": "CallExpression",
47+
"start": 0,
48+
"end": 6,
49+
"loc": {
50+
"start": {
51+
"line": 1,
52+
"column": 0
53+
},
54+
"end": {
55+
"line": 1,
56+
"column": 6
57+
}
58+
},
59+
"callee": {
60+
"type": "Identifier",
61+
"start": 2,
62+
"end": 3,
63+
"loc": {
64+
"start": {
65+
"line": 1,
66+
"column": 2
67+
},
68+
"end": {
69+
"line": 1,
70+
"column": 3
71+
},
72+
"identifierName": "b"
73+
},
74+
"name": "b"
75+
},
76+
"arguments": [
77+
{
78+
"type": "Identifier",
79+
"start": 0,
80+
"end": 1,
81+
"loc": {
82+
"start": {
83+
"line": 1,
84+
"column": 0
85+
},
86+
"end": {
87+
"line": 1,
88+
"column": 1
89+
},
90+
"identifierName": "a"
91+
},
92+
"name": "a"
93+
},
94+
{
95+
"type": "Identifier",
96+
"start": 5,
97+
"end": 6,
98+
"loc": {
99+
"start": {
100+
"line": 1,
101+
"column": 5
102+
},
103+
"end": {
104+
"line": 1,
105+
"column": 6
106+
},
107+
"identifierName": "c"
108+
},
109+
"name": "c"
110+
}
111+
],
112+
"extra": {
113+
"bang": true
114+
},
115+
"tilde": true
116+
}
117+
}
118+
],
119+
"directives": []
120+
}
121+
}

0 commit comments

Comments
 (0)