raise syntax error on declaration of private method, and add syntax tests for private fields

This commit is contained in:
Erik Krogh Kristensen
2020-02-03 16:00:25 +01:00
parent 183dd68d6a
commit e3189aaa47
6 changed files with 43 additions and 18 deletions

View File

@@ -1,2 +1,4 @@
| arrows.js:1:5:1:5 | Error: Argument name clash | Error: Argument name clash |
| destructingPrivate.js:3:6:3:6 | Error: Unexpected token | Error: Unexpected token |
| privateMethod.js:2:3:2:3 | Error: Only fields, not methods, can be declared private. | Error: Only fields, not methods, can be declared private. |
| tst.js:2:12:2:12 | Error: Unterminated string constant | Error: Unterminated string constant |

View File

@@ -0,0 +1,5 @@
class C {
bar() {
{#privDecl} = this;
}
}

View File

@@ -0,0 +1,3 @@
class C {
#privateMethod() {}
}