Skip to content

Commit

Permalink
Fix for bang-tilde-call parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
wcjohnson committed Sep 24, 2017
1 parent 33e044c commit 97109a6
Show file tree
Hide file tree
Showing 3 changed files with 124 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/plugins/tildeCall.js
Expand Up @@ -23,9 +23,9 @@ export default function(parser) {
// Allow bang tilde calls
if (this.hasPlugin("bangCall") && this.isAdjacentBang()) {
const next = this.parseBangCall(node, "CallExpression");
node.arguments.unshift(firstArg);
node.tilde = true;
if (next) {
next.arguments.unshift(firstArg);
next.tilde = true;
return next;
} else {
return false;
Expand Down
1 change: 1 addition & 0 deletions test/fixtures/bang-call/misc/tilde/actual.js
@@ -0,0 +1 @@
a~b! c
121 changes: 121 additions & 0 deletions test/fixtures/bang-call/misc/tilde/expected.json
@@ -0,0 +1,121 @@
{
"type": "File",
"start": 0,
"end": 6,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 6
}
},
"program": {
"type": "Program",
"start": 0,
"end": 6,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 6
}
},
"sourceType": "script",
"body": [
{
"type": "ExpressionStatement",
"start": 0,
"end": 6,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 6
}
},
"expression": {
"type": "CallExpression",
"start": 0,
"end": 6,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 6
}
},
"callee": {
"type": "Identifier",
"start": 2,
"end": 3,
"loc": {
"start": {
"line": 1,
"column": 2
},
"end": {
"line": 1,
"column": 3
},
"identifierName": "b"
},
"name": "b"
},
"arguments": [
{
"type": "Identifier",
"start": 0,
"end": 1,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 1
},
"identifierName": "a"
},
"name": "a"
},
{
"type": "Identifier",
"start": 5,
"end": 6,
"loc": {
"start": {
"line": 1,
"column": 5
},
"end": {
"line": 1,
"column": 6
},
"identifierName": "c"
},
"name": "c"
}
],
"extra": {
"bang": true
},
"tilde": true
}
}
],
"directives": []
}
}

0 comments on commit 97109a6

Please sign in to comment.