Add static private class field support

This commit is contained in:
Justin Ridgewell
2017-07-02 01:44:12 -04:00
parent 5e1e94917c
commit 9c9f9e2adb
11 changed files with 209 additions and 14 deletions

View File

@@ -106,6 +106,7 @@
},
"name": "x"
},
"static": false,
"value": null
},
{
@@ -139,6 +140,7 @@
},
"name": "y"
},
"static": false,
"value": null
}
]
@@ -147,4 +149,4 @@
],
"directives": []
}
}
}

View File

@@ -106,6 +106,7 @@
},
"name": "x"
},
"static": false,
"value": null
},
{
@@ -272,4 +273,4 @@
],
"directives": []
}
}
}

View File

@@ -106,6 +106,7 @@
},
"name": "x"
},
"static": false,
"value": null
},
{
@@ -139,6 +140,7 @@
},
"name": "y"
},
"static": false,
"value": null
}
]
@@ -222,6 +224,7 @@
},
"name": "x"
},
"static": false,
"value": {
"type": "NumericLiteral",
"start": 36,
@@ -274,6 +277,7 @@
},
"name": "y"
},
"static": false,
"value": {
"type": "NumericLiteral",
"start": 44,
@@ -301,4 +305,4 @@
],
"directives": []
}
}
}

View File

@@ -106,6 +106,7 @@
},
"name": "x"
},
"static": false,
"value": {
"type": "NumericLiteral",
"start": 23,
@@ -158,6 +159,7 @@
},
"name": "y"
},
"static": false,
"value": {
"type": "NumericLiteral",
"start": 35,
@@ -677,6 +679,7 @@
},
"name": "x"
},
"static": false,
"value": {
"type": "NumericLiteral",
"start": 151,
@@ -729,6 +732,7 @@
},
"name": "y"
},
"static": false,
"value": {
"type": "NumericLiteral",
"start": 171,
@@ -3350,4 +3354,4 @@
],
"directives": []
}
}
}

View File

@@ -106,6 +106,7 @@
},
"name": "x"
},
"static": false,
"value": null
},
{
@@ -139,6 +140,7 @@
},
"name": "y"
},
"static": false,
"value": null
},
{
@@ -1621,4 +1623,4 @@
],
"directives": []
}
}
}

View File

@@ -0,0 +1,4 @@
class A {
static #x;
static #y = 1;
}

View File

@@ -0,0 +1,171 @@
{
"type": "File",
"start": 0,
"end": 41,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 4,
"column": 1
}
},
"program": {
"type": "Program",
"start": 0,
"end": 41,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 4,
"column": 1
}
},
"sourceType": "script",
"body": [
{
"type": "ClassDeclaration",
"start": 0,
"end": 41,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 4,
"column": 1
}
},
"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": 41,
"loc": {
"start": {
"line": 1,
"column": 8
},
"end": {
"line": 4,
"column": 1
}
},
"body": [
{
"type": "ClassPrivateProperty",
"start": 12,
"end": 22,
"loc": {
"start": {
"line": 2,
"column": 2
},
"end": {
"line": 2,
"column": 12
}
},
"key": {
"type": "Identifier",
"start": 20,
"end": 21,
"loc": {
"start": {
"line": 2,
"column": 10
},
"end": {
"line": 2,
"column": 11
},
"identifierName": "x"
},
"name": "x"
},
"static": true,
"value": null
},
{
"type": "ClassPrivateProperty",
"start": 25,
"end": 39,
"loc": {
"start": {
"line": 3,
"column": 2
},
"end": {
"line": 3,
"column": 16
}
},
"key": {
"type": "Identifier",
"start": 33,
"end": 34,
"loc": {
"start": {
"line": 3,
"column": 10
},
"end": {
"line": 3,
"column": 11
},
"identifierName": "y"
},
"name": "y"
},
"static": true,
"value": {
"type": "NumericLiteral",
"start": 37,
"end": 38,
"loc": {
"start": {
"line": 3,
"column": 14
},
"end": {
"line": 3,
"column": 15
}
},
"extra": {
"rawValue": 1,
"raw": "1"
},
"value": 1
}
}
]
}
}
],
"directives": []
}
}

View File

@@ -0,0 +1,3 @@
{
"plugins": ["classProperties", "classPrivateProperties"]
}