From cf6d3eb0894d45f2d80a5b797371549031a58099 Mon Sep 17 00:00:00 2001 From: Alex Rattray Date: Sun, 14 May 2017 21:44:46 -0700 Subject: [PATCH] Revert "Allow empty arrow bodies (#9)" This reverts commit a7d60a700ab230fd48a8743b759da27fdca37dfd. --- src/plugins/lightscript.js | 9 +- src/tokenizer/types.js | 2 +- .../flow/type-annotations/99/expected.json | 266 +++++++++++++++++- .../skinny-empty-double/actual.js | 1 - .../skinny-empty-double/expected.json | 111 -------- .../skinny-empty-expr/actual.js | 1 - .../skinny-empty-expr/expected.json | 183 ------------ .../arrow-expressions/skinny-empty/actual.js | 1 - .../skinny-empty/expected.json | 90 ------ .../arrow-methods/class-empty/actual.js | 2 - .../arrow-methods/class-empty/expected.json | 145 ---------- .../arrow-methods/obj-empty/actual.js | 3 - .../arrow-methods/obj-empty/expected.json | 166 ----------- .../new/actual.js | 2 +- .../new/expected.json | 26 +- .../skinny-white-empty/expected.json | 123 -------- .../actual.js | 0 .../options.json | 3 + 18 files changed, 285 insertions(+), 849 deletions(-) delete mode 100644 test/fixtures/lightscript/arrow-expressions/skinny-empty-double/actual.js delete mode 100644 test/fixtures/lightscript/arrow-expressions/skinny-empty-double/expected.json delete mode 100644 test/fixtures/lightscript/arrow-expressions/skinny-empty-expr/actual.js delete mode 100644 test/fixtures/lightscript/arrow-expressions/skinny-empty-expr/expected.json delete mode 100644 test/fixtures/lightscript/arrow-expressions/skinny-empty/actual.js delete mode 100644 test/fixtures/lightscript/arrow-expressions/skinny-empty/expected.json delete mode 100644 test/fixtures/lightscript/arrow-methods/class-empty/actual.js delete mode 100644 test/fixtures/lightscript/arrow-methods/class-empty/expected.json delete mode 100644 test/fixtures/lightscript/arrow-methods/obj-empty/actual.js delete mode 100644 test/fixtures/lightscript/arrow-methods/obj-empty/expected.json delete mode 100644 test/fixtures/lightscript/named-arrow-functions/skinny-white-empty/expected.json rename test/fixtures/lightscript/named-arrow-functions/{skinny-white-empty => skinny-white-malformed-dedent}/actual.js (100%) create mode 100644 test/fixtures/lightscript/named-arrow-functions/skinny-white-malformed-dedent/options.json diff --git a/src/plugins/lightscript.js b/src/plugins/lightscript.js index 30d4b3e114..71769d9a3a 100644 --- a/src/plugins/lightscript.js +++ b/src/plugins/lightscript.js @@ -138,7 +138,6 @@ pp.parseObjectComprehension = function(node) { pp.parseWhiteBlock = function (allowDirectives?, isExpression?) { const node = this.startNode(), indentLevel = this.state.indentLevel; - let allowEmptyBody = false; // must start with colon or arrow if (isExpression) { @@ -147,8 +146,6 @@ pp.parseWhiteBlock = function (allowDirectives?, isExpression?) { } else if (this.eat(tt.colon)) { if (!this.isLineBreak()) return this.parseStatement(false); } else if (this.eat(tt.arrow)) { - allowEmptyBody = true; - if (!this.isLineBreak()) { if (this.match(tt.braceL)) { // restart node at brace start instead of arrow start @@ -157,7 +154,7 @@ pp.parseWhiteBlock = function (allowDirectives?, isExpression?) { this.parseBlockBody(node, allowDirectives, false, tt.braceR); this.addExtra(node, "curly", true); return this.finishNode(node, "BlockStatement"); - } else if (this.state.type.startsExpr) { + } else { return this.parseMaybeAssign(); } } @@ -168,9 +165,7 @@ pp.parseWhiteBlock = function (allowDirectives?, isExpression?) { // never parse directives if curly braces aren't used (TODO: document) this.parseBlockBody(node, false, false, indentLevel); this.addExtra(node, "curly", false); - if (!allowEmptyBody && !node.body.length) { - this.unexpected(node.start, "Expected an Indent or Statement"); - } + if (!node.body.length) this.unexpected(node.start, "Expected an Indent or Statement"); return this.finishNode(node, "BlockStatement"); }; diff --git a/src/tokenizer/types.js b/src/tokenizer/types.js index d30939a578..42bc48c51e 100644 --- a/src/tokenizer/types.js +++ b/src/tokenizer/types.js @@ -80,7 +80,7 @@ export const types = { doubleColon: new TokenType("::", { beforeExpr }), dot: new TokenType("."), question: new TokenType("?", { beforeExpr }), - arrow: new TokenType("=>", { beforeExpr, startsExpr }), + arrow: new TokenType("=>", { beforeExpr }), template: new TokenType("template"), ellipsis: new TokenType("...", { beforeExpr }), backQuote: new TokenType("`", { startsExpr }), diff --git a/test/fixtures/flow/type-annotations/99/expected.json b/test/fixtures/flow/type-annotations/99/expected.json index 1c35c17698..b261c3eff9 100644 --- a/test/fixtures/flow/type-annotations/99/expected.json +++ b/test/fixtures/flow/type-annotations/99/expected.json @@ -161,5 +161,269 @@ ], "directives": [] }, - "comments": [] + "comments": [], + "tokens": [ + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "foo", + "start": 1, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": { + "label": ",", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 4, + "end": 5, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "bar", + "start": 6, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 9, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": { + "label": ":", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 10, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "z", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": { + "label": "=>", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 14, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 14 + + + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": { + "label": "null", + "keyword": "null", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "null", + "start": 17, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": { + "label": "eof", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 21, + "end": 21, + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ] } diff --git a/test/fixtures/lightscript/arrow-expressions/skinny-empty-double/actual.js b/test/fixtures/lightscript/arrow-expressions/skinny-empty-double/actual.js deleted file mode 100644 index 2931e83cd3..0000000000 --- a/test/fixtures/lightscript/arrow-expressions/skinny-empty-double/actual.js +++ /dev/null @@ -1 +0,0 @@ --> -> diff --git a/test/fixtures/lightscript/arrow-expressions/skinny-empty-double/expected.json b/test/fixtures/lightscript/arrow-expressions/skinny-empty-double/expected.json deleted file mode 100644 index 619aba3e08..0000000000 --- a/test/fixtures/lightscript/arrow-expressions/skinny-empty-double/expected.json +++ /dev/null @@ -1,111 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "sourceType": "script", - "body": [ - { - "type": "ExpressionStatement", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "expression": { - "type": "ArrowFunctionExpression", - "start": 0, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "id": null, - "generator": false, - "expression": true, - "async": false, - "params": [], - "skinny": true, - "body": { - "type": "ArrowFunctionExpression", - "start": 3, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [], - "skinny": true, - "body": { - "type": "BlockStatement", - "start": 3, - "end": 5, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "body": [], - "directives": [], - "extra": { - "curly": false - } - } - } - } - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/test/fixtures/lightscript/arrow-expressions/skinny-empty-expr/actual.js b/test/fixtures/lightscript/arrow-expressions/skinny-empty-expr/actual.js deleted file mode 100644 index f6f74e0147..0000000000 --- a/test/fixtures/lightscript/arrow-expressions/skinny-empty-expr/actual.js +++ /dev/null @@ -1 +0,0 @@ -f((x) ->, ->) diff --git a/test/fixtures/lightscript/arrow-expressions/skinny-empty-expr/expected.json b/test/fixtures/lightscript/arrow-expressions/skinny-empty-expr/expected.json deleted file mode 100644 index 079197992f..0000000000 --- a/test/fixtures/lightscript/arrow-expressions/skinny-empty-expr/expected.json +++ /dev/null @@ -1,183 +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": 1, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "identifierName": "f" - }, - "name": "f" - }, - "arguments": [ - { - "type": "ArrowFunctionExpression", - "start": 2, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "Identifier", - "start": 3, - "end": 4, - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - }, - "identifierName": "x" - }, - "name": "x" - } - ], - "skinny": true, - "body": { - "type": "BlockStatement", - "start": 6, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "body": [], - "directives": [], - "extra": { - "curly": false - } - } - }, - { - "type": "ArrowFunctionExpression", - "start": 10, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [], - "skinny": true, - "body": { - "type": "BlockStatement", - "start": 10, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "body": [], - "directives": [], - "extra": { - "curly": false - } - } - } - ] - } - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/test/fixtures/lightscript/arrow-expressions/skinny-empty/actual.js b/test/fixtures/lightscript/arrow-expressions/skinny-empty/actual.js deleted file mode 100644 index e4400a5afb..0000000000 --- a/test/fixtures/lightscript/arrow-expressions/skinny-empty/actual.js +++ /dev/null @@ -1 +0,0 @@ --> diff --git a/test/fixtures/lightscript/arrow-expressions/skinny-empty/expected.json b/test/fixtures/lightscript/arrow-expressions/skinny-empty/expected.json deleted file mode 100644 index a6c62b7535..0000000000 --- a/test/fixtures/lightscript/arrow-expressions/skinny-empty/expected.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "sourceType": "script", - "body": [ - { - "type": "ExpressionStatement", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "expression": { - "type": "ArrowFunctionExpression", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [], - "skinny": true, - "body": { - "type": "BlockStatement", - "start": 0, - "end": 2, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "body": [], - "directives": [], - "extra": { - "curly": false - } - } - } - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/test/fixtures/lightscript/arrow-methods/class-empty/actual.js b/test/fixtures/lightscript/arrow-methods/class-empty/actual.js deleted file mode 100644 index 471b2f2cfd..0000000000 --- a/test/fixtures/lightscript/arrow-methods/class-empty/actual.js +++ /dev/null @@ -1,2 +0,0 @@ -class X: - f() -> diff --git a/test/fixtures/lightscript/arrow-methods/class-empty/expected.json b/test/fixtures/lightscript/arrow-methods/class-empty/expected.json deleted file mode 100644 index 3fe4d328c3..0000000000 --- a/test/fixtures/lightscript/arrow-methods/class-empty/expected.json +++ /dev/null @@ -1,145 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - }, - "sourceType": "script", - "body": [ - { - "type": "ClassDeclaration", - "start": 0, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - }, - "id": { - "type": "Identifier", - "start": 6, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - }, - "identifierName": "X" - }, - "name": "X" - }, - "superClass": null, - "body": { - "type": "ClassBody", - "start": 7, - "end": 17, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 2, - "column": 8 - } - }, - "body": [ - { - "type": "ClassMethod", - "start": 11, - "end": 17, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 8 - } - }, - "computed": false, - "key": { - "type": "Identifier", - "start": 11, - "end": 12, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 3 - }, - "identifierName": "f" - }, - "name": "f" - }, - "static": false, - "kind": "method", - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [], - "skinny": true, - "body": { - "type": "BlockStatement", - "start": 15, - "end": 17, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 8 - } - }, - "body": [], - "directives": [], - "extra": { - "curly": false - } - } - } - ] - } - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/test/fixtures/lightscript/arrow-methods/obj-empty/actual.js b/test/fixtures/lightscript/arrow-methods/obj-empty/actual.js deleted file mode 100644 index a9bd0bd81b..0000000000 --- a/test/fixtures/lightscript/arrow-methods/obj-empty/actual.js +++ /dev/null @@ -1,3 +0,0 @@ -x = { - f() -> -} diff --git a/test/fixtures/lightscript/arrow-methods/obj-empty/expected.json b/test/fixtures/lightscript/arrow-methods/obj-empty/expected.json deleted file mode 100644 index 9e3997c829..0000000000 --- a/test/fixtures/lightscript/arrow-methods/obj-empty/expected.json +++ /dev/null @@ -1,166 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "sourceType": "script", - "body": [ - { - "type": "VariableDeclaration", - "start": 0, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "kind": "const", - "extra": { - "implicit": true - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 0, - "end": 16, - "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": "x" - }, - "name": "x" - }, - "init": { - "type": "ObjectExpression", - "start": 4, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "properties": [ - { - "type": "ObjectMethod", - "start": 8, - "end": 14, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 8 - } - }, - "method": true, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 3 - }, - "identifierName": "f" - }, - "name": "f" - }, - "kind": "method", - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [], - "skinny": true, - "body": { - "type": "BlockStatement", - "start": 12, - "end": 14, - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 8 - } - }, - "body": [], - "directives": [], - "extra": { - "curly": false - } - } - } - ] - } - } - ] - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/test/fixtures/lightscript/automatic-semicolon-insertion/new/actual.js b/test/fixtures/lightscript/automatic-semicolon-insertion/new/actual.js index 1d8b2b8843..97e8117a85 100644 --- a/test/fixtures/lightscript/automatic-semicolon-insertion/new/actual.js +++ b/test/fixtures/lightscript/automatic-semicolon-insertion/new/actual.js @@ -1,2 +1,2 @@ new X -(() ->) +(() -> {}) diff --git a/test/fixtures/lightscript/automatic-semicolon-insertion/new/expected.json b/test/fixtures/lightscript/automatic-semicolon-insertion/new/expected.json index 48406227d1..fe9c25f8d4 100644 --- a/test/fixtures/lightscript/automatic-semicolon-insertion/new/expected.json +++ b/test/fixtures/lightscript/automatic-semicolon-insertion/new/expected.json @@ -1,7 +1,7 @@ { "type": "File", "start": 0, - "end": 13, + "end": 16, "loc": { "start": { "line": 1, @@ -9,13 +9,13 @@ }, "end": { "line": 2, - "column": 7 + "column": 10 } }, "program": { "type": "Program", "start": 0, - "end": 13, + "end": 16, "loc": { "start": { "line": 1, @@ -23,7 +23,7 @@ }, "end": { "line": 2, - "column": 7 + "column": 10 } }, "sourceType": "script", @@ -79,7 +79,7 @@ { "type": "ExpressionStatement", "start": 6, - "end": 13, + "end": 16, "loc": { "start": { "line": 2, @@ -87,13 +87,13 @@ }, "end": { "line": 2, - "column": 7 + "column": 10 } }, "expression": { "type": "ArrowFunctionExpression", "start": 7, - "end": 12, + "end": 15, "loc": { "start": { "line": 2, @@ -101,7 +101,7 @@ }, "end": { "line": 2, - "column": 6 + "column": 9 } }, "id": null, @@ -112,22 +112,22 @@ "skinny": true, "body": { "type": "BlockStatement", - "start": 10, - "end": 12, + "start": 13, + "end": 15, "loc": { "start": { "line": 2, - "column": 4 + "column": 7 }, "end": { "line": 2, - "column": 6 + "column": 9 } }, "body": [], "directives": [], "extra": { - "curly": false + "curly": true } }, "extra": { diff --git a/test/fixtures/lightscript/named-arrow-functions/skinny-white-empty/expected.json b/test/fixtures/lightscript/named-arrow-functions/skinny-white-empty/expected.json deleted file mode 100644 index 8da8ceb211..0000000000 --- a/test/fixtures/lightscript/named-arrow-functions/skinny-white-empty/expected.json +++ /dev/null @@ -1,123 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 1 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 9, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 1 - } - }, - "sourceType": "script", - "body": [ - { - "type": "NamedArrowDeclaration", - "start": 0, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "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": 5, - "end": 7, - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "body": [], - "directives": [], - "extra": { - "curly": false - } - } - }, - { - "type": "ExpressionStatement", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 1 - } - }, - "expression": { - "type": "Identifier", - "start": 8, - "end": 9, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 1 - }, - "identifierName": "x" - }, - "name": "x" - } - } - ], - "directives": [] - } -} \ No newline at end of file diff --git a/test/fixtures/lightscript/named-arrow-functions/skinny-white-empty/actual.js b/test/fixtures/lightscript/named-arrow-functions/skinny-white-malformed-dedent/actual.js similarity index 100% rename from test/fixtures/lightscript/named-arrow-functions/skinny-white-empty/actual.js rename to test/fixtures/lightscript/named-arrow-functions/skinny-white-malformed-dedent/actual.js diff --git a/test/fixtures/lightscript/named-arrow-functions/skinny-white-malformed-dedent/options.json b/test/fixtures/lightscript/named-arrow-functions/skinny-white-malformed-dedent/options.json new file mode 100644 index 0000000000..f568ef6fed --- /dev/null +++ b/test/fixtures/lightscript/named-arrow-functions/skinny-white-malformed-dedent/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Expected an Indent or Statement (1:5)" +}