Add tests for private method/fields unnescapable token

This commit is contained in:
Leo Balter 2018-11-26 18:01:12 -05:00 committed by Rick Waldron
parent d857bd6f72
commit 87e86669c3
7 changed files with 128 additions and 0 deletions

View File

@ -0,0 +1,16 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: The pound signal in the private async generator cannot be escaped
template: syntax/invalid
info: |
PrivateName::
# IdentifierName
U+0023 is the escape sequence for #
features: [class-methods-private, async-iteration]
---*/
//- elements
async * \u0023m() { return 42; }

View File

@ -0,0 +1,16 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: The pound signal in the private async method cannot be escaped
template: syntax/invalid
info: |
PrivateName::
# IdentifierName
U+0023 is the escape sequence for #
features: [class-methods-private, async-functions]
---*/
//- elements
async \u0023m() { return 42; }

View File

@ -0,0 +1,24 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: The pound signal in the private reference cannot be escaped
template: syntax/invalid
info: |
PrivateName ::
# IdentifierName
MemberExpression :
MemberExpression . PrivateName
CallExpression :
CallExpression . PrivateName
U+0023 is the escape sequence for #
features: [class-fields-private]
---*/
//- elements
method() {
foo().\u0023field;
}

View File

@ -0,0 +1,16 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: The pound signal in the private field cannot be escaped
template: syntax/invalid
info: |
PrivateName::
# IdentifierName
U+0023 is the escape sequence for #
features: [class-fields-private]
---*/
//- elements
\u0023field;

View File

@ -0,0 +1,16 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: The pound signal in the private generator cannot be escaped
template: syntax/invalid
info: |
PrivateName::
# IdentifierName
U+0023 is the escape sequence for #
features: [class-methods-private, generators]
---*/
//- elements
* \u0023m() { return 42; }

View File

@ -0,0 +1,24 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: The pound signal in the private reference cannot be escaped
template: syntax/invalid
info: |
PrivateName ::
# IdentifierName
MemberExpression :
MemberExpression . PrivateName
CallExpression :
CallExpression . PrivateName
U+0023 is the escape sequence for #
features: [class-fields-private]
---*/
//- elements
method() {
this.\u0023field;
}

View File

@ -0,0 +1,16 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: The pound signal in the private method cannot be escaped
template: syntax/invalid
info: |
PrivateName::
# IdentifierName
U+0023 is the escape sequence for #
features: [class-methods-private]
---*/
//- elements
\u0023m() { return 42; }