diff options
Diffstat (limited to 'js/src/tests/test262/language/statements/class/elements/private-accessor-is-visible-in-computed-properties.js')
-rw-r--r-- | js/src/tests/test262/language/statements/class/elements/private-accessor-is-visible-in-computed-properties.js | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/statements/class/elements/private-accessor-is-visible-in-computed-properties.js b/js/src/tests/test262/language/statements/class/elements/private-accessor-is-visible-in-computed-properties.js new file mode 100644 index 0000000000..0084349ef3 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/elements/private-accessor-is-visible-in-computed-properties.js @@ -0,0 +1,34 @@ +// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Private getter of a class is visible in its ComputetProperty scope +esid: prod-ClassTail +info: | + ClassTail : ClassHeritage { ClassBody } + 1. Let lex be the LexicalEnvironment of the running execution context. + 2. Let classScope be NewDeclarativeEnvironment(lex). + 3. Let classScopeEnvRec be classScope's EnvironmentRecord. + ... + 15. Set the running execution context's LexicalEnvironment to classScope. + 16. Set the running execution context's PrivateEnvironment to classPrivateEnvironment. + ... + 27. For each ClassElement e in order from elements + a. If IsStatic of e is false, then + i. Let field be the result of ClassElementEvaluation for e with arguments proto and false. + ... +features: [class-methods-private, class-fields-public, class] +---*/ + +assert.throws(TypeError, function() { + class C { + get #f() { + throw new Test262Error(); + } + + [this.#f] = 'Test262'; + } +}, 'access to a private acessor from ordinary object'); + + +reportCompare(0, 0); |