forked from lightscript/babylon-lightscript
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix for bang call subscripting issue across block boundaries
- Loading branch information
Showing
10 changed files
with
345 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
test/fixtures/bang-call/subscripts/ambiguous-arrow-body/actual.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
a! -> | ||
b | ||
~c() |
193 changes: 193 additions & 0 deletions
193
test/fixtures/bang-call/subscripts/ambiguous-arrow-body/expected.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,193 @@ | ||
{ | ||
"type": "File", | ||
"start": 0, | ||
"end": 16, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 3, | ||
"column": 6 | ||
} | ||
}, | ||
"program": { | ||
"type": "Program", | ||
"start": 0, | ||
"end": 16, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 3, | ||
"column": 6 | ||
} | ||
}, | ||
"sourceType": "script", | ||
"body": [ | ||
{ | ||
"type": "ExpressionStatement", | ||
"start": 0, | ||
"end": 16, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 3, | ||
"column": 6 | ||
} | ||
}, | ||
"expression": { | ||
"type": "CallExpression", | ||
"start": 0, | ||
"end": 16, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 3, | ||
"column": 6 | ||
} | ||
}, | ||
"callee": { | ||
"type": "Identifier", | ||
"start": 0, | ||
"end": 1, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 1 | ||
}, | ||
"identifierName": "a" | ||
}, | ||
"name": "a" | ||
}, | ||
"arguments": [ | ||
{ | ||
"type": "ArrowFunctionExpression", | ||
"start": 3, | ||
"end": 16, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 3 | ||
}, | ||
"end": { | ||
"line": 3, | ||
"column": 6 | ||
} | ||
}, | ||
"id": null, | ||
"generator": false, | ||
"expression": false, | ||
"async": false, | ||
"params": [], | ||
"skinny": true, | ||
"body": { | ||
"type": "BlockStatement", | ||
"start": 3, | ||
"end": 16, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 3 | ||
}, | ||
"end": { | ||
"line": 3, | ||
"column": 6 | ||
} | ||
}, | ||
"body": [ | ||
{ | ||
"type": "ExpressionStatement", | ||
"start": 8, | ||
"end": 16, | ||
"loc": { | ||
"start": { | ||
"line": 2, | ||
"column": 2 | ||
}, | ||
"end": { | ||
"line": 3, | ||
"column": 6 | ||
} | ||
}, | ||
"expression": { | ||
"type": "TildeCallExpression", | ||
"start": 8, | ||
"end": 16, | ||
"loc": { | ||
"start": { | ||
"line": 2, | ||
"column": 2 | ||
}, | ||
"end": { | ||
"line": 3, | ||
"column": 6 | ||
} | ||
}, | ||
"left": { | ||
"type": "Identifier", | ||
"start": 8, | ||
"end": 9, | ||
"loc": { | ||
"start": { | ||
"line": 2, | ||
"column": 2 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"column": 3 | ||
}, | ||
"identifierName": "b" | ||
}, | ||
"name": "b" | ||
}, | ||
"right": { | ||
"type": "Identifier", | ||
"start": 13, | ||
"end": 14, | ||
"loc": { | ||
"start": { | ||
"line": 3, | ||
"column": 3 | ||
}, | ||
"end": { | ||
"line": 3, | ||
"column": 4 | ||
}, | ||
"identifierName": "c" | ||
}, | ||
"name": "c" | ||
}, | ||
"arguments": [] | ||
} | ||
} | ||
], | ||
"directives": [], | ||
"extra": { | ||
"curly": false | ||
} | ||
} | ||
} | ||
], | ||
"extra": { | ||
"bang": true | ||
} | ||
} | ||
} | ||
], | ||
"directives": [] | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
test/fixtures/bang-call/subscripts/ambiguous-arrow-body/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"alternatives": { | ||
"default": { | ||
"throws": "Indentation required. (3:2)" | ||
}, | ||
"noEnforcedSubscriptIndentation": { | ||
"allPlugins": true, | ||
"excludePlugins": ["enforceSubscriptIndentation"] | ||
} | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
test/fixtures/lightscript/whitespace/no-enforced-indentation-tilde/actual.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
a | ||
~b() |
Oops, something went wrong.