Fix some cases of invalid labeled declarations
This commit is contained in:
1
test/fixtures/es2015/statements/label-invalid-class/actual.js
vendored
Normal file
1
test/fixtures/es2015/statements/label-invalid-class/actual.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
foo: class X {}
|
||||
3
test/fixtures/es2015/statements/label-invalid-class/options.json
vendored
Normal file
3
test/fixtures/es2015/statements/label-invalid-class/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "Invalid labeled declaration (1:5)"
|
||||
}
|
||||
1
test/fixtures/es2015/statements/label-invalid-const/actual.js
vendored
Normal file
1
test/fixtures/es2015/statements/label-invalid-const/actual.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
foo: const bar = null;
|
||||
3
test/fixtures/es2015/statements/label-invalid-const/options.json
vendored
Normal file
3
test/fixtures/es2015/statements/label-invalid-const/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "Invalid labeled declaration (1:5)"
|
||||
}
|
||||
1
test/fixtures/es2015/statements/label-invalid-func-async/actual.js
vendored
Normal file
1
test/fixtures/es2015/statements/label-invalid-func-async/actual.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
foo: async function bar() {}
|
||||
3
test/fixtures/es2015/statements/label-invalid-func-async/options.json
vendored
Normal file
3
test/fixtures/es2015/statements/label-invalid-func-async/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "Invalid labeled declaration (1:5)"
|
||||
}
|
||||
1
test/fixtures/es2015/statements/label-invalid-func-generator/actual.js
vendored
Normal file
1
test/fixtures/es2015/statements/label-invalid-func-generator/actual.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
foo: function* bar() {}
|
||||
3
test/fixtures/es2015/statements/label-invalid-func-generator/options.json
vendored
Normal file
3
test/fixtures/es2015/statements/label-invalid-func-generator/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "Invalid labeled declaration (1:5)"
|
||||
}
|
||||
1
test/fixtures/es2015/statements/label-invalid-func-strict/actual.js
vendored
Normal file
1
test/fixtures/es2015/statements/label-invalid-func-strict/actual.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
function foo() {"use strict"; bar: function baz() {}}
|
||||
3
test/fixtures/es2015/statements/label-invalid-func-strict/options.json
vendored
Normal file
3
test/fixtures/es2015/statements/label-invalid-func-strict/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "Invalid labeled declaration (1:35)"
|
||||
}
|
||||
1
test/fixtures/es2015/statements/label-invalid-let/actual.js
vendored
Normal file
1
test/fixtures/es2015/statements/label-invalid-let/actual.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
foo: let bar;
|
||||
3
test/fixtures/es2015/statements/label-invalid-let/options.json
vendored
Normal file
3
test/fixtures/es2015/statements/label-invalid-let/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "Invalid labeled declaration (1:5)"
|
||||
}
|
||||
1
test/fixtures/es2015/statements/label-valid-func-non-strict/actual.js
vendored
Normal file
1
test/fixtures/es2015/statements/label-valid-func-non-strict/actual.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
foo: function bar() {}
|
||||
119
test/fixtures/es2015/statements/label-valid-func-non-strict/expected.json
vendored
Normal file
119
test/fixtures/es2015/statements/label-valid-func-non-strict/expected.json
vendored
Normal file
@@ -0,0 +1,119 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start": 0,
|
||||
"end": 22,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 22
|
||||
}
|
||||
},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start": 0,
|
||||
"end": 22,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 22
|
||||
}
|
||||
},
|
||||
"sourceType": "script",
|
||||
"body": [
|
||||
{
|
||||
"type": "LabeledStatement",
|
||||
"start": 0,
|
||||
"end": 22,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 22
|
||||
}
|
||||
},
|
||||
"body": {
|
||||
"type": "FunctionDeclaration",
|
||||
"start": 5,
|
||||
"end": 22,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 5
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 22
|
||||
}
|
||||
},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 14,
|
||||
"end": 17,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 14
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 17
|
||||
},
|
||||
"identifierName": "bar"
|
||||
},
|
||||
"name": "bar"
|
||||
},
|
||||
"generator": false,
|
||||
"expression": false,
|
||||
"async": false,
|
||||
"params": [],
|
||||
"body": {
|
||||
"type": "BlockStatement",
|
||||
"start": 20,
|
||||
"end": 22,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 20
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 22
|
||||
}
|
||||
},
|
||||
"body": [],
|
||||
"directives": []
|
||||
}
|
||||
},
|
||||
"label": {
|
||||
"type": "Identifier",
|
||||
"start": 0,
|
||||
"end": 3,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 3
|
||||
},
|
||||
"identifierName": "foo"
|
||||
},
|
||||
"name": "foo"
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
1
test/fixtures/es2015/statements/label-valid-var/actual.js
vendored
Normal file
1
test/fixtures/es2015/statements/label-valid-var/actual.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
foo: var bar;
|
||||
117
test/fixtures/es2015/statements/label-valid-var/expected.json
vendored
Normal file
117
test/fixtures/es2015/statements/label-valid-var/expected.json
vendored
Normal file
@@ -0,0 +1,117 @@
|
||||
{
|
||||
"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": "LabeledStatement",
|
||||
"start": 0,
|
||||
"end": 13,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 13
|
||||
}
|
||||
},
|
||||
"body": {
|
||||
"type": "VariableDeclaration",
|
||||
"start": 5,
|
||||
"end": 13,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 5
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 13
|
||||
}
|
||||
},
|
||||
"declarations": [
|
||||
{
|
||||
"type": "VariableDeclarator",
|
||||
"start": 9,
|
||||
"end": 12,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 9
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 12
|
||||
}
|
||||
},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 9,
|
||||
"end": 12,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 9
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 12
|
||||
},
|
||||
"identifierName": "bar"
|
||||
},
|
||||
"name": "bar"
|
||||
},
|
||||
"init": null
|
||||
}
|
||||
],
|
||||
"kind": "var"
|
||||
},
|
||||
"label": {
|
||||
"type": "Identifier",
|
||||
"start": 0,
|
||||
"end": 3,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 3
|
||||
},
|
||||
"identifierName": "foo"
|
||||
},
|
||||
"name": "foo"
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user