Timothy Gu 643d3f37a4 Implement ES2016 check for simple parameter list in strict mode (#106)
* Slightly simplify logic

* Implement ES2016 check for simple parameter list in strict mode

See e.g. ECMA-262 7.0 14.1.2:

> It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
> IsSimpleParameterList of FormalParameters is false.

Similar clauses cover arrow functions, generator functions, methods, and
generator methods, as well as async functions and async arrow functions.
2016-09-15 19:58:01 +02:00

170 lines
4.0 KiB
JSON

{
"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": "script",
"body": [
{
"type": "VariableDeclaration",
"start": 0,
"end": 40,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 40
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 4,
"end": 39,
"loc": {
"start": {
"line": 1,
"column": 4
},
"end": {
"line": 1,
"column": 39
}
},
"id": {
"type": "Identifier",
"start": 4,
"end": 5,
"loc": {
"start": {
"line": 1,
"column": 4
},
"end": {
"line": 1,
"column": 5
},
"identifierName": "a"
},
"name": "a"
},
"init": {
"type": "ArrowFunctionExpression",
"start": 8,
"end": 39,
"loc": {
"start": {
"line": 1,
"column": 8
},
"end": {
"line": 1,
"column": 39
}
},
"id": null,
"generator": false,
"expression": true,
"async": true,
"params": [
{
"type": "AssignmentPattern",
"start": 15,
"end": 27,
"loc": {
"start": {
"line": 1,
"column": 15
},
"end": {
"line": 1,
"column": 27
}
},
"left": {
"type": "Identifier",
"start": 15,
"end": 22,
"loc": {
"start": {
"line": 1,
"column": 15
},
"end": {
"line": 1,
"column": 22
},
"identifierName": "options"
},
"name": "options"
},
"right": {
"type": "ObjectExpression",
"start": 25,
"end": 27,
"loc": {
"start": {
"line": 1,
"column": 25
},
"end": {
"line": 1,
"column": 27
}
},
"properties": []
}
}
],
"body": {
"type": "Identifier",
"start": 32,
"end": 39,
"loc": {
"start": {
"line": 1,
"column": 32
},
"end": {
"line": 1,
"column": 39
},
"identifierName": "options"
},
"name": "options"
}
}
}
],
"kind": "var"
}
],
"directives": []
}
}