From 5e28e85b8d2e13ae1bab0efdf427b41f2d7346bc Mon Sep 17 00:00:00 2001 From: "William C. Johnson" Date: Sat, 21 Oct 2017 13:56:27 -0400 Subject: [PATCH] Re-disable `!(` --- src/plugins/bangCall.js | 5 +- .../subscripts/no-space-call/expected.json | 162 ------------------ .../subscripts/no-space-call/options.json | 3 + 3 files changed, 5 insertions(+), 165 deletions(-) delete mode 100644 test/fixtures/bang-call/subscripts/no-space-call/expected.json create mode 100644 test/fixtures/bang-call/subscripts/no-space-call/options.json diff --git a/src/plugins/bangCall.js b/src/plugins/bangCall.js index adf6559d15..ee1fb35b81 100644 --- a/src/plugins/bangCall.js +++ b/src/plugins/bangCall.js @@ -18,10 +18,9 @@ export default function(parser) { ); }; - pp.couldBeginSubscript = function() { + pp.couldBeginAdjacentBangSubscript = function() { return ( this.match(tt.bracketL) || - this.match(tt.parenL) || this.match(tt.dot) || this.match(tt.tilde) || this.match(tt.elvis) || @@ -62,7 +61,7 @@ export default function(parser) { if (this.state.lastTokEnd === this.state.start) { // If next token could initiate a subscript, treat as no-arg bang call with // subscript. - if (this.couldBeginSubscript()) { + if (this.couldBeginAdjacentBangSubscript()) { return this.finishNode(node, nodeType); } diff --git a/test/fixtures/bang-call/subscripts/no-space-call/expected.json b/test/fixtures/bang-call/subscripts/no-space-call/expected.json deleted file mode 100644 index dbe036642c..0000000000 --- a/test/fixtures/bang-call/subscripts/no-space-call/expected.json +++ /dev/null @@ -1,162 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "sourceType": "script", - "body": [ - { - "type": "ExpressionStatement", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "expression": { - "type": "CallExpression", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "callee": { - "type": "CallExpression", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "callee": { - "type": "Identifier", - "start": 0, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "bang" - }, - "name": "bang" - }, - "arguments": [], - "extra": { - "bang": true - } - }, - "arguments": [ - { - "type": "NumericLiteral", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "extra": { - "rawValue": 1, - "raw": "1" - }, - "value": 1 - }, - { - "type": "NumericLiteral", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "extra": { - "rawValue": 2, - "raw": "2" - }, - "value": 2 - }, - { - "type": "NumericLiteral", - "start": 12, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "extra": { - "rawValue": 3, - "raw": "3" - }, - "value": 3 - } - ] - } - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/test/fixtures/bang-call/subscripts/no-space-call/options.json b/test/fixtures/bang-call/subscripts/no-space-call/options.json new file mode 100644 index 0000000000..9f4e2b272a --- /dev/null +++ b/test/fixtures/bang-call/subscripts/no-space-call/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Whitespace required between `!` and first argument. (1:5)" +}