Remove parser support for decorators optional parentheses (#8037)

* Remove parser support for decorators optional parentheses

* Update fixtures
This commit is contained in:
Nicolò Ribaudo
2018-06-02 13:07:15 +02:00
committed by GitHub
parent fe556c502d
commit b8dcd6f593
55 changed files with 487 additions and 429 deletions

View File

@@ -58,10 +58,10 @@
"column": 11
}
},
"callee": {
"type": "Identifier",
"expression": {
"type": "CallExpression",
"start": 1,
"end": 4,
"end": 11,
"loc": {
"start": {
"line": 1,
@@ -69,34 +69,49 @@
},
"end": {
"line": 1,
"column": 4
},
"identifierName": "foo"
"column": 11
}
},
"name": "foo"
},
"arguments": [
{
"type": "StringLiteral",
"start": 5,
"end": 10,
"callee": {
"type": "Identifier",
"start": 1,
"end": 4,
"loc": {
"start": {
"line": 1,
"column": 5
"column": 1
},
"end": {
"line": 1,
"column": 10
}
"column": 4
},
"identifierName": "foo"
},
"extra": {
"rawValue": "bar",
"raw": "'bar'"
},
"value": "bar"
}
]
"name": "foo"
},
"arguments": [
{
"type": "StringLiteral",
"start": 5,
"end": 10,
"loc": {
"start": {
"line": 1,
"column": 5
},
"end": {
"line": 1,
"column": 10
}
},
"extra": {
"rawValue": "bar",
"raw": "'bar'"
},
"value": "bar"
}
]
}
}
],
"id": {

View File

@@ -58,7 +58,7 @@
"column": 4
}
},
"callee": {
"expression": {
"type": "Identifier",
"start": 1,
"end": 4,

View File

@@ -104,7 +104,7 @@
"column": 14
}
},
"callee": {
"expression": {
"type": "Identifier",
"start": 11,
"end": 14,
@@ -185,7 +185,7 @@
"column": 6
}
},
"callee": {
"expression": {
"type": "Identifier",
"start": 30,
"end": 33,

View File

@@ -105,7 +105,7 @@
"column": 6
}
},
"callee": {
"expression": {
"type": "Identifier",
"start": 13,
"end": 16,

View File

@@ -105,7 +105,7 @@
"column": 6
}
},
"callee": {
"expression": {
"type": "Identifier",
"start": 13,
"end": 16,

View File

@@ -105,10 +105,10 @@
"column": 16
}
},
"callee": {
"type": "MemberExpression",
"expression": {
"type": "CallExpression",
"start": 13,
"end": 20,
"end": 26,
"loc": {
"start": {
"line": 2,
@@ -116,13 +116,13 @@
},
"end": {
"line": 2,
"column": 10
"column": 16
}
},
"object": {
"callee": {
"type": "MemberExpression",
"start": 13,
"end": 18,
"end": 20,
"loc": {
"start": {
"line": 2,
@@ -130,13 +130,13 @@
},
"end": {
"line": 2,
"column": 8
"column": 10
}
},
"object": {
"type": "MemberExpression",
"start": 13,
"end": 16,
"end": 18,
"loc": {
"start": {
"line": 2,
@@ -144,13 +144,13 @@
},
"end": {
"line": 2,
"column": 6
"column": 8
}
},
"object": {
"type": "Identifier",
"type": "MemberExpression",
"start": 13,
"end": 14,
"end": 16,
"loc": {
"start": {
"line": 2,
@@ -158,105 +158,120 @@
},
"end": {
"line": 2,
"column": 4
},
"identifierName": "a"
"column": 6
}
},
"name": "a"
"object": {
"type": "Identifier",
"start": 13,
"end": 14,
"loc": {
"start": {
"line": 2,
"column": 3
},
"end": {
"line": 2,
"column": 4
},
"identifierName": "a"
},
"name": "a"
},
"property": {
"type": "Identifier",
"start": 15,
"end": 16,
"loc": {
"start": {
"line": 2,
"column": 5
},
"end": {
"line": 2,
"column": 6
},
"identifierName": "b"
},
"name": "b"
},
"computed": false
},
"property": {
"type": "Identifier",
"start": 15,
"end": 16,
"start": 17,
"end": 18,
"loc": {
"start": {
"line": 2,
"column": 5
"column": 7
},
"end": {
"line": 2,
"column": 6
"column": 8
},
"identifierName": "b"
"identifierName": "c"
},
"name": "b"
"name": "c"
},
"computed": false
},
"property": {
"type": "Identifier",
"start": 17,
"end": 18,
"start": 19,
"end": 20,
"loc": {
"start": {
"line": 2,
"column": 7
"column": 9
},
"end": {
"line": 2,
"column": 8
"column": 10
},
"identifierName": "c"
"identifierName": "d"
},
"name": "c"
"name": "d"
},
"computed": false
},
"property": {
"type": "Identifier",
"start": 19,
"end": 20,
"loc": {
"start": {
"line": 2,
"column": 9
"arguments": [
{
"type": "Identifier",
"start": 21,
"end": 22,
"loc": {
"start": {
"line": 2,
"column": 11
},
"end": {
"line": 2,
"column": 12
},
"identifierName": "e"
},
"end": {
"line": 2,
"column": 10
},
"identifierName": "d"
"name": "e"
},
"name": "d"
},
"computed": false
},
"arguments": [
{
"type": "Identifier",
"start": 21,
"end": 22,
"loc": {
"start": {
"line": 2,
"column": 11
{
"type": "Identifier",
"start": 24,
"end": 25,
"loc": {
"start": {
"line": 2,
"column": 14
},
"end": {
"line": 2,
"column": 15
},
"identifierName": "f"
},
"end": {
"line": 2,
"column": 12
},
"identifierName": "e"
},
"name": "e"
},
{
"type": "Identifier",
"start": 24,
"end": 25,
"loc": {
"start": {
"line": 2,
"column": 14
},
"end": {
"line": 2,
"column": 15
},
"identifierName": "f"
},
"name": "f"
}
]
"name": "f"
}
]
}
}
],
"static": false,

View File

@@ -105,7 +105,7 @@
"column": 6
}
},
"callee": {
"expression": {
"type": "Identifier",
"start": 15,
"end": 18,

View File

@@ -72,7 +72,7 @@
"column": 26
}
},
"callee": {
"expression": {
"type": "Identifier",
"start": 17,
"end": 26,

View File

@@ -72,7 +72,7 @@
"column": 10
}
},
"callee": {
"expression": {
"type": "Identifier",
"start": 1,
"end": 10,

View File

@@ -74,7 +74,7 @@
"column": 10
}
},
"callee": {
"expression": {
"type": "Identifier",
"start": 1,
"end": 10,

View File

@@ -74,7 +74,7 @@
"column": 11
}
},
"callee": {
"expression": {
"type": "Identifier",
"start": 8,
"end": 11,

View File

@@ -72,7 +72,7 @@
"column": 4
}
},
"callee": {
"expression": {
"type": "Identifier",
"start": 17,
"end": 20,

View File

@@ -105,7 +105,7 @@
"column": 6
}
},
"callee": {
"expression": {
"type": "Identifier",
"start": 13,
"end": 16,

View File

@@ -58,160 +58,175 @@
"column": 2
}
},
"callee": {
"type": "Identifier",
"expression": {
"type": "CallExpression",
"start": 1,
"end": 6,
"end": 40,
"loc": {
"start": {
"line": 1,
"column": 1
},
"end": {
"line": 1,
"column": 6
},
"identifierName": "outer"
"line": 3,
"column": 2
}
},
"name": "outer"
},
"arguments": [
{
"type": "ObjectExpression",
"start": 7,
"end": 39,
"callee": {
"type": "Identifier",
"start": 1,
"end": 6,
"loc": {
"start": {
"line": 1,
"column": 7
"column": 1
},
"end": {
"line": 3,
"column": 1
}
"line": 1,
"column": 6
},
"identifierName": "outer"
},
"properties": [
{
"type": "ObjectProperty",
"start": 11,
"end": 37,
"loc": {
"start": {
"line": 2,
"column": 2
},
"end": {
"line": 2,
"column": 28
}
"name": "outer"
},
"arguments": [
{
"type": "ObjectExpression",
"start": 7,
"end": 39,
"loc": {
"start": {
"line": 1,
"column": 7
},
"method": false,
"key": {
"type": "Identifier",
"end": {
"line": 3,
"column": 1
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 11,
"end": 16,
"end": 37,
"loc": {
"start": {
"line": 2,
"column": 2
},
"end": {
"line": 2,
"column": 7
},
"identifierName": "store"
},
"name": "store"
},
"computed": false,
"shorthand": false,
"value": {
"type": "ClassExpression",
"start": 18,
"end": 37,
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 28
}
},
"decorators": [
{
"type": "Decorator",
"start": 18,
"end": 24,
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 15
}
},
"callee": {
"type": "Identifier",
"start": 19,
"end": 24,
"loc": {
"start": {
"line": 2,
"column": 10
},
"end": {
"line": 2,
"column": 15
},
"identifierName": "inner"
},
"name": "inner"
}
}
],
"id": {
"method": false,
"key": {
"type": "Identifier",
"start": 31,
"end": 34,
"start": 11,
"end": 16,
"loc": {
"start": {
"line": 2,
"column": 22
"column": 2
},
"end": {
"line": 2,
"column": 25
"column": 7
},
"identifierName": "Foo"
"identifierName": "store"
},
"name": "Foo"
"name": "store"
},
"superClass": null,
"body": {
"type": "ClassBody",
"start": 35,
"computed": false,
"shorthand": false,
"value": {
"type": "ClassExpression",
"start": 18,
"end": 37,
"loc": {
"start": {
"line": 2,
"column": 26
"column": 9
},
"end": {
"line": 2,
"column": 28
}
},
"body": []
"decorators": [
{
"type": "Decorator",
"start": 18,
"end": 24,
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 15
}
},
"expression": {
"type": "Identifier",
"start": 19,
"end": 24,
"loc": {
"start": {
"line": 2,
"column": 10
},
"end": {
"line": 2,
"column": 15
},
"identifierName": "inner"
},
"name": "inner"
}
}
],
"id": {
"type": "Identifier",
"start": 31,
"end": 34,
"loc": {
"start": {
"line": 2,
"column": 22
},
"end": {
"line": 2,
"column": 25
},
"identifierName": "Foo"
},
"name": "Foo"
},
"superClass": null,
"body": {
"type": "ClassBody",
"start": 35,
"end": 37,
"loc": {
"start": {
"line": 2,
"column": 26
},
"end": {
"line": 2,
"column": 28
}
},
"body": []
}
}
}
}
]
}
]
]
}
]
}
}
],
"id": {

View File

@@ -58,7 +58,7 @@
"column": 2
}
},
"callee": {
"expression": {
"type": "ObjectExpression",
"start": 2,
"end": 34,
@@ -136,7 +136,7 @@
"column": 15
}
},
"callee": {
"expression": {
"type": "Identifier",
"start": 14,
"end": 19,

View File

@@ -105,183 +105,198 @@
"column": 3
}
},
"callee": {
"type": "Identifier",
"expression": {
"type": "CallExpression",
"start": 14,
"end": 19,
"end": 91,
"loc": {
"start": {
"line": 2,
"column": 3
},
"end": {
"line": 2,
"column": 8
},
"identifierName": "outer"
"line": 7,
"column": 3
}
},
"name": "outer"
},
"arguments": [
{
"type": "ClassExpression",
"start": 25,
"end": 87,
"callee": {
"type": "Identifier",
"start": 14,
"end": 19,
"loc": {
"start": {
"line": 3,
"column": 4
"line": 2,
"column": 3
},
"end": {
"line": 6,
"column": 5
}
"line": 2,
"column": 8
},
"identifierName": "outer"
},
"decorators": [
{
"type": "Decorator",
"start": 25,
"end": 34,
"loc": {
"start": {
"line": 3,
"column": 4
},
"end": {
"line": 3,
"column": 13
}
},
"callee": {
"type": "Identifier",
"start": 26,
"end": 34,
"loc": {
"start": {
"line": 3,
"column": 5
},
"end": {
"line": 3,
"column": 13
},
"identifierName": "classDec"
},
"name": "classDec"
}
}
],
"id": null,
"superClass": null,
"body": {
"type": "ClassBody",
"start": 41,
"name": "outer"
},
"arguments": [
{
"type": "ClassExpression",
"start": 25,
"end": 87,
"loc": {
"start": {
"line": 3,
"column": 20
"column": 4
},
"end": {
"line": 6,
"column": 5
}
},
"body": [
"decorators": [
{
"type": "ClassMethod",
"start": 50,
"end": 80,
"type": "Decorator",
"start": 25,
"end": 34,
"loc": {
"start": {
"line": 4,
"column": 6
"line": 3,
"column": 4
},
"end": {
"line": 5,
"column": 22
"line": 3,
"column": 13
}
},
"decorators": [
{
"type": "Decorator",
"start": 50,
"end": 56,
"loc": {
"start": {
"line": 4,
"column": 6
},
"end": {
"line": 4,
"column": 12
}
},
"callee": {
"type": "Identifier",
"start": 51,
"end": 56,
"loc": {
"start": {
"line": 4,
"column": 7
},
"end": {
"line": 4,
"column": 12
},
"identifierName": "inner"
},
"name": "inner"
}
}
],
"static": false,
"key": {
"expression": {
"type": "Identifier",
"start": 64,
"end": 75,
"start": 26,
"end": 34,
"loc": {
"start": {
"line": 5,
"column": 6
"line": 3,
"column": 5
},
"end": {
"line": 5,
"column": 17
"line": 3,
"column": 13
},
"identifierName": "innerMethod"
"identifierName": "classDec"
},
"name": "innerMethod"
"name": "classDec"
}
}
],
"id": null,
"superClass": null,
"body": {
"type": "ClassBody",
"start": 41,
"end": 87,
"loc": {
"start": {
"line": 3,
"column": 20
},
"computed": false,
"kind": "method",
"id": null,
"generator": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 78,
"end": {
"line": 6,
"column": 5
}
},
"body": [
{
"type": "ClassMethod",
"start": 50,
"end": 80,
"loc": {
"start": {
"line": 5,
"column": 20
"line": 4,
"column": 6
},
"end": {
"line": 5,
"column": 22
}
},
"body": [],
"directives": []
"decorators": [
{
"type": "Decorator",
"start": 50,
"end": 56,
"loc": {
"start": {
"line": 4,
"column": 6
},
"end": {
"line": 4,
"column": 12
}
},
"expression": {
"type": "Identifier",
"start": 51,
"end": 56,
"loc": {
"start": {
"line": 4,
"column": 7
},
"end": {
"line": 4,
"column": 12
},
"identifierName": "inner"
},
"name": "inner"
}
}
],
"static": false,
"key": {
"type": "Identifier",
"start": 64,
"end": 75,
"loc": {
"start": {
"line": 5,
"column": 6
},
"end": {
"line": 5,
"column": 17
},
"identifierName": "innerMethod"
},
"name": "innerMethod"
},
"computed": false,
"kind": "method",
"id": null,
"generator": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 78,
"end": 80,
"loc": {
"start": {
"line": 5,
"column": 20
},
"end": {
"line": 5,
"column": 22
}
},
"body": [],
"directives": []
}
}
}
]
]
}
}
}
]
]
}
}
],
"static": false,

View File

@@ -105,7 +105,7 @@
"column": 3
}
},
"callee": {
"expression": {
"type": "ClassExpression",
"start": 20,
"end": 82,
@@ -134,7 +134,7 @@
"column": 13
}
},
"callee": {
"expression": {
"type": "Identifier",
"start": 21,
"end": 29,
@@ -199,7 +199,7 @@
"column": 12
}
},
"callee": {
"expression": {
"type": "Identifier",
"start": 46,
"end": 51,

View File

@@ -105,7 +105,7 @@
"column": 6
}
},
"callee": {
"expression": {
"type": "Identifier",
"start": 13,
"end": 16,

View File

@@ -58,7 +58,7 @@
"column": 12
}
},
"callee": {
"expression": {
"type": "MemberExpression",
"start": 2,
"end": 11,
@@ -188,7 +188,7 @@
"column": 23
}
},
"callee": {
"expression": {
"type": "MemberExpression",
"start": 29,
"end": 47,
@@ -311,7 +311,7 @@
"column": 14
}
},
"callee": {
"expression": {
"type": "BinaryExpression",
"start": 66,
"end": 75,

View File

@@ -105,7 +105,7 @@
"column": 6
}
},
"callee": {
"expression": {
"type": "Identifier",
"start": 13,
"end": 16,

View File

@@ -105,7 +105,7 @@
"column": 6
}
},
"callee": {
"expression": {
"type": "Identifier",
"start": 13,
"end": 16,

View File

@@ -105,7 +105,7 @@
"column": 6
}
},
"callee": {
"expression": {
"type": "Identifier",
"start": 15,
"end": 18,

View File

@@ -105,7 +105,7 @@
"column": 6
}
},
"callee": {
"expression": {
"type": "Identifier",
"start": 13,
"end": 16,

View File

@@ -104,7 +104,7 @@
"column": 14
}
},
"callee": {
"expression": {
"type": "Identifier",
"start": 11,
"end": 14,

View File

@@ -58,7 +58,7 @@
"column": 11
}
},
"callee": {
"expression": {
"type": "CallExpression",
"start": 1,
"end": 11,

View File

@@ -105,7 +105,7 @@
"column": 16
}
},
"callee": {
"expression": {
"type": "Identifier",
"start": 13,
"end": 16,

View File

@@ -58,7 +58,7 @@
"column": 4
}
},
"callee": {
"expression": {
"type": "Identifier",
"start": 1,
"end": 4,

View File

@@ -105,7 +105,7 @@
"column": 16
}
},
"callee": {
"expression": {
"type": "Identifier",
"start": 13,
"end": 16,

View File

@@ -58,7 +58,7 @@
"column": 4
}
},
"callee": {
"expression": {
"type": "Identifier",
"start": 1,
"end": 4,

View File

@@ -105,7 +105,7 @@
"column": 16
}
},
"callee": {
"expression": {
"type": "Identifier",
"start": 13,
"end": 16,
@@ -137,7 +137,7 @@
"column": 21
}
},
"callee": {
"expression": {
"type": "Identifier",
"start": 18,
"end": 21,

View File

@@ -145,7 +145,7 @@
"column": 20
}
},
"callee": {
"expression": {
"type": "CallExpression",
"start": 27,
"end": 32,
@@ -212,7 +212,7 @@
"column": 40
}
},
"callee": {
"expression": {
"type": "CallExpression",
"start": 37,
"end": 52,
@@ -333,7 +333,7 @@
"column": 47
}
},
"callee": {
"expression": {
"type": "CallExpression",
"start": 54,
"end": 59,

View File

@@ -105,7 +105,7 @@
"column": 11
}
},
"callee": {
"expression": {
"type": "MemberExpression",
"start": 15,
"end": 23,

View File

@@ -105,7 +105,7 @@
"column": 12
}
},
"callee": {
"expression": {
"type": "MemberExpression",
"start": 15,
"end": 24,

View File

@@ -74,7 +74,7 @@
"column": 4
}
},
"callee": {
"expression": {
"type": "Identifier",
"start": 1,
"end": 4,

View File

@@ -108,7 +108,7 @@
"column": 35
}
},
"callee": {
"expression": {
"type": "CallExpression",
"start": 30,
"end": 35,
@@ -175,7 +175,7 @@
"column": 55
}
},
"callee": {
"expression": {
"type": "CallExpression",
"start": 40,
"end": 55,
@@ -296,7 +296,7 @@
"column": 62
}
},
"callee": {
"expression": {
"type": "CallExpression",
"start": 57,
"end": 62,

View File

@@ -72,7 +72,7 @@
"column": 4
}
},
"callee": {
"expression": {
"type": "Identifier",
"start": 1,
"end": 4,

View File

@@ -72,7 +72,7 @@
"column": 16
}
},
"callee": {
"expression": {
"type": "Identifier",
"start": 1,
"end": 16,

View File

@@ -94,7 +94,7 @@
"column": 20
}
},
"callee": {
"expression": {
"type": "CallExpression",
"start": 15,
"end": 20,
@@ -161,7 +161,7 @@
"column": 40
}
},
"callee": {
"expression": {
"type": "CallExpression",
"start": 25,
"end": 40,
@@ -282,7 +282,7 @@
"column": 47
}
},
"callee": {
"expression": {
"type": "CallExpression",
"start": 42,
"end": 47,

View File

@@ -124,7 +124,7 @@
"column": 29
}
},
"callee": {
"expression": {
"type": "CallExpression",
"start": 24,
"end": 29,
@@ -191,7 +191,7 @@
"column": 49
}
},
"callee": {
"expression": {
"type": "CallExpression",
"start": 34,
"end": 49,
@@ -312,7 +312,7 @@
"column": 56
}
},
"callee": {
"expression": {
"type": "CallExpression",
"start": 51,
"end": 56,

View File

@@ -105,7 +105,7 @@
"column": 16
}
},
"callee": {
"expression": {
"type": "Identifier",
"start": 13,
"end": 16,

View File

@@ -58,7 +58,7 @@
"column": 25
}
},
"callee": {
"expression": {
"type": "CallExpression",
"start": 1,
"end": 25,
@@ -134,7 +134,7 @@
"column": 11
}
},
"callee": {
"expression": {
"type": "Identifier",
"start": 8,
"end": 11,
@@ -213,7 +213,7 @@
"column": 30
}
},
"callee": {
"expression": {
"type": "Identifier",
"start": 27,
"end": 30,

View File

@@ -159,7 +159,7 @@
"column": 15
}
},
"callee": {
"expression": {
"type": "CallExpression",
"start": 22,
"end": 27,
@@ -226,7 +226,7 @@
"column": 35
}
},
"callee": {
"expression": {
"type": "CallExpression",
"start": 32,
"end": 47,
@@ -347,7 +347,7 @@
"column": 42
}
},
"callee": {
"expression": {
"type": "CallExpression",
"start": 49,
"end": 54,

View File

@@ -58,7 +58,7 @@
"column": 4
}
},
"callee": {
"expression": {
"type": "Identifier",
"start": 1,
"end": 4,
@@ -123,7 +123,7 @@
"column": 27
}
},
"callee": {
"expression": {
"type": "Identifier",
"start": 24,
"end": 27,

View File

@@ -105,7 +105,7 @@
"column": 16
}
},
"callee": {
"expression": {
"type": "Identifier",
"start": 13,
"end": 16,

View File

@@ -105,7 +105,7 @@
"column": 16
}
},
"callee": {
"expression": {
"type": "Identifier",
"start": 13,
"end": 16,

View File

@@ -119,7 +119,7 @@
"column": 16
}
},
"callee": {
"expression": {
"type": "Identifier",
"start": 13,
"end": 16,

View File

@@ -58,7 +58,7 @@
"column": 24
}
},
"callee": {
"expression": {
"type": "CallExpression",
"start": 1,
"end": 24,

View File

@@ -143,7 +143,7 @@
"column": 20
}
},
"callee": {
"expression": {
"type": "Identifier",
"start": 27,
"end": 30,

View File

@@ -59,7 +59,7 @@
"column": 11
}
},
"callee": {
"expression": {
"type": "CallExpression",
"start": 1,
"end": 11,