Justin Ridgewell 1f11dc0881 classPrivateMethods enables PrivateName usage
This separates `classPrivateMethods`'s dependency on
`classPrivateProperties`. It also starts a `PrivateName` at the hash
symbol, not the `Identifier`.
2017-09-17 21:24:37 -04:00

712 lines
20 KiB
JSON

{
"type": "File",
"start": 0,
"end": 159,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 16,
"column": 1
}
},
"program": {
"type": "Program",
"start": 0,
"end": 159,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 16,
"column": 1
}
},
"sourceType": "script",
"body": [
{
"type": "ClassDeclaration",
"start": 0,
"end": 159,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 16,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 6,
"end": 9,
"loc": {
"start": {
"line": 1,
"column": 6
},
"end": {
"line": 1,
"column": 9
},
"identifierName": "Foo"
},
"name": "Foo"
},
"superClass": null,
"body": {
"type": "ClassBody",
"start": 10,
"end": 159,
"loc": {
"start": {
"line": 1,
"column": 10
},
"end": {
"line": 16,
"column": 1
}
},
"body": [
{
"type": "ClassProperty",
"start": 14,
"end": 20,
"loc": {
"start": {
"line": 2,
"column": 2
},
"end": {
"line": 2,
"column": 8
}
},
"static": false,
"key": {
"type": "Identifier",
"start": 14,
"end": 15,
"loc": {
"start": {
"line": 2,
"column": 2
},
"end": {
"line": 2,
"column": 3
},
"identifierName": "a"
},
"name": "a"
},
"computed": false,
"value": {
"type": "NumericLiteral",
"start": 18,
"end": 19,
"loc": {
"start": {
"line": 2,
"column": 6
},
"end": {
"line": 2,
"column": 7
}
},
"extra": {
"rawValue": 1,
"raw": "1"
},
"value": 1
}
},
{
"type": "ClassPrivateMethod",
"start": 24,
"end": 52,
"loc": {
"start": {
"line": 4,
"column": 2
},
"end": {
"line": 6,
"column": 3
}
},
"static": false,
"kind": "method",
"key": {
"type": "PrivateName",
"start": 25,
"end": 27,
"loc": {
"start": {
"line": 4,
"column": 3
},
"end": {
"line": 4,
"column": 5
}
},
"id": {
"type": "Identifier",
"start": 26,
"end": 27,
"loc": {
"start": {
"line": 4,
"column": 4
},
"end": {
"line": 4,
"column": 5
},
"identifierName": "a"
},
"name": "a"
}
},
"id": null,
"generator": true,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 30,
"end": 52,
"loc": {
"start": {
"line": 4,
"column": 8
},
"end": {
"line": 6,
"column": 3
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 36,
"end": 48,
"loc": {
"start": {
"line": 5,
"column": 4
},
"end": {
"line": 5,
"column": 16
}
},
"expression": {
"type": "YieldExpression",
"start": 36,
"end": 47,
"loc": {
"start": {
"line": 5,
"column": 4
},
"end": {
"line": 5,
"column": 15
}
},
"delegate": false,
"argument": {
"type": "CallExpression",
"start": 42,
"end": 47,
"loc": {
"start": {
"line": 5,
"column": 10
},
"end": {
"line": 5,
"column": 15
}
},
"callee": {
"type": "Identifier",
"start": 42,
"end": 45,
"loc": {
"start": {
"line": 5,
"column": 10
},
"end": {
"line": 5,
"column": 13
},
"identifierName": "bar"
},
"name": "bar"
},
"arguments": []
}
}
}
],
"directives": []
}
},
{
"type": "ClassPrivateProperty",
"start": 56,
"end": 63,
"loc": {
"start": {
"line": 8,
"column": 2
},
"end": {
"line": 8,
"column": 9
}
},
"static": false,
"key": {
"type": "PrivateName",
"start": 56,
"end": 58,
"loc": {
"start": {
"line": 8,
"column": 2
},
"end": {
"line": 8,
"column": 4
}
},
"id": {
"type": "Identifier",
"start": 57,
"end": 58,
"loc": {
"start": {
"line": 8,
"column": 3
},
"end": {
"line": 8,
"column": 4
},
"identifierName": "b"
},
"name": "b"
}
},
"value": {
"type": "NumericLiteral",
"start": 61,
"end": 62,
"loc": {
"start": {
"line": 8,
"column": 7
},
"end": {
"line": 8,
"column": 8
}
},
"extra": {
"rawValue": 2,
"raw": "2"
},
"value": 2
}
},
{
"type": "ClassMethod",
"start": 67,
"end": 91,
"loc": {
"start": {
"line": 10,
"column": 2
},
"end": {
"line": 10,
"column": 26
}
},
"static": false,
"key": {
"type": "Identifier",
"start": 71,
"end": 72,
"loc": {
"start": {
"line": 10,
"column": 6
},
"end": {
"line": 10,
"column": 7
},
"identifierName": "b"
},
"name": "b"
},
"computed": false,
"kind": "get",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 75,
"end": 91,
"loc": {
"start": {
"line": 10,
"column": 10
},
"end": {
"line": 10,
"column": 26
}
},
"body": [
{
"type": "ReturnStatement",
"start": 77,
"end": 89,
"loc": {
"start": {
"line": 10,
"column": 12
},
"end": {
"line": 10,
"column": 24
}
},
"argument": {
"type": "NumericLiteral",
"start": 84,
"end": 88,
"loc": {
"start": {
"line": 10,
"column": 19
},
"end": {
"line": 10,
"column": 23
}
},
"extra": {
"rawValue": 9999,
"raw": "9999"
},
"value": 9999
}
}
],
"directives": []
}
},
{
"type": "ClassPrivateMethod",
"start": 94,
"end": 117,
"loc": {
"start": {
"line": 11,
"column": 2
},
"end": {
"line": 11,
"column": 25
}
},
"static": false,
"key": {
"type": "PrivateName",
"start": 98,
"end": 100,
"loc": {
"start": {
"line": 11,
"column": 6
},
"end": {
"line": 11,
"column": 8
}
},
"id": {
"type": "Identifier",
"start": 99,
"end": 100,
"loc": {
"start": {
"line": 11,
"column": 7
},
"end": {
"line": 11,
"column": 8
},
"identifierName": "c"
},
"name": "c"
}
},
"computed": false,
"kind": "set",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 101,
"end": 102,
"loc": {
"start": {
"line": 11,
"column": 9
},
"end": {
"line": 11,
"column": 10
},
"identifierName": "x"
},
"name": "x"
}
],
"body": {
"type": "BlockStatement",
"start": 104,
"end": 117,
"loc": {
"start": {
"line": 11,
"column": 12
},
"end": {
"line": 11,
"column": 25
}
},
"body": [
{
"type": "ReturnStatement",
"start": 106,
"end": 115,
"loc": {
"start": {
"line": 11,
"column": 14
},
"end": {
"line": 11,
"column": 23
}
},
"argument": {
"type": "Identifier",
"start": 113,
"end": 114,
"loc": {
"start": {
"line": 11,
"column": 21
},
"end": {
"line": 11,
"column": 22
},
"identifierName": "x"
},
"name": "x"
}
}
],
"directives": []
}
},
{
"type": "ClassPrivateMethod",
"start": 121,
"end": 157,
"loc": {
"start": {
"line": 13,
"column": 2
},
"end": {
"line": 15,
"column": 3
}
},
"static": false,
"key": {
"type": "PrivateName",
"start": 121,
"end": 123,
"loc": {
"start": {
"line": 13,
"column": 2
},
"end": {
"line": 13,
"column": 4
}
},
"id": {
"type": "Identifier",
"start": 122,
"end": 123,
"loc": {
"start": {
"line": 13,
"column": 3
},
"end": {
"line": 13,
"column": 4
},
"identifierName": "d"
},
"name": "d"
}
},
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 126,
"end": 157,
"loc": {
"start": {
"line": 13,
"column": 7
},
"end": {
"line": 15,
"column": 3
}
},
"body": [
{
"type": "ReturnStatement",
"start": 132,
"end": 153,
"loc": {
"start": {
"line": 14,
"column": 4
},
"end": {
"line": 14,
"column": 25
}
},
"argument": {
"type": "CallExpression",
"start": 139,
"end": 152,
"loc": {
"start": {
"line": 14,
"column": 11
},
"end": {
"line": 14,
"column": 24
}
},
"callee": {
"type": "MemberExpression",
"start": 139,
"end": 150,
"loc": {
"start": {
"line": 14,
"column": 11
},
"end": {
"line": 14,
"column": 22
}
},
"object": {
"type": "Identifier",
"start": 139,
"end": 143,
"loc": {
"start": {
"line": 14,
"column": 11
},
"end": {
"line": 14,
"column": 15
},
"identifierName": "Math"
},
"name": "Math"
},
"property": {
"type": "Identifier",
"start": 144,
"end": 150,
"loc": {
"start": {
"line": 14,
"column": 16
},
"end": {
"line": 14,
"column": 22
},
"identifierName": "random"
},
"name": "random"
},
"computed": false
},
"arguments": []
}
}
],
"directives": []
}
}
]
}
}
],
"directives": []
}
}