blob: 719cf23d3ade11a589f6a4493bb77c4609216c60 [file] [log] [blame]
// Copyright 2019 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --harmony-private-methods
"use strict";
// Complementary private accessors.
{
class C {
get #a() { }
set #a(val) { }
}
new C;
}
// Nested private accessors.
{
class C {
a() { this.#a; }
get #a() {
class D { get #a() { } }
return new D;
}
}
new C().a();
}
// Duplicate private accessors.
// https://tc39.es/proposal-private-methods/#sec-static-semantics-early-errors
{
assertThrows('class C { get #a() {} get #a() {} }', SyntaxError);
assertThrows('class C { set #a(val) {} set #a(val) {} }', SyntaxError);
}