mirror of
https://github.com/tc39/test262.git
synced 2025-06-15 03:20:30 +02:00
* Accessing `ta[0]` throws a TypeError. * Fix array indices starting at 0 and property references * Fix classfields templates for properly checking static propnames. * Generate tests * `assert.equal` is not defined * Add missing includes * Generate tests * typo s/Avalue/42/ * fix whitespace * Add missing var for strict mode * Expand generated class fields tests for forbidden computed property name values Ref https://github.com/tc39/test262/pull/1339#issuecomment-342830243 * derived classes have access to private names in base classes, if private names are in scope
33 lines
898 B
JavaScript
33 lines
898 B
JavaScript
// Copyright (C) 2017 Valerie Young. All rights reserved.
|
|
// This code is governed by the BSD license found in the LICENSE file.
|
|
|
|
/*---
|
|
description: >
|
|
static class fields forbid PropName 'constructor' (no early error for
|
|
ComputedPropertyName)
|
|
esid: sec-class-definitions-static-semantics-early-errors
|
|
features: [class-fields]
|
|
info: |
|
|
Static Semantics: PropName
|
|
...
|
|
ComputedPropertyName : [ AssignmentExpression ]
|
|
Return empty.
|
|
|
|
// This test file also tests the ComputedPropertyName won't trigger the
|
|
// following early error:
|
|
Static Semantics: Early Errors
|
|
|
|
ClassElement : staticFieldDefinition;
|
|
It is a Syntax Error if PropName of FieldDefinition is "prototype" or
|
|
"constructor".
|
|
---*/
|
|
|
|
class C {
|
|
static ["constructor"];
|
|
}
|
|
|
|
assert.sameValue(C.hasOwnProperty("constructor"), true);
|
|
|
|
var c = new C();
|
|
assert.sameValue(c.hasOwnProperty("constructor"), false);
|