classfields: add tests for forbidden privatenames

This commit is contained in:
Valerie R Young 2017-10-20 20:30:44 -04:00
parent 458e33afe3
commit ea4c8fc95c
2 changed files with 41 additions and 0 deletions

View File

@ -0,0 +1,21 @@
// Copyright (C) 2017 Valerie Young. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Private class fields early error with StringValue "#constructor"
esid: sec-class-definitions-static-semantics-early-errors
features: [class-fields]
negative:
phase: early
type: SyntaxError
info: |
ClassElementName : PrivateName;
It is a Syntax Error if StringValue of PrivateName is "#constructor".
---*/
throw "Test262: This statement should not be evaluated.";
var C = class {
#constructor;
}

View File

@ -0,0 +1,20 @@
// Copyright (C) 2017 Valerie Young. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Private class fields early error with StringValue "#constructor"
esid: sec-class-definitions-static-semantics-early-errors
features: [class-fields]
negative:
phase: early
type: SyntaxError
info: |
ClassElementName : PrivateName;
It is a Syntax Error if StringValue of PrivateName is "#constructor".
---*/
throw "Test262: This statement should not be evaluated.";
class C {
#constructor;
}