Skip to content

Commit 36c3deb

Browse files
JLHwungnicolo-ribaudo
authored andcommitted
test: add invalid local use strict test (#17293)
1 parent 008bfc0 commit 36c3deb

File tree

2 files changed

+55
-0
lines changed
  • packages/babel-parser/test/fixtures/experimental/discard-binding/invalid-function-parameter-local-use-strict

2 files changed

+55
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
function f(void) { "use strict"; }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"type": "File",
3+
"start":0,"end":34,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":1,"column":34,"index":34}},
4+
"errors": [
5+
"SyntaxError: Illegal 'use strict' directive in function with non-simple parameter list. (1:0)"
6+
],
7+
"program": {
8+
"type": "Program",
9+
"start":0,"end":34,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":1,"column":34,"index":34}},
10+
"sourceType": "script",
11+
"interpreter": null,
12+
"body": [
13+
{
14+
"type": "FunctionDeclaration",
15+
"start":0,"end":34,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":1,"column":34,"index":34}},
16+
"id": {
17+
"type": "Identifier",
18+
"start":9,"end":10,"loc":{"start":{"line":1,"column":9,"index":9},"end":{"line":1,"column":10,"index":10},"identifierName":"f"},
19+
"name": "f"
20+
},
21+
"generator": false,
22+
"async": false,
23+
"params": [
24+
{
25+
"type": "VoidPattern",
26+
"start":11,"end":15,"loc":{"start":{"line":1,"column":11,"index":11},"end":{"line":1,"column":15,"index":15}}
27+
}
28+
],
29+
"body": {
30+
"type": "BlockStatement",
31+
"start":17,"end":34,"loc":{"start":{"line":1,"column":17,"index":17},"end":{"line":1,"column":34,"index":34}},
32+
"body": [],
33+
"directives": [
34+
{
35+
"type": "Directive",
36+
"start":19,"end":32,"loc":{"start":{"line":1,"column":19,"index":19},"end":{"line":1,"column":32,"index":32}},
37+
"value": {
38+
"type": "DirectiveLiteral",
39+
"start":19,"end":31,"loc":{"start":{"line":1,"column":19,"index":19},"end":{"line":1,"column":31,"index":31}},
40+
"extra": {
41+
"rawValue": "use strict",
42+
"raw": "\"use strict\"",
43+
"expressionValue": "use strict"
44+
},
45+
"value": "use strict"
46+
}
47+
}
48+
]
49+
}
50+
}
51+
],
52+
"directives": []
53+
}
54+
}

0 commit comments

Comments
 (0)