diff --git a/src/parser/statement.js b/src/parser/statement.js index 9ebfe55279..5c9d27145e 100644 --- a/src/parser/statement.js +++ b/src/parser/statement.js @@ -97,6 +97,8 @@ pp.parseStatement = function (declaration, topLevel) { // in lightscript, allow line-starting `{` to be parsed as obj or obj pattern if (this.hasPlugin("lightscript") && this.isLineBreak()) { break; + } else if (this.hasPlugin("whiteblockOnly")) { + break; } else { return this.parseBlock(); } @@ -588,6 +590,9 @@ pp.parseExpressionStatement = function (node, expr) { // function bodies). pp.parseBlock = function (allowDirectives?) { + if (this.hasPlugin("whiteblockOnly")) { + this.unexpected(null, "Brace-delimited blocks are illegal in whiteblock-only mode."); + } const node = this.startNode(); this.expect(tt.braceL); this.parseBlockBody(node, allowDirectives, false, tt.braceR); @@ -806,6 +811,9 @@ pp.parseClassBody = function (node) { this.next(); isEnd = () => this.state.indentLevel <= indentLevel || this.match(tt.eof); } else { + if (this.hasPlugin("whiteblockOnly")) { + this.unexpected(null, "Brace-delimited blocks are illegal in whiteblock-only mode."); + } this.expect(tt.braceL); isEnd = () => this.eat(tt.braceR); } diff --git a/src/plugins/lightscript.js b/src/plugins/lightscript.js index 00b1c7021f..df34755a90 100644 --- a/src/plugins/lightscript.js +++ b/src/plugins/lightscript.js @@ -137,6 +137,7 @@ pp.parseObjectComprehension = function(node) { // Parse a whiteblock body consisting of a single object expr. pp.parseObjectWhiteBlock = function(node, blockIndentLevel) { + const errorPos = this.state.start; const exprStmt = this.startNode(); const obj = this.parseMaybeAssign(); @@ -146,10 +147,11 @@ pp.parseObjectWhiteBlock = function(node, blockIndentLevel) { // A tilde call can begin with { if an ObjectExpression is the thisArg. (obj.type !== "CallExpression" || !obj.tilde) ) { - throw new Error("WRONG_SPECULATIVE_BRANCH"); + this.unexpected(errorPos, "Expected an object."); } + if (this.state.indentLevel > blockIndentLevel) { - throw new Error("WRONG_SPECULATIVE_BRANCH"); + this.unexpected(errorPos, "Expected an object."); } exprStmt.expression = obj; @@ -161,29 +163,6 @@ pp.parseObjectWhiteBlock = function(node, blockIndentLevel) { return this.finishNode(node, "BlockStatement"); }; -pp.tryParseObjectWhiteBlock = function(node, blockIndentLevel) { - const state = this.state.clone(); - try { - return [this.parseObjectWhiteBlock(node, blockIndentLevel)]; - } catch (err) { - this.state = state; - return [null, err]; - } -}; - -pp.rethrowObjParseError = function(objParseResult, blockParseError) { - const objParseError = objParseResult ? objParseResult[1] : null; - if (objParseError) { - if (objParseError.message === "WRONG_SPECULATIVE_BRANCH") { - throw blockParseError; - } else { - throw objParseError; - } - } else { - throw blockParseError; - } -}; - pp.parseInlineWhiteBlock = function(node) { if (this.state.type.startsExpr) return this.parseMaybeAssign(); // oneline statement case @@ -196,24 +175,13 @@ pp.parseInlineWhiteBlock = function(node) { }; pp.parseMultilineWhiteBlock = function(node, indentLevel) { - let objParseResult = null; - if (this.match(tt.braceL) && this.hasPlugin("objectBlockAmbiguity_preferObject")) { - objParseResult = this.tryParseObjectWhiteBlock(node, indentLevel); - if (objParseResult[0]) return objParseResult[0]; + if (this.match(tt.braceL) && this.hasPlugin("whiteblockOnly")) { + return this.parseObjectWhiteBlock(node, indentLevel); + } - try { - this.parseBlockBody(node, false, false, indentLevel); - if (!node.body.length) { - this.unexpected(node.start, "Expected an Indent or Statement"); - } - } catch (err) { - this.rethrowObjParseError(objParseResult, err); - } - } else { - this.parseBlockBody(node, false, false, indentLevel); - if (!node.body.length) { - this.unexpected(node.start, "Expected an Indent or Statement"); - } + this.parseBlockBody(node, false, false, indentLevel); + if (!node.body.length) { + this.unexpected(node.start, "Expected an Indent or Statement"); } this.addExtra(node, "curly", false); @@ -226,24 +194,19 @@ pp.parseWhiteBlock = function (isExpression?) { // Oneline whiteblock if (!this.isLineBreak()) { - let objParseResult = null; - if (isExpression) { return this.parseInlineWhiteBlock(node); } - if (this.match(tt.braceL) && this.hasPlugin("objectBlockAmbiguity_preferObject")) { - objParseResult = this.tryParseObjectWhiteBlock(node, indentLevel); - if (objParseResult[0]) return objParseResult[0]; - } - try { - this.state.nestedBlockLevel++; - const stmt = this.parseStatement(false); - this.state.nestedBlockLevel--; - return stmt; - } catch (err) { - this.rethrowObjParseError(objParseResult, err); + if (this.match(tt.braceL) && this.hasPlugin("whiteblockOnly")) { + // Parse as object + return this.parseObjectWhiteBlock(node, indentLevel); } + + this.state.nestedBlockLevel++; + const stmt = this.parseStatement(false); + this.state.nestedBlockLevel--; + return stmt; } // TODO: document the fact that directives aren't parsed @@ -323,24 +286,14 @@ pp.parseArrowFunctionBody = function (node) { this.expect(tt.arrow); if (!this.isLineBreak()) { if (this.match(tt.braceL)) { - let objParseResult = null; - - if (this.hasPlugin("objectBlockAmbiguity_preferObject")) { - objParseResult = this.tryParseObjectWhiteBlock(nodeAtArrow, indentLevel); - if (objParseResult[0]) node.body = objParseResult[0]; - } - - // If we couldn't parse an object... - if (!node.body) { + if (this.hasPlugin("whiteblockOnly")) { + // In whiteblock mode, arrows that start with `{` must be object exprs + node.body = this.parseObjectWhiteBlock(nodeAtArrow, indentLevel); + } else { // restart node at brace start instead of arrow start node.body = this.startNode(); this.next(); - try { - this.parseBlockBody(node.body, true, false, tt.braceR); - } catch (err) { - node.body = null; - this.rethrowObjParseError(objParseResult, err); - } + this.parseBlockBody(node.body, true, false, tt.braceR); this.addExtra(node.body, "curly", true); node.body = this.finishNode(node.body, "BlockStatement"); } @@ -587,8 +540,7 @@ export default function (instance) { // first, try paren-free style try { const val = this.parseExpression(); - // "as" for `match (foo) as bar:`, bit dirty to allow for all but not a problem - if (this.match(tt.braceL) || this.match(tt.colon) || this.isContextual("as")) { + if (this.match(tt.braceL) || this.match(tt.colon)) { if (val.extra && val.extra.parenthesized) { delete val.extra.parenthesized; delete val.extra.parenStart; @@ -677,6 +629,9 @@ export default function (instance) { if (this.match(tt.colon)) { return this.parseWhiteBlock(); } + if (this.hasPlugin("whiteblockOnly")) { + this.unexpected(null, tt.colon); + } const block = inner.apply(this, arguments); this.addExtra(block, "curly", true); return block; diff --git a/src/registerPlugins.js b/src/registerPlugins.js index c5c45e4a12..6d49fe19c1 100644 --- a/src/registerPlugins.js +++ b/src/registerPlugins.js @@ -76,16 +76,14 @@ export default function registerPlugins(plugins, metadata) { ] }); - // Speculatively parse whiteblocks and arrows beginning with `{`, - // preferring to parse as ObjectExpressions when possible. - registerPlugin("objectBlockAmbiguity_preferObject", noncePlugin, { - dependencies: ["lightscript"] - }); - // Parse identifiers beginning with `_` or another user-chosen symbol // as PlaceholderExpressions. registerPlugin("syntacticPlaceholder", syntacticPlaceholderPlugin); // |> infix operator for piped function calls registerPlugin("pipeCall", pipeCallPlugin); + + registerPlugin("whiteblockOnly", noncePlugin, { + dependencies: ["lightscript"] + }); } diff --git a/test/fixtures/comments/basic/block-trailing-comment/options.json b/test/fixtures/comments/basic/block-trailing-comment/options.json index 09a8ac5b84..dc795e0f86 100644 --- a/test/fixtures/comments/basic/block-trailing-comment/options.json +++ b/test/fixtures/comments/basic/block-trailing-comment/options.json @@ -1,11 +1,7 @@ { "alternatives": { "all": { - "throws": "Unexpected token, expected { (2:7)" - }, - "noLsc": { - "allPlugins": true, - "excludePlugins": ["lightscript", "match", "enhancedComprehension", "objectBlockAmbiguity_preferObject"] + "throws": "Unexpected token, expected : (2:7)" } } } diff --git a/test/fixtures/comments/basic/block-trailing-comment/options.lightscript.json b/test/fixtures/comments/basic/block-trailing-comment/options.lightscript.json deleted file mode 100644 index d1ffeceb15..0000000000 --- a/test/fixtures/comments/basic/block-trailing-comment/options.lightscript.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Unexpected token, expected { (2:7)" -} \ No newline at end of file diff --git a/test/fixtures/comments/basic/comment-within-condition/expected.json b/test/fixtures/comments/basic/comment-within-condition/expected.json old mode 100755 new mode 100644 index 695fa34b10..d98e5b584d --- a/test/fixtures/comments/basic/comment-within-condition/expected.json +++ b/test/fixtures/comments/basic/comment-within-condition/expected.json @@ -54,7 +54,8 @@ "end": { "line": 2, "column": 16 - } + }, + "identifierName": "a" }, "name": "a", "leadingComments": [ diff --git a/test/fixtures/comments/basic/comment-within-condition/expected.lightscript.json b/test/fixtures/comments/basic/comment-within-condition/expected.lightscript.json new file mode 100644 index 0000000000..34505e4374 --- /dev/null +++ b/test/fixtures/comments/basic/comment-within-condition/expected.lightscript.json @@ -0,0 +1,169 @@ +{ + "type": "File", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "sourceType": "script", + "body": [ + { + "type": "IfStatement", + "start": 10, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "test": { + "type": "Identifier", + "start": 25, + "end": 26, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 16 + }, + "identifierName": "a" + }, + "name": "a", + "leadingComments": [ + { + "type": "CommentBlock", + "value": " bar ", + "start": 14, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 13 + } + } + } + ], + "extra": {} + }, + "consequent": { + "type": "ExpressionStatement", + "start": 28, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "expression": { + "type": "ObjectExpression", + "start": 28, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "properties": [] + } + }, + "alternate": null, + "leadingComments": [ + { + "type": "CommentBlock", + "value": " foo ", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentBlock", + "value": " foo ", + "start": 0, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "CommentBlock", + "value": " bar ", + "start": 14, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 13 + } + } + } + ] +} \ No newline at end of file diff --git a/test/fixtures/comments/basic/export-default-anonymous-class/options.json b/test/fixtures/comments/basic/export-default-anonymous-class/options.json index 2104ca4328..8270725509 100644 --- a/test/fixtures/comments/basic/export-default-anonymous-class/options.json +++ b/test/fixtures/comments/basic/export-default-anonymous-class/options.json @@ -1,3 +1,8 @@ { - "sourceType": "module" + "sourceType": "module", + "alternatives": { + "all": { + "throws": "Brace-delimited blocks are illegal in whiteblock-only mode. (4:21)" + } + } } diff --git a/test/fixtures/comments/basic/surrounding-call-comments/options.json b/test/fixtures/comments/basic/surrounding-call-comments/options.json new file mode 100644 index 0000000000..c13966a5c0 --- /dev/null +++ b/test/fixtures/comments/basic/surrounding-call-comments/options.json @@ -0,0 +1,7 @@ +{ + "alternatives": { + "all": { + "throws": "Unexpected token, expected : (1:13)" + } + } +} diff --git a/test/fixtures/comments/basic/surrounding-debugger-comments/options.json b/test/fixtures/comments/basic/surrounding-debugger-comments/options.json new file mode 100644 index 0000000000..c13966a5c0 --- /dev/null +++ b/test/fixtures/comments/basic/surrounding-debugger-comments/options.json @@ -0,0 +1,7 @@ +{ + "alternatives": { + "all": { + "throws": "Unexpected token, expected : (1:13)" + } + } +} diff --git a/test/fixtures/comments/basic/surrounding-return-comments/options.json b/test/fixtures/comments/basic/surrounding-return-comments/options.json new file mode 100644 index 0000000000..c13966a5c0 --- /dev/null +++ b/test/fixtures/comments/basic/surrounding-return-comments/options.json @@ -0,0 +1,7 @@ +{ + "alternatives": { + "all": { + "throws": "Unexpected token, expected : (1:13)" + } + } +} diff --git a/test/fixtures/comments/basic/surrounding-throw-comments/options.json b/test/fixtures/comments/basic/surrounding-throw-comments/options.json new file mode 100644 index 0000000000..c13966a5c0 --- /dev/null +++ b/test/fixtures/comments/basic/surrounding-throw-comments/options.json @@ -0,0 +1,7 @@ +{ + "alternatives": { + "all": { + "throws": "Unexpected token, expected : (1:13)" + } + } +} diff --git a/test/fixtures/comments/basic/surrounding-while-loop-comments/options.json b/test/fixtures/comments/basic/surrounding-while-loop-comments/options.json new file mode 100644 index 0000000000..c13966a5c0 --- /dev/null +++ b/test/fixtures/comments/basic/surrounding-while-loop-comments/options.json @@ -0,0 +1,7 @@ +{ + "alternatives": { + "all": { + "throws": "Unexpected token, expected : (1:13)" + } + } +} diff --git a/test/fixtures/comments/basic/switch-fallthrough-comment-in-function/options.json b/test/fixtures/comments/basic/switch-fallthrough-comment-in-function/options.json new file mode 100644 index 0000000000..76c288893c --- /dev/null +++ b/test/fixtures/comments/basic/switch-fallthrough-comment-in-function/options.json @@ -0,0 +1,7 @@ +{ + "alternatives": { + "all": { + "throws": "Unexpected token, expected : (1:18)" + } + } +} diff --git a/test/fixtures/comments/basic/switch-no-default-comment-in-function/options.json b/test/fixtures/comments/basic/switch-no-default-comment-in-function/options.json new file mode 100644 index 0000000000..541c113558 --- /dev/null +++ b/test/fixtures/comments/basic/switch-no-default-comment-in-function/options.json @@ -0,0 +1,7 @@ +{ + "alternatives": { + "all": { + "throws": "Unexpected token, expected : (1:16)" + } + } +} diff --git a/test/fixtures/comments/basic/switch-no-default-comment-in-nested-functions/options.json b/test/fixtures/comments/basic/switch-no-default-comment-in-nested-functions/options.json new file mode 100644 index 0000000000..7f7cf160e2 --- /dev/null +++ b/test/fixtures/comments/basic/switch-no-default-comment-in-nested-functions/options.json @@ -0,0 +1,7 @@ +{ + "alternatives": { + "all": { + "throws": "Unexpected token, expected : (1:35)" + } + } +} diff --git a/test/fixtures/comments/options.json b/test/fixtures/comments/options.json index 60bbeba2ff..c9ca3f290a 100644 --- a/test/fixtures/comments/options.json +++ b/test/fixtures/comments/options.json @@ -2,7 +2,12 @@ "alternatives": { "all": { "allPlugins": true, - "excludePlugins": ["estree"] + "optionsOverride": "options.lightscript.json", + "expected": "expected.lightscript.json" + }, + "noLsc": { + "allPlugins": true, + "excludePlugins": ["lightscript", "match", "enhancedComprehension", "whiteblockOnly"] } } } diff --git a/test/fixtures/core/options.json b/test/fixtures/core/options.json index 3aea3efb4e..7c856c033e 100644 --- a/test/fixtures/core/options.json +++ b/test/fixtures/core/options.json @@ -2,12 +2,13 @@ "alternatives": { "all": { "allPlugins": true, + "excludePlugins": ["whiteblockOnly"], "optionsOverride": "options.lightscript.json", "expected": "expected.lightscript.json" }, "noLsc": { "allPlugins": true, - "excludePlugins": ["lightscript", "match", "enhancedComprehension", "objectBlockAmbiguity_preferObject"] + "excludePlugins": ["lightscript", "match", "enhancedComprehension", "whiteblockOnly"] } } } diff --git a/test/fixtures/core/uncategorised/146/options.json b/test/fixtures/core/uncategorised/146/options.json index 9c3db23853..98c07bea05 100644 --- a/test/fixtures/core/uncategorised/146/options.json +++ b/test/fixtures/core/uncategorised/146/options.json @@ -10,7 +10,7 @@ "allPlugins": true, "excludePlugins": [ "lightscript", "match", "enhancedComprehension", - "objectBlockAmbiguity_preferObject", "tildeCallExpression" + "whiteblockOnly", "tildeCallExpression" ], "expected": "expected.json" } diff --git a/test/fixtures/core/uncategorised/19/options.json b/test/fixtures/core/uncategorised/19/options.json index ecd9ed0c6c..d35e085559 100644 --- a/test/fixtures/core/uncategorised/19/options.json +++ b/test/fixtures/core/uncategorised/19/options.json @@ -1,7 +1,7 @@ { "alternatives": { "noLsc": { - "excludePlugins": ["significantWhitespace", "bangCall", "enforceSubscriptIndentation", "lightscript", "match", "enhancedComprehension", "objectBlockAmbiguity_preferObject"] + "excludePlugins": ["significantWhitespace", "bangCall", "enforceSubscriptIndentation", "lightscript", "match", "enhancedComprehension", "whiteblockOnly"] } } } diff --git a/test/fixtures/core/uncategorised/321/options.json b/test/fixtures/core/uncategorised/321/options.json index f3e8929137..3608b87a41 100644 --- a/test/fixtures/core/uncategorised/321/options.json +++ b/test/fixtures/core/uncategorised/321/options.json @@ -1,7 +1,7 @@ { "alternatives": { "noLsc": { - "excludePlugins": ["significantWhitespace", "bangCall", "enforceSubscriptIndentation", "enhancedComprehension", "objectBlockAmbiguity_preferObject"] + "excludePlugins": ["significantWhitespace", "bangCall", "enforceSubscriptIndentation", "enhancedComprehension", "whiteblockOnly"] } } } diff --git a/test/fixtures/core/uncategorised/542/options.json b/test/fixtures/core/uncategorised/542/options.json index bdecead561..3d303ebc6c 100644 --- a/test/fixtures/core/uncategorised/542/options.json +++ b/test/fixtures/core/uncategorised/542/options.json @@ -1,7 +1,7 @@ { "alternatives": { "noLsc": { - "excludePlugins": ["bangCall", "enforceSubscriptIndentation", "significantWhitespace", "enhancedComprehension", "objectBlockAmbiguity_preferObject"] + "excludePlugins": ["bangCall", "enforceSubscriptIndentation", "significantWhitespace", "enhancedComprehension", "whiteblockOnly"] } } } diff --git a/test/fixtures/es2015/arrow-functions/object-rest-spread/expected.lightscript.json b/test/fixtures/es2015/arrow-functions/object-rest-spread/expected.lightscript.json deleted file mode 100644 index 99b66e3f16..0000000000 --- a/test/fixtures/es2015/arrow-functions/object-rest-spread/expected.lightscript.json +++ /dev/null @@ -1,262 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 2 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 2 - } - }, - "sourceType": "script", - "body": [ - { - "type": "VariableDeclaration", - "start": 0, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 2 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 4, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "foo" - }, - "name": "foo" - }, - "init": { - "type": "ArrowFunctionExpression", - "start": 10, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "ObjectPattern", - "start": 12, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "properties": [ - { - "type": "ObjectProperty", - "start": 14, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "start": 14, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "title" - }, - "name": "title" - }, - "value": { - "type": "Identifier", - "start": 14, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "title" - }, - "name": "title" - }, - "extra": { - "shorthand": true - } - }, - { - "type": "RestProperty", - "start": 21, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "argument": { - "type": "Identifier", - "start": 24, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 29 - }, - "identifierName": "other" - }, - "name": "other" - } - } - ] - } - ], - "skinny": false, - "body": { - "type": "BlockStatement", - "start": 34, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 37, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "expression": { - "type": "ObjectExpression", - "start": 37, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "properties": [] - } - } - ], - "directives": [], - "extra": { - "curly": false - } - } - } - } - ], - "kind": "var" - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/test/fixtures/es2015/options.json b/test/fixtures/es2015/options.json index 3aea3efb4e..7c856c033e 100644 --- a/test/fixtures/es2015/options.json +++ b/test/fixtures/es2015/options.json @@ -2,12 +2,13 @@ "alternatives": { "all": { "allPlugins": true, + "excludePlugins": ["whiteblockOnly"], "optionsOverride": "options.lightscript.json", "expected": "expected.lightscript.json" }, "noLsc": { "allPlugins": true, - "excludePlugins": ["lightscript", "match", "enhancedComprehension", "objectBlockAmbiguity_preferObject"] + "excludePlugins": ["lightscript", "match", "enhancedComprehension", "whiteblockOnly"] } } } diff --git a/test/fixtures/es2015/uncategorised/176/expected.lightscript.json b/test/fixtures/es2015/uncategorised/176/expected.lightscript.json deleted file mode 100644 index bf4e0714a0..0000000000 --- a/test/fixtures/es2015/uncategorised/176/expected.lightscript.json +++ /dev/null @@ -1,155 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "sourceType": "script", - "body": [ - { - "type": "ExpressionStatement", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "expression": { - "type": "ArrowFunctionExpression", - "start": 0, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "RestElement", - "start": 1, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "argument": { - "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "a" - }, - "name": "a" - } - } - ], - "skinny": false, - "body": { - "type": "BlockStatement", - "start": 7, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 10, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "expression": { - "type": "ObjectExpression", - "start": 10, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "properties": [] - } - } - ], - "directives": [], - "extra": { - "curly": false - } - } - } - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/test/fixtures/es2015/uncategorised/177/expected.lightscript.json b/test/fixtures/es2015/uncategorised/177/expected.lightscript.json deleted file mode 100644 index 523828ea13..0000000000 --- a/test/fixtures/es2015/uncategorised/177/expected.lightscript.json +++ /dev/null @@ -1,172 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "sourceType": "script", - "body": [ - { - "type": "ExpressionStatement", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "expression": { - "type": "ArrowFunctionExpression", - "start": 0, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "Identifier", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - }, - "identifierName": "a" - }, - "name": "a" - }, - { - "type": "RestElement", - "start": 4, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "argument": { - "type": "Identifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "b" - }, - "name": "b" - } - } - ], - "skinny": false, - "body": { - "type": "BlockStatement", - "start": 10, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 13, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "expression": { - "type": "ObjectExpression", - "start": 13, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "properties": [] - } - } - ], - "directives": [], - "extra": { - "curly": false - } - } - } - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/test/fixtures/es2015/uncategorised/178/expected.lightscript.json b/test/fixtures/es2015/uncategorised/178/expected.lightscript.json deleted file mode 100644 index e429fef858..0000000000 --- a/test/fixtures/es2015/uncategorised/178/expected.lightscript.json +++ /dev/null @@ -1,195 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "sourceType": "script", - "body": [ - { - "type": "ExpressionStatement", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "expression": { - "type": "ArrowFunctionExpression", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "ObjectPattern", - "start": 1, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "properties": [ - { - "type": "ObjectProperty", - "start": 3, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "start": 3, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "a" - }, - "name": "a" - }, - "value": { - "type": "Identifier", - "start": 3, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "a" - }, - "name": "a" - }, - "extra": { - "shorthand": true - } - } - ] - } - ], - "skinny": false, - "body": { - "type": "BlockStatement", - "start": 8, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 11, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "expression": { - "type": "ObjectExpression", - "start": 11, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "properties": [] - } - } - ], - "directives": [], - "extra": { - "curly": false - } - } - } - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/test/fixtures/es2015/uncategorised/182/expected.lightscript.json b/test/fixtures/es2015/uncategorised/182/expected.lightscript.json deleted file mode 100644 index b90c2b8ff7..0000000000 --- a/test/fixtures/es2015/uncategorised/182/expected.lightscript.json +++ /dev/null @@ -1,258 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "sourceType": "script", - "body": [ - { - "type": "ExpressionStatement", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "expression": { - "type": "ArrowFunctionExpression", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "ObjectPattern", - "start": 1, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "properties": [ - { - "type": "ObjectProperty", - "start": 3, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "method": false, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "start": 3, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "a" - }, - "name": "a" - }, - "value": { - "type": "ArrayPattern", - "start": 6, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "elements": [ - { - "type": "Identifier", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "a" - }, - "name": "a" - }, - { - "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "b" - }, - "name": "b" - } - ] - } - } - ] - }, - { - "type": "RestElement", - "start": 16, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "argument": { - "type": "Identifier", - "start": 19, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "c" - }, - "name": "c" - } - } - ], - "skinny": false, - "body": { - "type": "BlockStatement", - "start": 22, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 25, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "expression": { - "type": "ObjectExpression", - "start": 25, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "properties": [] - } - } - ], - "directives": [], - "extra": { - "curly": false - } - } - } - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/test/fixtures/es2015/uncategorised/183/expected.lightscript.json b/test/fixtures/es2015/uncategorised/183/expected.lightscript.json deleted file mode 100644 index bd9277187b..0000000000 --- a/test/fixtures/es2015/uncategorised/183/expected.lightscript.json +++ /dev/null @@ -1,330 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, - "sourceType": "script", - "body": [ - { - "type": "ExpressionStatement", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, - "expression": { - "type": "ArrowFunctionExpression", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "ObjectPattern", - "start": 1, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "properties": [ - { - "type": "ObjectProperty", - "start": 3, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "method": false, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "start": 3, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "a" - }, - "name": "a" - }, - "value": { - "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "b" - }, - "name": "b" - } - }, - { - "type": "ObjectProperty", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "c" - }, - "name": "c" - }, - "value": { - "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "c" - }, - "name": "c" - }, - "extra": { - "shorthand": true - } - } - ] - }, - { - "type": "ArrayPattern", - "start": 14, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "elements": [ - { - "type": "Identifier", - "start": 15, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - }, - "identifierName": "d" - }, - "name": "d" - }, - { - "type": "Identifier", - "start": 18, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - }, - "identifierName": "e" - }, - "name": "e" - } - ] - }, - { - "type": "RestElement", - "start": 22, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "argument": { - "type": "Identifier", - "start": 25, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - }, - "identifierName": "f" - }, - "name": "f" - } - } - ], - "skinny": false, - "body": { - "type": "BlockStatement", - "start": 28, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 33 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 31, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 33 - } - }, - "expression": { - "type": "ObjectExpression", - "start": 31, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 33 - } - }, - "properties": [] - } - } - ], - "directives": [], - "extra": { - "curly": false - } - } - } - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/test/fixtures/es2015/uncategorised/34/expected.lightscript.json b/test/fixtures/es2015/uncategorised/34/expected.lightscript.json deleted file mode 100644 index 8f4ffebdf8..0000000000 --- a/test/fixtures/es2015/uncategorised/34/expected.lightscript.json +++ /dev/null @@ -1,196 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "sourceType": "script", - "body": [ - { - "type": "ExpressionStatement", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "expression": { - "type": "ArrowFunctionExpression", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "e" - }, - "name": "e" - } - ], - "skinny": false, - "body": { - "type": "BlockStatement", - "start": 2, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 5, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "expression": { - "type": "ObjectExpression", - "start": 5, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "properties": [ - { - "type": "ObjectProperty", - "start": 7, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "method": false, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "start": 7, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "label" - }, - "name": "label" - }, - "value": { - "type": "NumericLiteral", - "start": 14, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "extra": { - "rawValue": 42, - "raw": "42" - }, - "value": 42 - } - } - ] - } - } - ], - "directives": [], - "extra": { - "curly": false - } - } - } - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/test/fixtures/es2015/uncategorised/49/expected.lightscript.json b/test/fixtures/es2015/uncategorised/49/expected.lightscript.json deleted file mode 100644 index 758ec1a8c0..0000000000 --- a/test/fixtures/es2015/uncategorised/49/expected.lightscript.json +++ /dev/null @@ -1,156 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "sourceType": "script", - "body": [ - { - "type": "ExpressionStatement", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "expression": { - "type": "CallExpression", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "callee": { - "type": "Identifier", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "foo" - }, - "name": "foo" - }, - "arguments": [ - { - "type": "ArrowFunctionExpression", - "start": 4, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [], - "skinny": false, - "body": { - "type": "BlockStatement", - "start": 7, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 10, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "expression": { - "type": "ObjectExpression", - "start": 10, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "properties": [] - } - } - ], - "directives": [], - "extra": { - "curly": false - } - } - } - ] - } - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/test/fixtures/es2015/uncategorised/50/expected.lightscript.json b/test/fixtures/es2015/uncategorised/50/expected.lightscript.json deleted file mode 100644 index f10b1966fe..0000000000 --- a/test/fixtures/es2015/uncategorised/50/expected.lightscript.json +++ /dev/null @@ -1,191 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "sourceType": "script", - "body": [ - { - "type": "ExpressionStatement", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "expression": { - "type": "CallExpression", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "callee": { - "type": "Identifier", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "foo" - }, - "name": "foo" - }, - "arguments": [ - { - "type": "ArrowFunctionExpression", - "start": 4, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "x" - }, - "name": "x" - }, - { - "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "y" - }, - "name": "y" - } - ], - "skinny": false, - "body": { - "type": "BlockStatement", - "start": 11, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 14, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "expression": { - "type": "ObjectExpression", - "start": 14, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "properties": [] - } - } - ], - "directives": [], - "extra": { - "curly": false - } - } - } - ] - } - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/test/fixtures/es2016/options.json b/test/fixtures/es2016/options.json index 60bbeba2ff..45796bb70b 100644 --- a/test/fixtures/es2016/options.json +++ b/test/fixtures/es2016/options.json @@ -2,7 +2,7 @@ "alternatives": { "all": { "allPlugins": true, - "excludePlugins": ["estree"] + "excludePlugins": ["whiteblockOnly"] } } } diff --git a/test/fixtures/es2017/async-functions/1/expected.lightscript.json b/test/fixtures/es2017/async-functions/1/expected.lightscript.json deleted file mode 100644 index 3bbb6263bb..0000000000 --- a/test/fixtures/es2017/async-functions/1/expected.lightscript.json +++ /dev/null @@ -1,122 +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": "ArrowFunctionExpression", - "start": 0, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "id": null, - "generator": false, - "expression": false, - "async": true, - "params": [], - "skinny": false, - "body": { - "type": "BlockStatement", - "start": 9, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 12, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "expression": { - "type": "ObjectExpression", - "start": 12, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "properties": [] - } - } - ], - "directives": [], - "extra": { - "curly": false - } - } - } - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/test/fixtures/es2017/async-functions/27/expected.lightscript.json b/test/fixtures/es2017/async-functions/27/expected.lightscript.json deleted file mode 100644 index 5b55dfd543..0000000000 --- a/test/fixtures/es2017/async-functions/27/expected.lightscript.json +++ /dev/null @@ -1,261 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, - "sourceType": "script", - "body": [ - { - "type": "VariableDeclaration", - "start": 0, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 6, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "id": { - "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "foo" - }, - "name": "foo" - }, - "init": { - "type": "ArrowFunctionExpression", - "start": 12, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "ObjectPattern", - "start": 13, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "properties": [ - { - "type": "ObjectProperty", - "start": 15, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "method": false, - "shorthand": true, - "key": { - "type": "Identifier", - "start": 15, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "async" - }, - "name": "async" - }, - "computed": false, - "value": { - "type": "AssignmentPattern", - "start": 15, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "left": { - "type": "Identifier", - "start": 15, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "async" - }, - "name": "async" - }, - "right": { - "type": "BooleanLiteral", - "start": 23, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "value": true - } - }, - "extra": { - "shorthand": true - } - } - ] - } - ], - "skinny": false, - "body": { - "type": "BlockStatement", - "start": 31, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 34, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "expression": { - "type": "ObjectExpression", - "start": 34, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "properties": [] - } - } - ], - "directives": [], - "extra": { - "curly": false - } - } - } - } - ], - "kind": "const" - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/test/fixtures/es2017/async-functions/28/expected.lightscript.json b/test/fixtures/es2017/async-functions/28/expected.lightscript.json deleted file mode 100644 index fb3ad7114c..0000000000 --- a/test/fixtures/es2017/async-functions/28/expected.lightscript.json +++ /dev/null @@ -1,227 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "sourceType": "script", - "body": [ - { - "type": "VariableDeclaration", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 6, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 34 - } - }, - "id": { - "type": "Identifier", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "foo" - }, - "name": "foo" - }, - "init": { - "type": "ArrowFunctionExpression", - "start": 12, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 34 - } - }, - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "ObjectPattern", - "start": 13, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "properties": [ - { - "type": "ObjectProperty", - "start": 15, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "method": false, - "shorthand": false, - "key": { - "type": "Identifier", - "start": 15, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "async" - }, - "name": "async" - }, - "computed": false, - "value": { - "type": "Identifier", - "start": 22, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 25 - }, - "identifierName": "bar" - }, - "name": "bar" - } - } - ] - } - ], - "skinny": false, - "body": { - "type": "BlockStatement", - "start": 29, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 34 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 32, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 34 - } - }, - "expression": { - "type": "ObjectExpression", - "start": 32, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 34 - } - }, - "properties": [] - } - } - ], - "directives": [], - "extra": { - "curly": false - } - } - } - } - ], - "kind": "const" - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/test/fixtures/es2017/options.json b/test/fixtures/es2017/options.json index 3aea3efb4e..7c856c033e 100644 --- a/test/fixtures/es2017/options.json +++ b/test/fixtures/es2017/options.json @@ -2,12 +2,13 @@ "alternatives": { "all": { "allPlugins": true, + "excludePlugins": ["whiteblockOnly"], "optionsOverride": "options.lightscript.json", "expected": "expected.lightscript.json" }, "noLsc": { "allPlugins": true, - "excludePlugins": ["lightscript", "match", "enhancedComprehension", "objectBlockAmbiguity_preferObject"] + "excludePlugins": ["lightscript", "match", "enhancedComprehension", "whiteblockOnly"] } } } diff --git a/test/fixtures/esprima/es2015-arrow-function/migrated_0006/expected.lightscript.json b/test/fixtures/esprima/es2015-arrow-function/migrated_0006/expected.lightscript.json deleted file mode 100644 index 8f4ffebdf8..0000000000 --- a/test/fixtures/esprima/es2015-arrow-function/migrated_0006/expected.lightscript.json +++ /dev/null @@ -1,196 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "sourceType": "script", - "body": [ - { - "type": "ExpressionStatement", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "expression": { - "type": "ArrowFunctionExpression", - "start": 0, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "Identifier", - "start": 0, - "end": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "e" - }, - "name": "e" - } - ], - "skinny": false, - "body": { - "type": "BlockStatement", - "start": 2, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 5, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "expression": { - "type": "ObjectExpression", - "start": 5, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "properties": [ - { - "type": "ObjectProperty", - "start": 7, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "method": false, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "start": 7, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "label" - }, - "name": "label" - }, - "value": { - "type": "NumericLiteral", - "start": 14, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "extra": { - "rawValue": 42, - "raw": "42" - }, - "value": 42 - } - } - ] - } - } - ], - "directives": [], - "extra": { - "curly": false - } - } - } - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/test/fixtures/esprima/es2015-arrow-function/migrated_0018/expected.lightscript.json b/test/fixtures/esprima/es2015-arrow-function/migrated_0018/expected.lightscript.json deleted file mode 100644 index 758ec1a8c0..0000000000 --- a/test/fixtures/esprima/es2015-arrow-function/migrated_0018/expected.lightscript.json +++ /dev/null @@ -1,156 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "sourceType": "script", - "body": [ - { - "type": "ExpressionStatement", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "expression": { - "type": "CallExpression", - "start": 0, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "callee": { - "type": "Identifier", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "foo" - }, - "name": "foo" - }, - "arguments": [ - { - "type": "ArrowFunctionExpression", - "start": 4, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [], - "skinny": false, - "body": { - "type": "BlockStatement", - "start": 7, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 10, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "expression": { - "type": "ObjectExpression", - "start": 10, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "properties": [] - } - } - ], - "directives": [], - "extra": { - "curly": false - } - } - } - ] - } - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/test/fixtures/esprima/es2015-arrow-function/migrated_0019/expected.lightscript.json b/test/fixtures/esprima/es2015-arrow-function/migrated_0019/expected.lightscript.json deleted file mode 100644 index f10b1966fe..0000000000 --- a/test/fixtures/esprima/es2015-arrow-function/migrated_0019/expected.lightscript.json +++ /dev/null @@ -1,191 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "sourceType": "script", - "body": [ - { - "type": "ExpressionStatement", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "expression": { - "type": "CallExpression", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "callee": { - "type": "Identifier", - "start": 0, - "end": 3, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - }, - "identifierName": "foo" - }, - "name": "foo" - }, - "arguments": [ - { - "type": "ArrowFunctionExpression", - "start": 4, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "Identifier", - "start": 5, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "identifierName": "x" - }, - "name": "x" - }, - { - "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "y" - }, - "name": "y" - } - ], - "skinny": false, - "body": { - "type": "BlockStatement", - "start": 11, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 14, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "expression": { - "type": "ObjectExpression", - "start": 14, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "properties": [] - } - } - ], - "directives": [], - "extra": { - "curly": false - } - } - } - ] - } - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/test/fixtures/esprima/es2015-yield/yield-arrow-parameter-default/expected.lightscript.json b/test/fixtures/esprima/es2015-yield/yield-arrow-parameter-default/expected.lightscript.json deleted file mode 100644 index 65be471986..0000000000 --- a/test/fixtures/esprima/es2015-yield/yield-arrow-parameter-default/expected.lightscript.json +++ /dev/null @@ -1,173 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "sourceType": "script", - "body": [ - { - "type": "ExpressionStatement", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "expression": { - "type": "ArrowFunctionExpression", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "AssignmentPattern", - "start": 1, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "left": { - "type": "Identifier", - "start": 1, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - }, - "identifierName": "x" - }, - "name": "x" - }, - "right": { - "type": "Identifier", - "start": 5, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "yield" - }, - "name": "yield" - }, - "isNowAssign": false - } - ], - "skinny": false, - "body": { - "type": "BlockStatement", - "start": 12, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 15, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "expression": { - "type": "ObjectExpression", - "start": 15, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "properties": [] - } - } - ], - "directives": [], - "extra": { - "curly": false - } - } - } - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/test/fixtures/esprima/es2015-yield/yield-expression-precedence/options.json b/test/fixtures/esprima/es2015-yield/yield-expression-precedence/options.json index 2e9e33ff12..391b97cdb2 100644 --- a/test/fixtures/esprima/es2015-yield/yield-expression-precedence/options.json +++ b/test/fixtures/esprima/es2015-yield/yield-expression-precedence/options.json @@ -8,7 +8,7 @@ }, "noSeqExprParens": { "allPlugins": true, - "excludePlugins": ["seqExprRequiresParen", "enhancedComprehension", "bangCall"] + "excludePlugins": ["seqExprRequiresParen", "enhancedComprehension", "bangCall", "whiteblockOnly"] } } } diff --git a/test/fixtures/esprima/es2015-yield/yield-generator-arrow-default/expected.lightscript.json b/test/fixtures/esprima/es2015-yield/yield-generator-arrow-default/expected.lightscript.json deleted file mode 100644 index 7ae05c9b2b..0000000000 --- a/test/fixtures/esprima/es2015-yield/yield-generator-arrow-default/expected.lightscript.json +++ /dev/null @@ -1,230 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "sourceType": "script", - "body": [ - { - "type": "FunctionDeclaration", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "id": { - "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "g" - }, - "name": "g" - }, - "generator": true, - "expression": false, - "async": false, - "params": [], - "body": { - "type": "BlockStatement", - "start": 14, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 16, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 33 - } - }, - "expression": { - "type": "ArrowFunctionExpression", - "start": 16, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 33 - } - }, - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "AssignmentPattern", - "start": 17, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "left": { - "type": "Identifier", - "start": 17, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "x" - }, - "name": "x" - }, - "right": { - "type": "YieldExpression", - "start": 21, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "delegate": false, - "argument": null - }, - "isNowAssign": false - } - ], - "skinny": false, - "body": { - "type": "BlockStatement", - "start": 28, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 33 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 31, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 33 - } - }, - "expression": { - "type": "ObjectExpression", - "start": 31, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 33 - } - }, - "properties": [] - } - } - ], - "directives": [], - "extra": { - "curly": false - } - } - } - } - ], - "directives": [], - "extra": { - "curly": true - } - } - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/test/fixtures/esprima/expression-unary/migrated_0008/options.json b/test/fixtures/esprima/expression-unary/migrated_0008/options.json index 9c3db23853..98c07bea05 100644 --- a/test/fixtures/esprima/expression-unary/migrated_0008/options.json +++ b/test/fixtures/esprima/expression-unary/migrated_0008/options.json @@ -10,7 +10,7 @@ "allPlugins": true, "excludePlugins": [ "lightscript", "match", "enhancedComprehension", - "objectBlockAmbiguity_preferObject", "tildeCallExpression" + "whiteblockOnly", "tildeCallExpression" ], "expected": "expected.json" } diff --git a/test/fixtures/esprima/options.json b/test/fixtures/esprima/options.json index 3aea3efb4e..7c856c033e 100644 --- a/test/fixtures/esprima/options.json +++ b/test/fixtures/esprima/options.json @@ -2,12 +2,13 @@ "alternatives": { "all": { "allPlugins": true, + "excludePlugins": ["whiteblockOnly"], "optionsOverride": "options.lightscript.json", "expected": "expected.lightscript.json" }, "noLsc": { "allPlugins": true, - "excludePlugins": ["lightscript", "match", "enhancedComprehension", "objectBlockAmbiguity_preferObject"] + "excludePlugins": ["lightscript", "match", "enhancedComprehension", "whiteblockOnly"] } } } diff --git a/test/fixtures/estree/options.json b/test/fixtures/estree/options.json index 986e084797..0f0858841d 100644 --- a/test/fixtures/estree/options.json +++ b/test/fixtures/estree/options.json @@ -3,6 +3,7 @@ "all": { "allPlugins": true, "includePlugins": ["estree"], + "excludePlugins": ["whiteblockOnly"], "optionsOverride": "options.lightscript.json", "expected": "expected.lightscript.json" } diff --git a/test/fixtures/existential-expression/options.json b/test/fixtures/existential-expression/options.json index 634ff57aaf..3fea3fe248 100644 --- a/test/fixtures/existential-expression/options.json +++ b/test/fixtures/existential-expression/options.json @@ -1,8 +1,7 @@ { "alternatives": { "default": { - "allPlugins": true, - "excludePlugins": ["estree"] + "allPlugins": true } } } diff --git a/test/fixtures/existential-expression/subscripts/subscript-illegal/options.json b/test/fixtures/existential-expression/subscripts/subscript-illegal/options.json index 2a14d2d7d4..34325e3f1b 100644 --- a/test/fixtures/existential-expression/subscripts/subscript-illegal/options.json +++ b/test/fixtures/existential-expression/subscripts/subscript-illegal/options.json @@ -1,4 +1,4 @@ { - "excludePlugins": ["lightscript", "bangCall", "enforceSubscriptIndentation", "match", "enhancedComprehension", "objectBlockAmbiguity_preferObject"], + "excludePlugins": ["lightscript", "bangCall", "enforceSubscriptIndentation", "match", "enhancedComprehension", "whiteblockOnly"], "throws": "Unexpected token, expected ; (1:2)" } diff --git a/test/fixtures/experimental/async-functions/object-default-params/expected.json b/test/fixtures/experimental/async-functions/object-default-params/expected.json index 29ed9c6f8f..162105c0b1 100644 --- a/test/fixtures/experimental/async-functions/object-default-params/expected.json +++ b/test/fixtures/experimental/async-functions/object-default-params/expected.json @@ -204,54 +204,22 @@ "skinny": false, "body": { "type": "BlockStatement", - "start": 32, + "start": 35, "end": 37, "loc": { "start": { "line": 1, - "column": 32 + "column": 35 }, "end": { "line": 1, "column": 37 } }, - "body": [ - { - "type": "ExpressionStatement", - "start": 35, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 37 - } - }, - "expression": { - "type": "ObjectExpression", - "start": 35, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 37 - } - }, - "properties": [] - } - } - ], + "body": [], "directives": [], "extra": { - "curly": false + "curly": true } } } diff --git a/test/fixtures/experimental/async-generators/for-await-async-context/options.json b/test/fixtures/experimental/async-generators/for-await-async-context/options.json index c6f1760ea1..47f02d05be 100644 --- a/test/fixtures/experimental/async-generators/for-await-async-context/options.json +++ b/test/fixtures/experimental/async-generators/for-await-async-context/options.json @@ -6,7 +6,7 @@ }, "noLsc": { "allPlugins": true, - "excludePlugins": ["lightscript", "match", "enhancedComprehension", "objectBlockAmbiguity_preferObject"] + "excludePlugins": ["lightscript", "match", "enhancedComprehension", "whiteblockOnly"] } } } diff --git a/test/fixtures/experimental/class-properties/asi-failure-computed/options.json b/test/fixtures/experimental/class-properties/asi-failure-computed/options.json index b0c2743880..c06f2f3766 100644 --- a/test/fixtures/experimental/class-properties/asi-failure-computed/options.json +++ b/test/fixtures/experimental/class-properties/asi-failure-computed/options.json @@ -6,7 +6,7 @@ }, "noLsc": { "allPlugins": true, - "excludePlugins": ["lightscript", "match", "enhancedComprehension", "objectBlockAmbiguity_preferObject"] + "excludePlugins": ["lightscript", "match", "enhancedComprehension", "whiteblockOnly"] } }, "plugins": ["classProperties"] diff --git a/test/fixtures/experimental/dynamic-import/top-level/expected.json b/test/fixtures/experimental/dynamic-import/top-level/expected.json index f598dba4bb..69c730a030 100644 --- a/test/fixtures/experimental/dynamic-import/top-level/expected.json +++ b/test/fixtures/experimental/dynamic-import/top-level/expected.json @@ -424,54 +424,22 @@ "skinny": false, "body": { "type": "BlockStatement", - "start": 105, + "start": 108, "end": 110, "loc": { "start": { "line": 6, - "column": 29 + "column": 32 }, "end": { "line": 6, "column": 34 } }, - "body": [ - { - "type": "ExpressionStatement", - "start": 108, - "end": 110, - "loc": { - "start": { - "line": 6, - "column": 32 - }, - "end": { - "line": 6, - "column": 34 - } - }, - "expression": { - "type": "ObjectExpression", - "start": 108, - "end": 110, - "loc": { - "start": { - "line": 6, - "column": 32 - }, - "end": { - "line": 6, - "column": 34 - } - }, - "properties": [] - } - } - ], + "body": [], "directives": [], "extra": { - "curly": false + "curly": true } } } diff --git a/test/fixtures/experimental/dynamic-import/variable-arguments/expected.json b/test/fixtures/experimental/dynamic-import/variable-arguments/expected.json index 1038e2ba8f..a2a2f00c75 100644 --- a/test/fixtures/experimental/dynamic-import/variable-arguments/expected.json +++ b/test/fixtures/experimental/dynamic-import/variable-arguments/expected.json @@ -231,54 +231,22 @@ "skinny": false, "body": { "type": "BlockStatement", - "start": 59, + "start": 62, "end": 64, "loc": { "start": { "line": 2, - "column": 28 + "column": 31 }, "end": { "line": 2, "column": 33 } }, - "body": [ - { - "type": "ExpressionStatement", - "start": 62, - "end": 64, - "loc": { - "start": { - "line": 2, - "column": 31 - }, - "end": { - "line": 2, - "column": 33 - } - }, - "expression": { - "type": "ObjectExpression", - "start": 62, - "end": 64, - "loc": { - "start": { - "line": 2, - "column": 31 - }, - "end": { - "line": 2, - "column": 33 - } - }, - "properties": [] - } - } - ], + "body": [], "directives": [], "extra": { - "curly": false + "curly": true } } } diff --git a/test/fixtures/experimental/object-rest-spread/5/options.json b/test/fixtures/experimental/object-rest-spread/5/options.json index fb630a8104..968c355120 100644 --- a/test/fixtures/experimental/object-rest-spread/5/options.json +++ b/test/fixtures/experimental/object-rest-spread/5/options.json @@ -5,7 +5,7 @@ }, "noLsc": { "allPlugins": true, - "excludePlugins": ["lightscript", "match", "enhancedComprehension", "objectBlockAmbiguity_preferObject"] + "excludePlugins": ["lightscript", "match", "enhancedComprehension", "whiteblockOnly"] } } } diff --git a/test/fixtures/experimental/options.json b/test/fixtures/experimental/options.json index 60bbeba2ff..45796bb70b 100644 --- a/test/fixtures/experimental/options.json +++ b/test/fixtures/experimental/options.json @@ -2,7 +2,7 @@ "alternatives": { "all": { "allPlugins": true, - "excludePlugins": ["estree"] + "excludePlugins": ["whiteblockOnly"] } } } diff --git a/test/fixtures/flow/comment/spread/expected.lightscript.json b/test/fixtures/flow/comment/spread/expected.lightscript.json deleted file mode 100644 index 9bb210e280..0000000000 --- a/test/fixtures/flow/comment/spread/expected.lightscript.json +++ /dev/null @@ -1,314 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 84, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 84, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "sourceType": "module", - "body": [ - { - "type": "FunctionDeclaration", - "start": 9, - "end": 84, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "start": 18, - "end": 46, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 37 - }, - "identifierName": "commentsAttachedToIdentifier" - }, - "name": "commentsAttachedToIdentifier", - "leadingComments": null - }, - "generator": false, - "expression": false, - "async": false, - "params": [], - "body": { - "type": "BlockStatement", - "start": 49, - "end": 84, - "loc": { - "start": { - "line": 2, - "column": 40 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "body": [ - { - "type": "VariableDeclaration", - "start": 53, - "end": 82, - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 31 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 57, - "end": 81, - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 3, - "column": 30 - } - }, - "id": { - "type": "Identifier", - "start": 57, - "end": 58, - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 3, - "column": 7 - }, - "identifierName": "x" - }, - "name": "x" - }, - "init": { - "type": "ArrowFunctionExpression", - "start": 61, - "end": 81, - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 30 - } - }, - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "RestElement", - "start": 62, - "end": 74, - "loc": { - "start": { - "line": 3, - "column": 11 - }, - "end": { - "line": 3, - "column": 23 - } - }, - "argument": { - "type": "Identifier", - "start": 65, - "end": 69, - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 18 - }, - "identifierName": "args" - }, - "name": "args" - }, - "typeAnnotation": { - "type": "TypeAnnotation", - "start": 69, - "end": 74, - "loc": { - "start": { - "line": 3, - "column": 18 - }, - "end": { - "line": 3, - "column": 23 - } - }, - "typeAnnotation": { - "type": "AnyTypeAnnotation", - "start": 71, - "end": 74, - "loc": { - "start": { - "line": 3, - "column": 20 - }, - "end": { - "line": 3, - "column": 23 - } - } - } - } - } - ], - "skinny": false, - "body": { - "type": "BlockStatement", - "start": 76, - "end": 81, - "loc": { - "start": { - "line": 3, - "column": 25 - }, - "end": { - "line": 3, - "column": 30 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 79, - "end": 81, - "loc": { - "start": { - "line": 3, - "column": 28 - }, - "end": { - "line": 3, - "column": 30 - } - }, - "expression": { - "type": "ObjectExpression", - "start": 79, - "end": 81, - "loc": { - "start": { - "line": 3, - "column": 28 - }, - "end": { - "line": 3, - "column": 30 - } - }, - "properties": [] - } - } - ], - "directives": [], - "extra": { - "curly": false - } - } - } - } - ], - "kind": "var" - } - ], - "directives": [], - "extra": { - "curly": true - } - }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": " hi ", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } - } - ] - } - ], - "directives": [] - }, - "comments": [ - { - "type": "CommentBlock", - "value": " hi ", - "start": 0, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } - } - ] -} \ No newline at end of file diff --git a/test/fixtures/flow/optional-type/1/expected.lightscript.json b/test/fixtures/flow/optional-type/1/expected.lightscript.json deleted file mode 100644 index 3bf74267b7..0000000000 --- a/test/fixtures/flow/optional-type/1/expected.lightscript.json +++ /dev/null @@ -1,176 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "sourceType": "module", - "body": [ - { - "type": "VariableDeclaration", - "start": 0, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 6, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "id": { - "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "f" - }, - "name": "f" - }, - "init": { - "type": "ArrowFunctionExpression", - "start": 10, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "x" - }, - "name": "x", - "optional": true - } - ], - "skinny": false, - "body": { - "type": "BlockStatement", - "start": 15, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 18, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "expression": { - "type": "ObjectExpression", - "start": 18, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "properties": [] - } - } - ], - "directives": [], - "extra": { - "curly": false - } - } - } - } - ], - "kind": "const" - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/test/fixtures/flow/optional-type/3/expected.lightscript.json b/test/fixtures/flow/optional-type/3/expected.lightscript.json deleted file mode 100644 index 707f5e2205..0000000000 --- a/test/fixtures/flow/optional-type/3/expected.lightscript.json +++ /dev/null @@ -1,274 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "sourceType": "module", - "body": [ - { - "type": "VariableDeclaration", - "start": 0, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 6, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "id": { - "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "f" - }, - "name": "f" - }, - "init": { - "type": "ArrowFunctionExpression", - "start": 10, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "x" - }, - "name": "x", - "optional": true - }, - { - "type": "AssignmentPattern", - "start": 15, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "left": { - "type": "Identifier", - "start": 15, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "y" - }, - "name": "y", - "optional": true, - "typeAnnotation": { - "type": "TypeAnnotation", - "start": 17, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "typeAnnotation": { - "type": "GenericTypeAnnotation", - "start": 18, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "typeParameters": null, - "id": { - "type": "Identifier", - "start": 18, - "end": 24, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 24 - }, - "identifierName": "Object" - }, - "name": "Object" - } - } - } - }, - "right": { - "type": "ObjectExpression", - "start": 27, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "properties": [] - }, - "isNowAssign": false - } - ], - "skinny": false, - "body": { - "type": "BlockStatement", - "start": 31, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 34, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "expression": { - "type": "ObjectExpression", - "start": 34, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "properties": [] - } - } - ], - "directives": [], - "extra": { - "curly": false - } - } - } - } - ], - "kind": "const" - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/test/fixtures/flow/optional-type/4/expected.lightscript.json b/test/fixtures/flow/optional-type/4/expected.lightscript.json deleted file mode 100644 index 7f1159f1f5..0000000000 --- a/test/fixtures/flow/optional-type/4/expected.lightscript.json +++ /dev/null @@ -1,191 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "sourceType": "module", - "body": [ - { - "type": "VariableDeclaration", - "start": 0, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 6, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "id": { - "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "f" - }, - "name": "f" - }, - "init": { - "type": "ArrowFunctionExpression", - "start": 10, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "RestElement", - "start": 11, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "argument": { - "type": "Identifier", - "start": 14, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "identifierName": "x" - }, - "name": "x" - }, - "optional": true - } - ], - "skinny": false, - "body": { - "type": "BlockStatement", - "start": 18, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 21, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "expression": { - "type": "ObjectExpression", - "start": 21, - "end": 23, - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "properties": [] - } - } - ], - "directives": [], - "extra": { - "curly": false - } - } - } - } - ], - "kind": "const" - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/test/fixtures/flow/options.json b/test/fixtures/flow/options.json index e486e03952..3b7e170016 100644 --- a/test/fixtures/flow/options.json +++ b/test/fixtures/flow/options.json @@ -4,12 +4,13 @@ "alternatives": { "all": { "allPlugins": true, + "excludePlugins": ["whiteblockOnly"], "optionsOverride": "options.lightscript.json", "expected": "expected.lightscript.json" }, "noLsc": { "allPlugins": true, - "excludePlugins": ["lightscript", "match", "enhancedComprehension", "objectBlockAmbiguity_preferObject"] + "excludePlugins": ["lightscript", "match", "enhancedComprehension", "whiteblockOnly"] } } } diff --git a/test/fixtures/flow/regression/issue-336/expected.lightscript.json b/test/fixtures/flow/regression/issue-336/expected.lightscript.json deleted file mode 100644 index 58aaab98cb..0000000000 --- a/test/fixtures/flow/regression/issue-336/expected.lightscript.json +++ /dev/null @@ -1,285 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 48 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 48 - } - }, - "sourceType": "module", - "body": [ - { - "type": "VariableDeclaration", - "start": 0, - "end": 48, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 48 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 6, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 47 - } - }, - "id": { - "type": "Identifier", - "start": 6, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 8 - }, - "identifierName": "fn" - }, - "name": "fn" - }, - "init": { - "type": "ArrowFunctionExpression", - "start": 11, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 47 - } - }, - "returnType": { - "type": "TypeAnnotation", - "start": 26, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 41 - } - }, - "typeAnnotation": { - "type": "GenericTypeAnnotation", - "start": 28, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 41 - } - }, - "typeParameters": { - "type": "TypeParameterInstantiation", - "start": 35, - "end": 41, - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 41 - } - }, - "params": [ - { - "type": "VoidTypeAnnotation", - "start": 36, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 40 - } - } - } - ] - }, - "id": { - "type": "Identifier", - "start": 28, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 35 - }, - "identifierName": "Promise" - }, - "name": "Promise" - } - } - }, - "id": null, - "generator": false, - "expression": false, - "async": true, - "params": [ - { - "type": "Identifier", - "start": 18, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 25 - }, - "identifierName": "a" - }, - "name": "a", - "optional": true, - "typeAnnotation": { - "type": "TypeAnnotation", - "start": 20, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "typeAnnotation": { - "type": "AnyTypeAnnotation", - "start": 22, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 25 - } - } - } - } - } - ], - "skinny": false, - "body": { - "type": "BlockStatement", - "start": 42, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 42 - }, - "end": { - "line": 1, - "column": 47 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 45, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 45 - }, - "end": { - "line": 1, - "column": 47 - } - }, - "expression": { - "type": "ObjectExpression", - "start": 45, - "end": 47, - "loc": { - "start": { - "line": 1, - "column": 45 - }, - "end": { - "line": 1, - "column": 47 - } - }, - "properties": [] - } - } - ], - "directives": [], - "extra": { - "curly": false - } - } - } - } - ], - "kind": "const" - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/test/fixtures/flow/regression/issue-92/expected.lightscript.json b/test/fixtures/flow/regression/issue-92/expected.lightscript.json deleted file mode 100644 index 93705537b5..0000000000 --- a/test/fixtures/flow/regression/issue-92/expected.lightscript.json +++ /dev/null @@ -1,241 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, - "sourceType": "module", - "body": [ - { - "type": "VariableDeclaration", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 6, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 40 - } - }, - "id": { - "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "a" - }, - "name": "a" - }, - "init": { - "type": "ArrowFunctionExpression", - "start": 10, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 40 - } - }, - "id": null, - "generator": false, - "expression": false, - "async": true, - "params": [ - { - "type": "AssignmentPattern", - "start": 17, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 33 - } - }, - "left": { - "type": "Identifier", - "start": 17, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 28 - }, - "identifierName": "foo" - }, - "name": "foo", - "typeAnnotation": { - "type": "TypeAnnotation", - "start": 20, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "typeAnnotation": { - "type": "StringTypeAnnotation", - "start": 22, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 28 - } - } - } - } - }, - "right": { - "type": "StringLiteral", - "start": 31, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 33 - } - }, - "extra": { - "rawValue": "", - "raw": "\"\"" - }, - "value": "" - }, - "isNowAssign": false - } - ], - "skinny": false, - "body": { - "type": "BlockStatement", - "start": 35, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 40 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 38, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 40 - } - }, - "expression": { - "type": "ObjectExpression", - "start": 38, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 40 - } - }, - "properties": [] - } - } - ], - "directives": [], - "extra": { - "curly": false - } - } - } - } - ], - "kind": "const" - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/test/fixtures/flow/type-annotations/102/expected.lightscript.json b/test/fixtures/flow/type-annotations/102/expected.lightscript.json deleted file mode 100644 index 3471ed9012..0000000000 --- a/test/fixtures/flow/type-annotations/102/expected.lightscript.json +++ /dev/null @@ -1,235 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 51 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 51 - } - }, - "sourceType": "module", - "body": [ - { - "type": "ExportDefaultDeclaration", - "start": 0, - "end": 51, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 51 - } - }, - "declaration": { - "type": "ArrowFunctionExpression", - "start": 15, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 50 - } - }, - "returnType": { - "type": "TypeAnnotation", - "start": 29, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 44 - } - }, - "typeAnnotation": { - "type": "GenericTypeAnnotation", - "start": 31, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 44 - } - }, - "typeParameters": { - "type": "TypeParameterInstantiation", - "start": 36, - "end": 44, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 44 - } - }, - "params": [ - { - "type": "StringTypeAnnotation", - "start": 37, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 43 - } - } - } - ] - }, - "id": { - "type": "Identifier", - "start": 31, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 36 - }, - "identifierName": "Array" - }, - "name": "Array" - } - }, - "predicate": null - }, - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "RestElement", - "start": 16, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "argument": { - "type": "Identifier", - "start": 19, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 28 - }, - "identifierName": "modifiers" - }, - "name": "modifiers" - } - } - ], - "skinny": false, - "body": { - "type": "BlockStatement", - "start": 45, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 45 - }, - "end": { - "line": 1, - "column": 50 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 48, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 48 - }, - "end": { - "line": 1, - "column": 50 - } - }, - "expression": { - "type": "ObjectExpression", - "start": 48, - "end": 50, - "loc": { - "start": { - "line": 1, - "column": 48 - }, - "end": { - "line": 1, - "column": 50 - } - }, - "properties": [] - } - } - ], - "directives": [], - "extra": { - "curly": false - } - } - } - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/test/fixtures/flow/type-annotations/103/expected.lightscript.json b/test/fixtures/flow/type-annotations/103/expected.lightscript.json deleted file mode 100644 index 4b8be1dd10..0000000000 --- a/test/fixtures/flow/type-annotations/103/expected.lightscript.json +++ /dev/null @@ -1,365 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 73, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 73 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 73, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 73 - } - }, - "sourceType": "module", - "body": [ - { - "type": "VariableDeclaration", - "start": 0, - "end": 73, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 73 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 6, - "end": 73, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 73 - } - }, - "id": { - "type": "Identifier", - "start": 6, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "parser" - }, - "name": "parser" - }, - "init": { - "type": "ArrowFunctionExpression", - "start": 15, - "end": 73, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 73 - } - }, - "returnType": { - "type": "TypeAnnotation", - "start": 65, - "end": 67, - "loc": { - "start": { - "line": 1, - "column": 65 - }, - "end": { - "line": 1, - "column": 67 - } - }, - "typeAnnotation": { - "type": "GenericTypeAnnotation", - "start": 66, - "end": 67, - "loc": { - "start": { - "line": 1, - "column": 66 - }, - "end": { - "line": 1, - "column": 67 - } - }, - "typeParameters": null, - "id": { - "type": "Identifier", - "start": 66, - "end": 67, - "loc": { - "start": { - "line": 1, - "column": 66 - }, - "end": { - "line": 1, - "column": 67 - }, - "identifierName": "a" - }, - "name": "a" - } - }, - "predicate": null - }, - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "Identifier", - "start": 16, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 32 - }, - "identifierName": "rootPath" - }, - "name": "rootPath", - "typeAnnotation": { - "type": "TypeAnnotation", - "start": 24, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 32 - } - }, - "typeAnnotation": { - "type": "StringTypeAnnotation", - "start": 26, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 32 - } - } - } - } - }, - { - "type": "RestElement", - "start": 34, - "end": 64, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 64 - } - }, - "argument": { - "type": "Identifier", - "start": 37, - "end": 49, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 49 - }, - "identifierName": "filesToParse" - }, - "name": "filesToParse" - }, - "typeAnnotation": { - "type": "TypeAnnotation", - "start": 49, - "end": 64, - "loc": { - "start": { - "line": 1, - "column": 49 - }, - "end": { - "line": 1, - "column": 64 - } - }, - "typeAnnotation": { - "type": "GenericTypeAnnotation", - "start": 51, - "end": 64, - "loc": { - "start": { - "line": 1, - "column": 51 - }, - "end": { - "line": 1, - "column": 64 - } - }, - "typeParameters": { - "type": "TypeParameterInstantiation", - "start": 56, - "end": 64, - "loc": { - "start": { - "line": 1, - "column": 56 - }, - "end": { - "line": 1, - "column": 64 - } - }, - "params": [ - { - "type": "StringTypeAnnotation", - "start": 57, - "end": 63, - "loc": { - "start": { - "line": 1, - "column": 57 - }, - "end": { - "line": 1, - "column": 63 - } - } - } - ] - }, - "id": { - "type": "Identifier", - "start": 51, - "end": 56, - "loc": { - "start": { - "line": 1, - "column": 51 - }, - "end": { - "line": 1, - "column": 56 - }, - "identifierName": "Array" - }, - "name": "Array" - } - } - } - } - ], - "skinny": false, - "body": { - "type": "BlockStatement", - "start": 68, - "end": 73, - "loc": { - "start": { - "line": 1, - "column": 68 - }, - "end": { - "line": 1, - "column": 73 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 71, - "end": 73, - "loc": { - "start": { - "line": 1, - "column": 71 - }, - "end": { - "line": 1, - "column": 73 - } - }, - "expression": { - "type": "ObjectExpression", - "start": 71, - "end": 73, - "loc": { - "start": { - "line": 1, - "column": 71 - }, - "end": { - "line": 1, - "column": 73 - } - }, - "properties": [] - } - } - ], - "directives": [], - "extra": { - "curly": false - } - } - } - } - ], - "kind": "const" - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/test/fixtures/flow/type-annotations/107/expected.lightscript.json b/test/fixtures/flow/type-annotations/107/expected.lightscript.json deleted file mode 100644 index 8aa15a7096..0000000000 --- a/test/fixtures/flow/type-annotations/107/expected.lightscript.json +++ /dev/null @@ -1,296 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "sourceType": "module", - "body": [ - { - "type": "VariableDeclaration", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 4, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "id": { - "type": "Identifier", - "start": 4, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "identifierName": "x" - }, - "name": "x" - }, - "init": { - "type": "ArrowFunctionExpression", - "start": 8, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "AssignmentPattern", - "start": 9, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "left": { - "type": "ObjectPattern", - "start": 9, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "properties": [ - { - "type": "ObjectProperty", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "a" - }, - "name": "a" - }, - "value": { - "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "a" - }, - "name": "a" - }, - "extra": { - "shorthand": true - } - } - ], - "typeAnnotation": { - "type": "TypeAnnotation", - "start": 15, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "typeAnnotation": { - "type": "AnyTypeAnnotation", - "start": 17, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 20 - } - } - } - } - }, - "right": { - "type": "StringLiteral", - "start": 23, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "extra": { - "rawValue": "foo", - "raw": "'foo'" - }, - "value": "foo" - }, - "isNowAssign": false - } - ], - "skinny": false, - "body": { - "type": "BlockStatement", - "start": 30, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 33, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "expression": { - "type": "ObjectExpression", - "start": 33, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "properties": [] - } - } - ], - "directives": [], - "extra": { - "curly": false - } - } - } - } - ], - "kind": "var" - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/test/fixtures/flow/type-annotations/69/expected.lightscript.json b/test/fixtures/flow/type-annotations/69/expected.lightscript.json deleted file mode 100644 index 241583abcf..0000000000 --- a/test/fixtures/flow/type-annotations/69/expected.lightscript.json +++ /dev/null @@ -1,288 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 42 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 42 - } - }, - "sourceType": "module", - "body": [ - { - "type": "VariableDeclaration", - "start": 0, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 42 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 4, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 42 - } - }, - "id": { - "type": "Identifier", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "foo" - }, - "name": "foo" - }, - "init": { - "type": "ArrowFunctionExpression", - "start": 10, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 42 - } - }, - "id": null, - "generator": false, - "expression": false, - "async": true, - "params": [ - { - "type": "Identifier", - "start": 17, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 25 - }, - "identifierName": "foo" - }, - "name": "foo", - "typeAnnotation": { - "type": "TypeAnnotation", - "start": 20, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "typeAnnotation": { - "type": "GenericTypeAnnotation", - "start": 22, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "typeParameters": null, - "id": { - "type": "Identifier", - "start": 22, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 25 - }, - "identifierName": "bar" - }, - "name": "bar" - } - } - } - }, - { - "type": "Identifier", - "start": 27, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 35 - }, - "identifierName": "bar" - }, - "name": "bar", - "typeAnnotation": { - "type": "TypeAnnotation", - "start": 30, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "typeAnnotation": { - "type": "GenericTypeAnnotation", - "start": 32, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "typeParameters": null, - "id": { - "type": "Identifier", - "start": 32, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 35 - }, - "identifierName": "foo" - }, - "name": "foo" - } - } - } - } - ], - "skinny": false, - "body": { - "type": "BlockStatement", - "start": 37, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 42 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 40, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 42 - } - }, - "expression": { - "type": "ObjectExpression", - "start": 40, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 42 - } - }, - "properties": [] - } - } - ], - "directives": [], - "extra": { - "curly": false - } - } - } - } - ], - "kind": "var" - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/test/fixtures/flow/type-annotations/79/expected.lightscript.json b/test/fixtures/flow/type-annotations/79/expected.lightscript.json deleted file mode 100644 index aa54ae148a..0000000000 --- a/test/fixtures/flow/type-annotations/79/expected.lightscript.json +++ /dev/null @@ -1,255 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 43 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 43 - } - }, - "sourceType": "module", - "body": [ - { - "type": "VariableDeclaration", - "start": 0, - "end": 43, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 43 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 4, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 42 - } - }, - "id": { - "type": "Identifier", - "start": 4, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "foo" - }, - "name": "foo" - }, - "init": { - "type": "ConditionalExpression", - "start": 10, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 42 - } - }, - "test": { - "type": "Identifier", - "start": 10, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "bar" - }, - "name": "bar" - }, - "consequent": { - "type": "ArrowFunctionExpression", - "start": 16, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "returnType": { - "type": "TypeAnnotation", - "start": 22, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "typeAnnotation": { - "type": "NumberTypeAnnotation", - "start": 24, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 30 - } - } - }, - "predicate": null - }, - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "Identifier", - "start": 17, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 20 - }, - "identifierName": "foo" - }, - "name": "foo" - } - ], - "skinny": false, - "body": { - "type": "BlockStatement", - "start": 31, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 34, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "expression": { - "type": "ObjectExpression", - "start": 34, - "end": 36, - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "properties": [] - } - } - ], - "directives": [], - "extra": { - "curly": false - } - } - }, - "alternate": { - "type": "Identifier", - "start": 39, - "end": 42, - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 42 - }, - "identifierName": "baz" - }, - "name": "baz" - } - } - } - ], - "kind": "var" - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/test/fixtures/flow/type-annotations/arrow-func-return-newline/expected.lightscript.json b/test/fixtures/flow/type-annotations/arrow-func-return-newline/expected.lightscript.json deleted file mode 100644 index ab4902118c..0000000000 --- a/test/fixtures/flow/type-annotations/arrow-func-return-newline/expected.lightscript.json +++ /dev/null @@ -1,236 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 14 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 14 - } - }, - "sourceType": "module", - "body": [ - { - "type": "VariableDeclaration", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 14 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 6, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 2, - "column": 14 - } - }, - "id": { - "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "x" - }, - "name": "x" - }, - "init": { - "type": "ArrowFunctionExpression", - "start": 10, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 2, - "column": 14 - } - }, - "returnType": { - "type": "TypeAnnotation", - "start": 24, - "end": 32, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - }, - "typeAnnotation": { - "type": "NumberTypeAnnotation", - "start": 26, - "end": 32, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 8 - } - } - }, - "predicate": null - }, - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "Identifier", - "start": 11, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 22 - }, - "identifierName": "foo" - }, - "name": "foo", - "typeAnnotation": { - "type": "TypeAnnotation", - "start": 14, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "typeAnnotation": { - "type": "StringTypeAnnotation", - "start": 16, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 22 - } - } - } - } - } - ], - "skinny": false, - "body": { - "type": "BlockStatement", - "start": 33, - "end": 38, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 14 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 36, - "end": 38, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 14 - } - }, - "expression": { - "type": "ObjectExpression", - "start": 36, - "end": 38, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 14 - } - }, - "properties": [] - } - } - ], - "directives": [], - "extra": { - "curly": false - } - } - } - } - ], - "kind": "const" - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/test/fixtures/flow/type-annotations/existential-type-param-2/expected.lightscript.json b/test/fixtures/flow/type-annotations/existential-type-param-2/expected.lightscript.json deleted file mode 100644 index 803d946ecf..0000000000 --- a/test/fixtures/flow/type-annotations/existential-type-param-2/expected.lightscript.json +++ /dev/null @@ -1,299 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, - "sourceType": "module", - "body": [ - { - "type": "VariableDeclaration", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 4, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 38 - } - }, - "id": { - "type": "Identifier", - "start": 4, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "f" - }, - "name": "f", - "typeAnnotation": { - "type": "TypeAnnotation", - "start": 6, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "typeAnnotation": { - "type": "ExistentialTypeParam", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - } - } - }, - "init": { - "type": "ArrowFunctionExpression", - "start": 12, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 38 - } - }, - "returnType": { - "type": "TypeAnnotation", - "start": 27, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 32 - } - }, - "typeAnnotation": { - "type": "ExistentialTypeParam", - "start": 30, - "end": 31, - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - } - } - }, - "predicate": null - }, - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "Identifier", - "start": 13, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 25 - }, - "identifierName": "x" - }, - "name": "x", - "typeAnnotation": { - "type": "TypeAnnotation", - "start": 15, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "typeAnnotation": { - "type": "UnionTypeAnnotation", - "start": 17, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "types": [ - { - "type": "NullLiteralTypeAnnotation", - "start": 17, - "end": 21, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "value": true - }, - { - "type": "ExistentialTypeParam", - "start": 24, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - } - } - ] - } - } - } - ], - "skinny": false, - "body": { - "type": "BlockStatement", - "start": 33, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 38 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 36, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 38 - } - }, - "expression": { - "type": "ObjectExpression", - "start": 36, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 38 - } - }, - "properties": [] - } - } - ], - "directives": [], - "extra": { - "curly": false - } - } - } - } - ], - "kind": "let" - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/test/fixtures/jsx/options.json b/test/fixtures/jsx/options.json index 85570ccf0b..04d3cbd3e7 100644 --- a/test/fixtures/jsx/options.json +++ b/test/fixtures/jsx/options.json @@ -3,7 +3,7 @@ "alternatives": { "all": { "allPlugins": true, - "excludePlugins": ["estree"] + "excludePlugins": ["whiteblockOnly"] } } } diff --git a/test/fixtures/lightscript/arrow-expressions/skinny-curly/expected.json b/test/fixtures/lightscript/arrow-expressions/skinny-curly/expected.json index 750de95e35..0505dbb550 100644 --- a/test/fixtures/lightscript/arrow-expressions/skinny-curly/expected.json +++ b/test/fixtures/lightscript/arrow-expressions/skinny-curly/expected.json @@ -64,12 +64,12 @@ "skinny": true, "body": { "type": "BlockStatement", - "start": 3, + "start": 6, "end": 13, "loc": { "start": { "line": 1, - "column": 3 + "column": 6 }, "end": { "line": 3, @@ -79,95 +79,40 @@ "body": [ { "type": "ExpressionStatement", - "start": 6, - "end": 13, + "start": 10, + "end": 11, "loc": { "start": { - "line": 1, - "column": 6 + "line": 2, + "column": 2 }, "end": { - "line": 3, - "column": 1 + "line": 2, + "column": 3 } }, "expression": { - "type": "ObjectExpression", - "start": 6, - "end": 13, + "type": "Identifier", + "start": 10, + "end": 11, "loc": { "start": { - "line": 1, - "column": 6 + "line": 2, + "column": 2 }, "end": { - "line": 3, - "column": 1 - } + "line": 2, + "column": 3 + }, + "identifierName": "x" }, - "properties": [ - { - "type": "ObjectProperty", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 3 - } - }, - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 3 - }, - "identifierName": "x" - }, - "name": "x" - }, - "value": { - "type": "Identifier", - "start": 10, - "end": 11, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 3 - }, - "identifierName": "x" - }, - "name": "x" - }, - "extra": { - "shorthand": true - } - } - ] + "name": "x" } } ], "directives": [], "extra": { - "curly": false + "curly": true } } } diff --git a/test/fixtures/lightscript/arrow-expressions/skinny-curly/options.json b/test/fixtures/lightscript/arrow-expressions/skinny-curly/options.json index 8e44176f95..c36a99f661 100644 --- a/test/fixtures/lightscript/arrow-expressions/skinny-curly/options.json +++ b/test/fixtures/lightscript/arrow-expressions/skinny-curly/options.json @@ -1,7 +1,7 @@ { "alternatives": { "objectBlockAmbiguity": { - "excludePlugins": ["objectBlockAmbiguity_preferObject"], + "excludePlugins": ["whiteblockOnly"], "expected": "expected.objectBlockAmbiguity.json" } } diff --git a/test/fixtures/es2015/uncategorised/179/expected.lightscript.json b/test/fixtures/lightscript/auto-const/not-newline-object-malformed-unfortunate/expected.whiteblock.json similarity index 54% rename from test/fixtures/es2015/uncategorised/179/expected.lightscript.json rename to test/fixtures/lightscript/auto-const/not-newline-object-malformed-unfortunate/expected.whiteblock.json index cbda12e848..e060b1e68f 100644 --- a/test/fixtures/es2015/uncategorised/179/expected.lightscript.json +++ b/test/fixtures/lightscript/auto-const/not-newline-object-malformed-unfortunate/expected.whiteblock.json @@ -1,7 +1,7 @@ { "type": "File", "start": 0, - "end": 19, + "end": 14, "loc": { "start": { "line": 1, @@ -9,13 +9,13 @@ }, "end": { "line": 1, - "column": 19 + "column": 14 } }, "program": { "type": "Program", "start": 0, - "end": 19, + "end": 14, "loc": { "start": { "line": 1, @@ -23,7 +23,7 @@ }, "end": { "line": 1, - "column": 19 + "column": 14 } }, "sourceType": "script", @@ -31,7 +31,7 @@ { "type": "ExpressionStatement", "start": 0, - "end": 19, + "end": 2, "loc": { "start": { "line": 1, @@ -39,13 +39,13 @@ }, "end": { "line": 1, - "column": 19 + "column": 2 } }, "expression": { - "type": "ArrowFunctionExpression", + "type": "Identifier", "start": 0, - "end": 19, + "end": 1, "loc": { "start": { "line": 1, @@ -53,41 +53,73 @@ }, "end": { "line": 1, - "column": 19 - } + "column": 1 + }, + "identifierName": "x" }, - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [ - { + "name": "x" + } + }, + { + "type": "VariableDeclaration", + "start": 3, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "kind": "const", + "extra": { + "implicit": true + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 3, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "id": { "type": "ObjectPattern", - "start": 1, - "end": 6, + "start": 3, + "end": 9, "loc": { "start": { "line": 1, - "column": 1 + "column": 3 }, "end": { "line": 1, - "column": 6 + "column": 9 } }, "properties": [ { "type": "ObjectProperty", - "start": 3, - "end": 4, + "start": 4, + "end": 5, "loc": { "start": { "line": 1, - "column": 3 + "column": 4 }, "end": { "line": 1, - "column": 4 + "column": 5 } }, "method": false, @@ -95,16 +127,16 @@ "computed": false, "key": { "type": "Identifier", - "start": 3, - "end": 4, + "start": 4, + "end": 5, "loc": { "start": { "line": 1, - "column": 3 + "column": 4 }, "end": { "line": 1, - "column": 4 + "column": 5 }, "identifierName": "a" }, @@ -112,16 +144,16 @@ }, "value": { "type": "Identifier", - "start": 3, - "end": 4, + "start": 4, + "end": 5, "loc": { "start": { "line": 1, - "column": 3 + "column": 4 }, "end": { "line": 1, - "column": 4 + "column": 5 }, "identifierName": "a" }, @@ -130,96 +162,82 @@ "extra": { "shorthand": true } + }, + { + "type": "ObjectProperty", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + }, + "identifierName": "b" + }, + "name": "b" + }, + "value": { + "type": "Identifier", + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + }, + "identifierName": "b" + }, + "name": "b" + }, + "extra": { + "shorthand": true + } } ] }, - { - "type": "RestElement", - "start": 8, - "end": 12, + "init": { + "type": "ObjectExpression", + "start": 12, + "end": 14, "loc": { "start": { "line": 1, - "column": 8 + "column": 12 }, "end": { "line": 1, - "column": 12 + "column": 14 } }, - "argument": { - "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "b" - }, - "name": "b" - } - } - ], - "skinny": false, - "body": { - "type": "BlockStatement", - "start": 14, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 17, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "expression": { - "type": "ObjectExpression", - "start": 17, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "properties": [] - } - } - ], - "directives": [], - "extra": { - "curly": false + "properties": [] } } - } + ] } ], "directives": [] diff --git a/test/fixtures/lightscript/auto-const/not-newline-object-malformed-unfortunate/options.json b/test/fixtures/lightscript/auto-const/not-newline-object-malformed-unfortunate/options.json index e347d34551..82112095f4 100644 --- a/test/fixtures/lightscript/auto-const/not-newline-object-malformed-unfortunate/options.json +++ b/test/fixtures/lightscript/auto-const/not-newline-object-malformed-unfortunate/options.json @@ -5,8 +5,12 @@ }, "noSeqExprParens": { "allPlugins": true, - "excludePlugins": ["existentialExpression", "safeCallExpression", "enhancedComprehension", "seqExprRequiresParen", "bangCall"], + "excludePlugins": ["existentialExpression", "safeCallExpression", "enhancedComprehension", "seqExprRequiresParen", "bangCall", "whiteblockOnly"], "throws": "Unexpected token (1:10)" + }, + "whiteblock": { + "allPlugins": true, + "expected": "expected.whiteblock.json" } } } diff --git a/test/fixtures/lightscript/commaless/arrow-expr-params/expected.json b/test/fixtures/lightscript/commaless/arrow-expr-params/expected.json index f5e81dc1f2..ca10c8f91f 100644 --- a/test/fixtures/lightscript/commaless/arrow-expr-params/expected.json +++ b/test/fixtures/lightscript/commaless/arrow-expr-params/expected.json @@ -99,54 +99,22 @@ "skinny": false, "body": { "type": "BlockStatement", - "start": 12, + "start": 15, "end": 17, "loc": { "start": { "line": 4, - "column": 2 + "column": 5 }, "end": { "line": 4, "column": 7 } }, - "body": [ - { - "type": "ExpressionStatement", - "start": 15, - "end": 17, - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 7 - } - }, - "expression": { - "type": "ObjectExpression", - "start": 15, - "end": 17, - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 7 - } - }, - "properties": [] - } - } - ], + "body": [], "directives": [], "extra": { - "curly": false + "curly": true } } } diff --git a/test/fixtures/lightscript/for-in/now/expected.json b/test/fixtures/lightscript/for-in/now/expected.json index aadc64121b..60e6db5e1e 100644 --- a/test/fixtures/lightscript/for-in/now/expected.json +++ b/test/fixtures/lightscript/for-in/now/expected.json @@ -79,54 +79,22 @@ }, "body": { "type": "BlockStatement", - "start": 16, + "start": 18, "end": 20, "loc": { "start": { "line": 1, - "column": 16 + "column": 18 }, "end": { "line": 1, "column": 20 } }, - "body": [ - { - "type": "ExpressionStatement", - "start": 18, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "expression": { - "type": "ObjectExpression", - "start": 18, - "end": 20, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "properties": [] - } - } - ], + "body": [], "directives": [], "extra": { - "curly": false + "curly": true } } } diff --git a/test/fixtures/lightscript/for-in/now/expected.objectBlockAmbiguity.json b/test/fixtures/lightscript/for-in/now/expected.whiteblock.json similarity index 66% rename from test/fixtures/lightscript/for-in/now/expected.objectBlockAmbiguity.json rename to test/fixtures/lightscript/for-in/now/expected.whiteblock.json index 60e6db5e1e..aadc64121b 100644 --- a/test/fixtures/lightscript/for-in/now/expected.objectBlockAmbiguity.json +++ b/test/fixtures/lightscript/for-in/now/expected.whiteblock.json @@ -79,22 +79,54 @@ }, "body": { "type": "BlockStatement", - "start": 18, + "start": 16, "end": 20, "loc": { "start": { "line": 1, - "column": 18 + "column": 16 }, "end": { "line": 1, "column": 20 } }, - "body": [], + "body": [ + { + "type": "ExpressionStatement", + "start": 18, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "expression": { + "type": "ObjectExpression", + "start": 18, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "properties": [] + } + } + ], "directives": [], "extra": { - "curly": true + "curly": false } } } diff --git a/test/fixtures/lightscript/for-in/now/options.json b/test/fixtures/lightscript/for-in/now/options.json index 8e44176f95..789ef9baa7 100644 --- a/test/fixtures/lightscript/for-in/now/options.json +++ b/test/fixtures/lightscript/for-in/now/options.json @@ -1,8 +1,8 @@ { "alternatives": { - "objectBlockAmbiguity": { - "excludePlugins": ["objectBlockAmbiguity_preferObject"], - "expected": "expected.objectBlockAmbiguity.json" + "whiteblock": { + "allPlugins": true, + "expected": "expected.whiteblock.json" } } } diff --git a/test/fixtures/lightscript/named-arrow-functions/skinny-curly/expected.json b/test/fixtures/lightscript/named-arrow-functions/skinny-curly/expected.json index 41348bfb9f..84fe23bc04 100644 --- a/test/fixtures/lightscript/named-arrow-functions/skinny-curly/expected.json +++ b/test/fixtures/lightscript/named-arrow-functions/skinny-curly/expected.json @@ -66,54 +66,22 @@ "skinny": true, "body": { "type": "BlockStatement", - "start": 5, + "start": 8, "end": 10, "loc": { "start": { "line": 1, - "column": 5 + "column": 8 }, "end": { "line": 1, "column": 10 } }, - "body": [ - { - "type": "ExpressionStatement", - "start": 8, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "expression": { - "type": "ObjectExpression", - "start": 8, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "properties": [] - } - } - ], + "body": [], "directives": [], "extra": { - "curly": false + "curly": true } } } diff --git a/test/fixtures/lightscript/named-arrow-functions/skinny-curly/expected.objectBlockAmbiguity.json b/test/fixtures/lightscript/named-arrow-functions/skinny-curly/expected.objectBlockAmbiguity.json deleted file mode 100644 index 84fe23bc04..0000000000 --- a/test/fixtures/lightscript/named-arrow-functions/skinny-curly/expected.objectBlockAmbiguity.json +++ /dev/null @@ -1,91 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "sourceType": "script", - "body": [ - { - "type": "NamedArrowDeclaration", - "start": 0, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "id": { - "type": "Identifier", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - }, - "identifierName": "fn" - }, - "name": "fn" - }, - "generator": false, - "expression": false, - "async": false, - "params": [], - "skinny": true, - "body": { - "type": "BlockStatement", - "start": 8, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "body": [], - "directives": [], - "extra": { - "curly": true - } - } - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/test/fixtures/lightscript/object-block-ambiguity/basic/expected.objectBlockAmbiguity.json b/test/fixtures/lightscript/named-arrow-functions/skinny-curly/expected.whiteblock.json similarity index 63% rename from test/fixtures/lightscript/object-block-ambiguity/basic/expected.objectBlockAmbiguity.json rename to test/fixtures/lightscript/named-arrow-functions/skinny-curly/expected.whiteblock.json index 69b001f468..41348bfb9f 100644 --- a/test/fixtures/lightscript/object-block-ambiguity/basic/expected.objectBlockAmbiguity.json +++ b/test/fixtures/lightscript/named-arrow-functions/skinny-curly/expected.whiteblock.json @@ -1,29 +1,29 @@ { "type": "File", "start": 0, - "end": 14, + "end": 10, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 3, - "column": 1 + "line": 1, + "column": 10 } }, "program": { "type": "Program", "start": 0, - "end": 14, + "end": 10, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 3, - "column": 1 + "line": 1, + "column": 10 } }, "sourceType": "script", @@ -31,21 +31,21 @@ { "type": "NamedArrowDeclaration", "start": 0, - "end": 14, + "end": 10, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 3, - "column": 1 + "line": 1, + "column": 10 } }, "id": { "type": "Identifier", "start": 0, - "end": 1, + "end": 2, "loc": { "start": { "line": 1, @@ -53,68 +53,67 @@ }, "end": { "line": 1, - "column": 1 + "column": 2 }, - "identifierName": "f" + "identifierName": "fn" }, - "name": "f" + "name": "fn" }, "generator": false, "expression": false, "async": false, "params": [], - "skinny": false, + "skinny": true, "body": { "type": "BlockStatement", - "start": 7, - "end": 14, + "start": 5, + "end": 10, "loc": { "start": { "line": 1, - "column": 7 + "column": 5 }, "end": { - "line": 3, - "column": 1 + "line": 1, + "column": 10 } }, "body": [ { "type": "ExpressionStatement", - "start": 11, - "end": 12, + "start": 8, + "end": 10, "loc": { "start": { - "line": 2, - "column": 2 + "line": 1, + "column": 8 }, "end": { - "line": 2, - "column": 3 + "line": 1, + "column": 10 } }, "expression": { - "type": "Identifier", - "start": 11, - "end": 12, + "type": "ObjectExpression", + "start": 8, + "end": 10, "loc": { "start": { - "line": 2, - "column": 2 + "line": 1, + "column": 8 }, "end": { - "line": 2, - "column": 3 - }, - "identifierName": "x" + "line": 1, + "column": 10 + } }, - "name": "x" + "properties": [] } } ], "directives": [], "extra": { - "curly": true + "curly": false } } } diff --git a/test/fixtures/lightscript/named-arrow-functions/skinny-curly/options.json b/test/fixtures/lightscript/named-arrow-functions/skinny-curly/options.json index 8e44176f95..789ef9baa7 100644 --- a/test/fixtures/lightscript/named-arrow-functions/skinny-curly/options.json +++ b/test/fixtures/lightscript/named-arrow-functions/skinny-curly/options.json @@ -1,8 +1,8 @@ { "alternatives": { - "objectBlockAmbiguity": { - "excludePlugins": ["objectBlockAmbiguity_preferObject"], - "expected": "expected.objectBlockAmbiguity.json" + "whiteblock": { + "allPlugins": true, + "expected": "expected.whiteblock.json" } } } diff --git a/test/fixtures/lightscript/object-block-ambiguity/basic/expected.json b/test/fixtures/lightscript/object-block-ambiguity/basic/expected.json index 770e43d7f1..69b001f468 100644 --- a/test/fixtures/lightscript/object-block-ambiguity/basic/expected.json +++ b/test/fixtures/lightscript/object-block-ambiguity/basic/expected.json @@ -66,12 +66,12 @@ "skinny": false, "body": { "type": "BlockStatement", - "start": 4, + "start": 7, "end": 14, "loc": { "start": { "line": 1, - "column": 4 + "column": 7 }, "end": { "line": 3, @@ -81,95 +81,40 @@ "body": [ { "type": "ExpressionStatement", - "start": 7, - "end": 14, + "start": 11, + "end": 12, "loc": { "start": { - "line": 1, - "column": 7 + "line": 2, + "column": 2 }, "end": { - "line": 3, - "column": 1 + "line": 2, + "column": 3 } }, "expression": { - "type": "ObjectExpression", - "start": 7, - "end": 14, + "type": "Identifier", + "start": 11, + "end": 12, "loc": { "start": { - "line": 1, - "column": 7 + "line": 2, + "column": 2 }, "end": { - "line": 3, - "column": 1 - } + "line": 2, + "column": 3 + }, + "identifierName": "x" }, - "properties": [ - { - "type": "ObjectProperty", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 3 - } - }, - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 3 - }, - "identifierName": "x" - }, - "name": "x" - }, - "value": { - "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 3 - }, - "identifierName": "x" - }, - "name": "x" - }, - "extra": { - "shorthand": true - } - } - ] + "name": "x" } } ], "directives": [], "extra": { - "curly": false + "curly": true } } } diff --git a/test/fixtures/lightscript/object-block-ambiguity/basic/expected.whiteblock.json b/test/fixtures/lightscript/object-block-ambiguity/basic/expected.whiteblock.json new file mode 100644 index 0000000000..770e43d7f1 --- /dev/null +++ b/test/fixtures/lightscript/object-block-ambiguity/basic/expected.whiteblock.json @@ -0,0 +1,179 @@ +{ + "type": "File", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "body": [ + { + "type": "NamedArrowDeclaration", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + }, + "identifierName": "f" + }, + "name": "f" + }, + "generator": false, + "expression": false, + "async": false, + "params": [], + "skinny": false, + "body": { + "type": "BlockStatement", + "start": 4, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 7, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "expression": { + "type": "ObjectExpression", + "start": 7, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + } + }, + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + }, + "identifierName": "x" + }, + "name": "x" + }, + "value": { + "type": "Identifier", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + }, + "identifierName": "x" + }, + "name": "x" + }, + "extra": { + "shorthand": true + } + } + ] + } + } + ], + "directives": [], + "extra": { + "curly": false + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/test/fixtures/lightscript/object-block-ambiguity/error-obj/options.json b/test/fixtures/lightscript/object-block-ambiguity/error-obj/options.json index 6cd8531092..0b7c1c9523 100644 --- a/test/fixtures/lightscript/object-block-ambiguity/error-obj/options.json +++ b/test/fixtures/lightscript/object-block-ambiguity/error-obj/options.json @@ -1,9 +1,9 @@ { "alternatives": { - "all": { + "whiteblock": { "throws": "Expected an Indent or Statement (7:6)" }, - "objectBlockAmbiguity": { + "all": { "throws": "Leading decorators must be attached to a class declaration (7:2)" } } diff --git a/test/fixtures/lightscript/object-block-ambiguity/if/expected.json b/test/fixtures/lightscript/object-block-ambiguity/if/expected.json index 0bac2c4603..5806448ace 100644 --- a/test/fixtures/lightscript/object-block-ambiguity/if/expected.json +++ b/test/fixtures/lightscript/object-block-ambiguity/if/expected.json @@ -61,12 +61,12 @@ }, "consequent": { "type": "BlockStatement", - "start": 4, + "start": 6, "end": 11, "loc": { "start": { "line": 1, - "column": 4 + "column": 6 }, "end": { "line": 1, @@ -76,105 +76,50 @@ "body": [ { "type": "ExpressionStatement", - "start": 6, - "end": 11, + "start": 8, + "end": 9, "loc": { "start": { "line": 1, - "column": 6 + "column": 8 }, "end": { "line": 1, - "column": 11 + "column": 9 } }, "expression": { - "type": "ObjectExpression", - "start": 6, - "end": 11, + "type": "Identifier", + "start": 8, + "end": 9, "loc": { "start": { "line": 1, - "column": 6 + "column": 8 }, "end": { "line": 1, - "column": 11 - } + "column": 9 + }, + "identifierName": "y" }, - "properties": [ - { - "type": "ObjectProperty", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "y" - }, - "name": "y" - }, - "value": { - "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "y" - }, - "name": "y" - }, - "extra": { - "shorthand": true - } - } - ] + "name": "y" } } ], "directives": [], "extra": { - "curly": false + "curly": true } }, "alternate": { "type": "BlockStatement", - "start": 16, + "start": 18, "end": 25, "loc": { "start": { "line": 1, - "column": 16 + "column": 18 }, "end": { "line": 3, @@ -184,95 +129,40 @@ "body": [ { "type": "ExpressionStatement", - "start": 18, - "end": 25, + "start": 22, + "end": 23, "loc": { "start": { - "line": 1, - "column": 18 + "line": 2, + "column": 2 }, "end": { - "line": 3, - "column": 1 + "line": 2, + "column": 3 } }, "expression": { - "type": "ObjectExpression", - "start": 18, - "end": 25, + "type": "Identifier", + "start": 22, + "end": 23, "loc": { "start": { - "line": 1, - "column": 18 + "line": 2, + "column": 2 }, "end": { - "line": 3, - "column": 1 - } + "line": 2, + "column": 3 + }, + "identifierName": "z" }, - "properties": [ - { - "type": "ObjectProperty", - "start": 22, - "end": 23, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 3 - } - }, - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "start": 22, - "end": 23, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 3 - }, - "identifierName": "z" - }, - "name": "z" - }, - "value": { - "type": "Identifier", - "start": 22, - "end": 23, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 3 - }, - "identifierName": "z" - }, - "name": "z" - }, - "extra": { - "shorthand": true - } - } - ] + "name": "z" } } ], "directives": [], "extra": { - "curly": false + "curly": true } } } diff --git a/test/fixtures/lightscript/object-block-ambiguity/if/expected.objectBlockAmbiguity.json b/test/fixtures/lightscript/object-block-ambiguity/if/expected.objectBlockAmbiguity.json deleted file mode 100644 index 5806448ace..0000000000 --- a/test/fixtures/lightscript/object-block-ambiguity/if/expected.objectBlockAmbiguity.json +++ /dev/null @@ -1,172 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "sourceType": "script", - "body": [ - { - "type": "IfStatement", - "start": 0, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "test": { - "type": "Identifier", - "start": 3, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "x" - }, - "name": "x" - }, - "consequent": { - "type": "BlockStatement", - "start": 6, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "expression": { - "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "identifierName": "y" - }, - "name": "y" - } - } - ], - "directives": [], - "extra": { - "curly": true - } - }, - "alternate": { - "type": "BlockStatement", - "start": 18, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 22, - "end": 23, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 3 - } - }, - "expression": { - "type": "Identifier", - "start": 22, - "end": 23, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 3 - }, - "identifierName": "z" - }, - "name": "z" - } - } - ], - "directives": [], - "extra": { - "curly": true - } - } - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/test/fixtures/es2015/uncategorised/158/expected.lightscript.json b/test/fixtures/lightscript/object-block-ambiguity/if/expected.whiteblock.json similarity index 50% rename from test/fixtures/es2015/uncategorised/158/expected.lightscript.json rename to test/fixtures/lightscript/object-block-ambiguity/if/expected.whiteblock.json index 9c46b7158e..0bac2c4603 100644 --- a/test/fixtures/es2015/uncategorised/158/expected.lightscript.json +++ b/test/fixtures/lightscript/object-block-ambiguity/if/expected.whiteblock.json @@ -1,107 +1,120 @@ { "type": "File", "start": 0, - "end": 23, + "end": 25, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 1, - "column": 23 + "line": 3, + "column": 1 } }, "program": { "type": "Program", "start": 0, - "end": 23, + "end": 25, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 1, - "column": 23 + "line": 3, + "column": 1 } }, "sourceType": "script", "body": [ { - "type": "ExpressionStatement", + "type": "IfStatement", "start": 0, - "end": 23, + "end": 25, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 1, - "column": 23 + "line": 3, + "column": 1 } }, - "expression": { - "type": "ArrowFunctionExpression", - "start": 1, - "end": 22, + "test": { + "type": "Identifier", + "start": 3, + "end": 4, "loc": { "start": { "line": 1, - "column": 1 + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + }, + "identifierName": "x" + }, + "name": "x" + }, + "consequent": { + "type": "BlockStatement", + "start": 4, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 4 }, "end": { "line": 1, - "column": 22 + "column": 11 } }, - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [ + "body": [ { - "type": "AssignmentPattern", - "start": 2, - "end": 15, + "type": "ExpressionStatement", + "start": 6, + "end": 11, "loc": { "start": { "line": 1, - "column": 2 + "column": 6 }, "end": { "line": 1, - "column": 15 + "column": 11 } }, - "left": { - "type": "ObjectPattern", - "start": 2, - "end": 5, + "expression": { + "type": "ObjectExpression", + "start": 6, + "end": 11, "loc": { "start": { "line": 1, - "column": 2 + "column": 6 }, "end": { "line": 1, - "column": 5 + "column": 11 } }, "properties": [ { "type": "ObjectProperty", - "start": 3, - "end": 4, + "start": 8, + "end": 9, "loc": { "start": { "line": 1, - "column": 3 + "column": 8 }, "end": { "line": 1, - "column": 4 + "column": 9 } }, "method": false, @@ -109,175 +122,157 @@ "computed": false, "key": { "type": "Identifier", - "start": 3, - "end": 4, + "start": 8, + "end": 9, "loc": { "start": { "line": 1, - "column": 3 + "column": 8 }, "end": { "line": 1, - "column": 4 + "column": 9 }, - "identifierName": "x" + "identifierName": "y" }, - "name": "x" + "name": "y" }, "value": { "type": "Identifier", - "start": 3, - "end": 4, + "start": 8, + "end": 9, "loc": { "start": { "line": 1, - "column": 3 + "column": 8 }, "end": { "line": 1, - "column": 4 + "column": 9 }, - "identifierName": "x" + "identifierName": "y" }, - "name": "x" + "name": "y" }, "extra": { "shorthand": true } } ] + } + } + ], + "directives": [], + "extra": { + "curly": false + } + }, + "alternate": { + "type": "BlockStatement", + "start": 16, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 18, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 3, + "column": 1 + } }, - "right": { + "expression": { "type": "ObjectExpression", - "start": 8, - "end": 15, + "start": 18, + "end": 25, "loc": { "start": { "line": 1, - "column": 8 + "column": 18 }, "end": { - "line": 1, - "column": 15 + "line": 3, + "column": 1 } }, "properties": [ { "type": "ObjectProperty", - "start": 9, - "end": 14, + "start": 22, + "end": 23, "loc": { "start": { - "line": 1, - "column": 9 + "line": 2, + "column": 2 }, "end": { - "line": 1, - "column": 14 + "line": 2, + "column": 3 } }, "method": false, - "shorthand": false, + "shorthand": true, "computed": false, "key": { "type": "Identifier", - "start": 9, - "end": 10, + "start": 22, + "end": 23, "loc": { "start": { - "line": 1, - "column": 9 + "line": 2, + "column": 2 }, "end": { - "line": 1, - "column": 10 + "line": 2, + "column": 3 }, - "identifierName": "x" + "identifierName": "z" }, - "name": "x" + "name": "z" }, "value": { - "type": "NumericLiteral", - "start": 12, - "end": 14, + "type": "Identifier", + "start": 22, + "end": 23, "loc": { "start": { - "line": 1, - "column": 12 + "line": 2, + "column": 2 }, "end": { - "line": 1, - "column": 14 - } - }, - "extra": { - "rawValue": 10, - "raw": "10" + "line": 2, + "column": 3 + }, + "identifierName": "z" }, - "value": 10 + "name": "z" + }, + "extra": { + "shorthand": true } } ] - }, - "isNowAssign": false - } - ], - "skinny": false, - "body": { - "type": "BlockStatement", - "start": 17, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 20, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "expression": { - "type": "ObjectExpression", - "start": 20, - "end": 22, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "properties": [] - } } - ], - "directives": [], - "extra": { - "curly": false } - }, + ], + "directives": [], "extra": { - "parenthesized": true, - "parenStart": 0 + "curly": false } } } diff --git a/test/fixtures/lightscript/object-block-ambiguity/object-comprehension/expected.json b/test/fixtures/lightscript/object-block-ambiguity/object-comprehension/expected.json index 814c1eb48e..f2b3febedc 100644 --- a/test/fixtures/lightscript/object-block-ambiguity/object-comprehension/expected.json +++ b/test/fixtures/lightscript/object-block-ambiguity/object-comprehension/expected.json @@ -60,12 +60,12 @@ }, "consequent": { "type": "BlockStatement", - "start": 7, + "start": 9, "end": 35, "loc": { "start": { "line": 1, - "column": 7 + "column": 9 }, "end": { "line": 3, @@ -74,121 +74,90 @@ }, "body": [ { - "type": "ExpressionStatement", - "start": 9, - "end": 35, + "type": "ForInArrayStatement", + "start": 13, + "end": 33, "loc": { "start": { - "line": 1, - "column": 9 + "line": 2, + "column": 2 }, "end": { - "line": 3, - "column": 1 + "line": 2, + "column": 22 } }, - "expression": { - "type": "ObjectComprehension", - "start": 9, - "end": 35, + "elem": { + "type": "Identifier", + "start": 22, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + }, + "identifierName": "e" + }, + "name": "e" + }, + "body": { + "type": "ExpressionStatement", + "start": 32, + "end": 33, "loc": { "start": { - "line": 1, - "column": 9 + "line": 2, + "column": 21 }, "end": { - "line": 3, - "column": 1 + "line": 2, + "column": 22 } }, - "properties": [], - "loop": { - "type": "ForInArrayStatement", - "start": 13, + "expression": { + "type": "Identifier", + "start": 32, "end": 33, "loc": { "start": { "line": 2, - "column": 2 + "column": 21 }, "end": { "line": 2, "column": 22 - } - }, - "elem": { - "type": "Identifier", - "start": 22, - "end": 23, - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 12 - }, - "identifierName": "e" - }, - "name": "e" - }, - "body": { - "type": "ExpressionStatement", - "start": 32, - "end": 33, - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 22 - } }, - "expression": { - "type": "Identifier", - "start": 32, - "end": 33, - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 22 - }, - "identifierName": "e" - }, - "name": "e" - } + "identifierName": "e" }, - "array": { - "type": "Identifier", - "start": 27, - "end": 30, - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 19 - }, - "identifierName": "arr" - }, - "name": "arr" - } + "name": "e" } + }, + "array": { + "type": "Identifier", + "start": 27, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 19 + }, + "identifierName": "arr" + }, + "name": "arr" } } ], "directives": [], "extra": { - "curly": false + "curly": true } }, "alternate": null diff --git a/test/fixtures/lightscript/object-block-ambiguity/object-comprehension/expected.objectBlockAmbiguity.json b/test/fixtures/lightscript/object-block-ambiguity/object-comprehension/expected.objectBlockAmbiguity.json deleted file mode 100644 index f2b3febedc..0000000000 --- a/test/fixtures/lightscript/object-block-ambiguity/object-comprehension/expected.objectBlockAmbiguity.json +++ /dev/null @@ -1,168 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "sourceType": "script", - "body": [ - { - "type": "IfStatement", - "start": 0, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "test": { - "type": "BooleanLiteral", - "start": 3, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "value": true - }, - "consequent": { - "type": "BlockStatement", - "start": 9, - "end": 35, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "body": [ - { - "type": "ForInArrayStatement", - "start": 13, - "end": 33, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 22 - } - }, - "elem": { - "type": "Identifier", - "start": 22, - "end": 23, - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 12 - }, - "identifierName": "e" - }, - "name": "e" - }, - "body": { - "type": "ExpressionStatement", - "start": 32, - "end": 33, - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 22 - } - }, - "expression": { - "type": "Identifier", - "start": 32, - "end": 33, - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 22 - }, - "identifierName": "e" - }, - "name": "e" - } - }, - "array": { - "type": "Identifier", - "start": 27, - "end": 30, - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 19 - }, - "identifierName": "arr" - }, - "name": "arr" - } - } - ], - "directives": [], - "extra": { - "curly": true - } - }, - "alternate": null - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/test/fixtures/lightscript/object-block-ambiguity/object-comprehension/expected.whiteblock.json b/test/fixtures/lightscript/object-block-ambiguity/object-comprehension/expected.whiteblock.json new file mode 100644 index 0000000000..c3da62b2cd --- /dev/null +++ b/test/fixtures/lightscript/object-block-ambiguity/object-comprehension/expected.whiteblock.json @@ -0,0 +1,215 @@ +{ + "type": "File", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "body": [ + { + "type": "IfStatement", + "start": 0, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "test": { + "type": "BooleanLiteral", + "start": 3, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "value": true + }, + "consequent": { + "type": "BlockStatement", + "start": 7, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 9, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "expression": { + "type": "ObjectComprehension", + "start": 9, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "properties": [ + { + "type": "LoopComprehension", + "start": 13, + "end": 33, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "loop": { + "type": "ForInArrayStatement", + "start": 13, + "end": 33, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "elem": { + "type": "Identifier", + "start": 22, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + }, + "identifierName": "e" + }, + "name": "e" + }, + "body": { + "type": "ExpressionStatement", + "start": 32, + "end": 33, + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "expression": { + "type": "Identifier", + "start": 32, + "end": 33, + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 22 + }, + "identifierName": "e" + }, + "name": "e" + } + }, + "array": { + "type": "Identifier", + "start": 27, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 19 + }, + "identifierName": "arr" + }, + "name": "arr" + } + } + } + ] + } + } + ], + "directives": [], + "extra": { + "curly": false + } + }, + "alternate": null + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/test/fixtures/lightscript/object-block-ambiguity/oneline-semi/expected.json b/test/fixtures/lightscript/object-block-ambiguity/oneline-semi/expected.json index 6d974a9eb9..d97d38bee6 100644 --- a/test/fixtures/lightscript/object-block-ambiguity/oneline-semi/expected.json +++ b/test/fixtures/lightscript/object-block-ambiguity/oneline-semi/expected.json @@ -66,12 +66,12 @@ "skinny": false, "body": { "type": "BlockStatement", - "start": 4, + "start": 7, "end": 12, "loc": { "start": { "line": 1, - "column": 4 + "column": 7 }, "end": { "line": 1, @@ -81,95 +81,40 @@ "body": [ { "type": "ExpressionStatement", - "start": 7, - "end": 12, + "start": 9, + "end": 10, "loc": { "start": { "line": 1, - "column": 7 + "column": 9 }, "end": { "line": 1, - "column": 12 + "column": 10 } }, "expression": { - "type": "ObjectExpression", - "start": 7, - "end": 12, + "type": "Identifier", + "start": 9, + "end": 10, "loc": { "start": { "line": 1, - "column": 7 + "column": 9 }, "end": { "line": 1, - "column": 12 - } + "column": 10 + }, + "identifierName": "x" }, - "properties": [ - { - "type": "ObjectProperty", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "x" - }, - "name": "x" - }, - "value": { - "type": "Identifier", - "start": 9, - "end": 10, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - }, - "identifierName": "x" - }, - "name": "x" - }, - "extra": { - "shorthand": true - } - } - ] + "name": "x" } } ], "directives": [], "extra": { - "curly": false + "curly": true } } }, diff --git a/test/fixtures/lightscript/object-block-ambiguity/oneline-semi/expected.objectBlockAmbiguity.json b/test/fixtures/lightscript/object-block-ambiguity/oneline-semi/expected.whiteblock.json similarity index 57% rename from test/fixtures/lightscript/object-block-ambiguity/oneline-semi/expected.objectBlockAmbiguity.json rename to test/fixtures/lightscript/object-block-ambiguity/oneline-semi/expected.whiteblock.json index d97d38bee6..6d974a9eb9 100644 --- a/test/fixtures/lightscript/object-block-ambiguity/oneline-semi/expected.objectBlockAmbiguity.json +++ b/test/fixtures/lightscript/object-block-ambiguity/oneline-semi/expected.whiteblock.json @@ -66,12 +66,12 @@ "skinny": false, "body": { "type": "BlockStatement", - "start": 7, + "start": 4, "end": 12, "loc": { "start": { "line": 1, - "column": 7 + "column": 4 }, "end": { "line": 1, @@ -81,40 +81,95 @@ "body": [ { "type": "ExpressionStatement", - "start": 9, - "end": 10, + "start": 7, + "end": 12, "loc": { "start": { "line": 1, - "column": 9 + "column": 7 }, "end": { "line": 1, - "column": 10 + "column": 12 } }, "expression": { - "type": "Identifier", - "start": 9, - "end": 10, + "type": "ObjectExpression", + "start": 7, + "end": 12, "loc": { "start": { "line": 1, - "column": 9 + "column": 7 }, "end": { "line": 1, - "column": 10 - }, - "identifierName": "x" + "column": 12 + } }, - "name": "x" + "properties": [ + { + "type": "ObjectProperty", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "x" + }, + "name": "x" + }, + "value": { + "type": "Identifier", + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "x" + }, + "name": "x" + }, + "extra": { + "shorthand": true + } + } + ] } } ], "directives": [], "extra": { - "curly": true + "curly": false } } }, diff --git a/test/fixtures/lightscript/object-block-ambiguity/options.json b/test/fixtures/lightscript/object-block-ambiguity/options.json index a5a65b5e20..789ef9baa7 100644 --- a/test/fixtures/lightscript/object-block-ambiguity/options.json +++ b/test/fixtures/lightscript/object-block-ambiguity/options.json @@ -1,9 +1,8 @@ { "alternatives": { - "objectBlockAmbiguity": { + "whiteblock": { "allPlugins": true, - "excludePlugins": ["existentialExpression", "safeCallExpression", "enhancedComprehension", "bangCall", "flippedImports", "objectBlockAmbiguity_preferObject"], - "expected": "expected.objectBlockAmbiguity.json" + "expected": "expected.whiteblock.json" } } } diff --git a/test/fixtures/lightscript/object-block-ambiguity/tilde-call/expected.json b/test/fixtures/lightscript/object-block-ambiguity/tilde-call/expected.whiteblock.json similarity index 100% rename from test/fixtures/lightscript/object-block-ambiguity/tilde-call/expected.json rename to test/fixtures/lightscript/object-block-ambiguity/tilde-call/expected.whiteblock.json diff --git a/test/fixtures/lightscript/object-block-ambiguity/tilde-call/options.json b/test/fixtures/lightscript/object-block-ambiguity/tilde-call/options.json index 9034dbcf4a..22c1a2e3aa 100644 --- a/test/fixtures/lightscript/object-block-ambiguity/tilde-call/options.json +++ b/test/fixtures/lightscript/object-block-ambiguity/tilde-call/options.json @@ -1,6 +1,6 @@ { "alternatives": { - "objectBlockAmbiguity": { + "all": { "throws": "Unexpected token (1:8)" } } diff --git a/test/fixtures/lightscript/options.json b/test/fixtures/lightscript/options.json index eaa0b48017..3cdb97720d 100644 --- a/test/fixtures/lightscript/options.json +++ b/test/fixtures/lightscript/options.json @@ -3,7 +3,7 @@ "alternatives": { "all": { "allPlugins": true, - "excludePlugins": ["existentialExpression", "safeCallExpression", "enhancedComprehension", "bangCall", "flippedImports"] + "excludePlugins": ["existentialExpression", "safeCallExpression", "enhancedComprehension", "bangCall", "flippedImports", "whiteblockOnly"] } } } diff --git a/test/fixtures/match/discriminant/illegal-as/options.json b/test/fixtures/match/discriminant/illegal-as/options.json index 17624e731b..8f52261f34 100644 --- a/test/fixtures/match/discriminant/illegal-as/options.json +++ b/test/fixtures/match/discriminant/illegal-as/options.json @@ -6,7 +6,7 @@ "noSeqExprParens": { "allPlugins": true, "excludePlugins": ["existentialExpression", "safeCallExpression", "enhancedComprehension", "seqExprRequiresParen", "bangCall"], - "throws": "Unexpected token, expected { (1:28)" + "throws": "Unexpected token, expected { (1:17)" } } } diff --git a/test/fixtures/match/options.json b/test/fixtures/match/options.json index 3fea3fe248..2db5769938 100644 --- a/test/fixtures/match/options.json +++ b/test/fixtures/match/options.json @@ -1,7 +1,8 @@ { "alternatives": { "default": { - "allPlugins": true + "allPlugins": true, + "excludePlugins": ["whiteblockOnly"] } } }