* Modify grammar to support Private Fields proposal: - Adding optional plugin `classPrivateProperties` - Adding PrivateName type identifier - Adding ClassPrivateProperty to ClassBody - Allow PrivateName in MemberExpression - Allow PrivateName as a reference - Adding tests * Remove unnecesary liberal parameter * Guarding for plugin dependecy for future versioning * update spec.md [skip ci] * move comment [skip ci] * remove unused param [skip ci] * Refactor PrivateName to contain Identifier in name property
309 lines
7.0 KiB
JSON
309 lines
7.0 KiB
JSON
{
|
|
"type": "File",
|
|
"start": 0,
|
|
"end": 48,
|
|
"loc": {
|
|
"start": {
|
|
"line": 1,
|
|
"column": 0
|
|
},
|
|
"end": {
|
|
"line": 3,
|
|
"column": 27
|
|
}
|
|
},
|
|
"program": {
|
|
"type": "Program",
|
|
"start": 0,
|
|
"end": 48,
|
|
"loc": {
|
|
"start": {
|
|
"line": 1,
|
|
"column": 0
|
|
},
|
|
"end": {
|
|
"line": 3,
|
|
"column": 27
|
|
}
|
|
},
|
|
"sourceType": "script",
|
|
"body": [
|
|
{
|
|
"type": "ClassDeclaration",
|
|
"start": 0,
|
|
"end": 19,
|
|
"loc": {
|
|
"start": {
|
|
"line": 1,
|
|
"column": 0
|
|
},
|
|
"end": {
|
|
"line": 1,
|
|
"column": 19
|
|
}
|
|
},
|
|
"id": {
|
|
"type": "Identifier",
|
|
"start": 6,
|
|
"end": 7,
|
|
"loc": {
|
|
"start": {
|
|
"line": 1,
|
|
"column": 6
|
|
},
|
|
"end": {
|
|
"line": 1,
|
|
"column": 7
|
|
},
|
|
"identifierName": "A"
|
|
},
|
|
"name": "A"
|
|
},
|
|
"superClass": null,
|
|
"body": {
|
|
"type": "ClassBody",
|
|
"start": 8,
|
|
"end": 19,
|
|
"loc": {
|
|
"start": {
|
|
"line": 1,
|
|
"column": 8
|
|
},
|
|
"end": {
|
|
"line": 1,
|
|
"column": 19
|
|
}
|
|
},
|
|
"body": [
|
|
{
|
|
"type": "ClassPrivateProperty",
|
|
"start": 10,
|
|
"end": 13,
|
|
"loc": {
|
|
"start": {
|
|
"line": 1,
|
|
"column": 10
|
|
},
|
|
"end": {
|
|
"line": 1,
|
|
"column": 13
|
|
}
|
|
},
|
|
"computed": false,
|
|
"key": {
|
|
"type": "Identifier",
|
|
"start": 11,
|
|
"end": 12,
|
|
"loc": {
|
|
"start": {
|
|
"line": 1,
|
|
"column": 11
|
|
},
|
|
"end": {
|
|
"line": 1,
|
|
"column": 12
|
|
},
|
|
"identifierName": "x"
|
|
},
|
|
"name": "x"
|
|
},
|
|
"value": null
|
|
},
|
|
{
|
|
"type": "ClassPrivateProperty",
|
|
"start": 14,
|
|
"end": 17,
|
|
"loc": {
|
|
"start": {
|
|
"line": 1,
|
|
"column": 14
|
|
},
|
|
"end": {
|
|
"line": 1,
|
|
"column": 17
|
|
}
|
|
},
|
|
"computed": false,
|
|
"key": {
|
|
"type": "Identifier",
|
|
"start": 15,
|
|
"end": 16,
|
|
"loc": {
|
|
"start": {
|
|
"line": 1,
|
|
"column": 15
|
|
},
|
|
"end": {
|
|
"line": 1,
|
|
"column": 16
|
|
},
|
|
"identifierName": "y"
|
|
},
|
|
"name": "y"
|
|
},
|
|
"value": null
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"type": "ClassDeclaration",
|
|
"start": 21,
|
|
"end": 48,
|
|
"loc": {
|
|
"start": {
|
|
"line": 3,
|
|
"column": 0
|
|
},
|
|
"end": {
|
|
"line": 3,
|
|
"column": 27
|
|
}
|
|
},
|
|
"id": {
|
|
"type": "Identifier",
|
|
"start": 27,
|
|
"end": 28,
|
|
"loc": {
|
|
"start": {
|
|
"line": 3,
|
|
"column": 6
|
|
},
|
|
"end": {
|
|
"line": 3,
|
|
"column": 7
|
|
},
|
|
"identifierName": "B"
|
|
},
|
|
"name": "B"
|
|
},
|
|
"superClass": null,
|
|
"body": {
|
|
"type": "ClassBody",
|
|
"start": 29,
|
|
"end": 48,
|
|
"loc": {
|
|
"start": {
|
|
"line": 3,
|
|
"column": 8
|
|
},
|
|
"end": {
|
|
"line": 3,
|
|
"column": 27
|
|
}
|
|
},
|
|
"body": [
|
|
{
|
|
"type": "ClassPrivateProperty",
|
|
"start": 31,
|
|
"end": 38,
|
|
"loc": {
|
|
"start": {
|
|
"line": 3,
|
|
"column": 10
|
|
},
|
|
"end": {
|
|
"line": 3,
|
|
"column": 17
|
|
}
|
|
},
|
|
"computed": false,
|
|
"key": {
|
|
"type": "Identifier",
|
|
"start": 32,
|
|
"end": 33,
|
|
"loc": {
|
|
"start": {
|
|
"line": 3,
|
|
"column": 11
|
|
},
|
|
"end": {
|
|
"line": 3,
|
|
"column": 12
|
|
},
|
|
"identifierName": "x"
|
|
},
|
|
"name": "x"
|
|
},
|
|
"value": {
|
|
"type": "NumericLiteral",
|
|
"start": 36,
|
|
"end": 37,
|
|
"loc": {
|
|
"start": {
|
|
"line": 3,
|
|
"column": 15
|
|
},
|
|
"end": {
|
|
"line": 3,
|
|
"column": 16
|
|
}
|
|
},
|
|
"extra": {
|
|
"rawValue": 0,
|
|
"raw": "0"
|
|
},
|
|
"value": 0
|
|
}
|
|
},
|
|
{
|
|
"type": "ClassPrivateProperty",
|
|
"start": 39,
|
|
"end": 46,
|
|
"loc": {
|
|
"start": {
|
|
"line": 3,
|
|
"column": 18
|
|
},
|
|
"end": {
|
|
"line": 3,
|
|
"column": 25
|
|
}
|
|
},
|
|
"computed": false,
|
|
"key": {
|
|
"type": "Identifier",
|
|
"start": 40,
|
|
"end": 41,
|
|
"loc": {
|
|
"start": {
|
|
"line": 3,
|
|
"column": 19
|
|
},
|
|
"end": {
|
|
"line": 3,
|
|
"column": 20
|
|
},
|
|
"identifierName": "y"
|
|
},
|
|
"name": "y"
|
|
},
|
|
"value": {
|
|
"type": "NumericLiteral",
|
|
"start": 44,
|
|
"end": 45,
|
|
"loc": {
|
|
"start": {
|
|
"line": 3,
|
|
"column": 23
|
|
},
|
|
"end": {
|
|
"line": 3,
|
|
"column": 24
|
|
}
|
|
},
|
|
"extra": {
|
|
"rawValue": 1,
|
|
"raw": "1"
|
|
},
|
|
"value": 1
|
|
}
|
|
}
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"directives": []
|
|
}
|
|
}
|