diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /js/src/tests/test262/language/statements/class/elements/super-access-inside-a-private-getter.js | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/language/statements/class/elements/super-access-inside-a-private-getter.js')
-rw-r--r-- | js/src/tests/test262/language/statements/class/elements/super-access-inside-a-private-getter.js | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/statements/class/elements/super-access-inside-a-private-getter.js b/js/src/tests/test262/language/statements/class/elements/super-access-inside-a-private-getter.js new file mode 100644 index 0000000000..72cb666ec7 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/elements/super-access-inside-a-private-getter.js @@ -0,0 +1,52 @@ +// 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 contains proper HomeObject +esid: sec-method-definitions-runtime-semantics-classelementevaluation +info: | + MethodDefinition : get ClassElementName () { FunctionBody } + 1. Let key be the result of evaluating ClassElementName. + 2. ReturnIfAbrupt(key). + 3. If the function code for this MethodDefinition is strict mode code, let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let formalParameterList be an instance of the production FormalParameters:[empty] . + 6. Let closure be FunctionCreate(Method, formalParameterList, FunctionBody, scope, strict). + 7. Perform MakeMethod(closure, homeObject). + 8. Perform SetFunctionName(closure, key, "get"). + 9. If key is a Private Name, + a. If key has a [[Kind]] field, + i. Assert: key.[[Kind]] is "accessor". + ii. Assert: key.[[Brand]] is homeObject. + iii. Assert: key does not have a [[Get]] field. + iv. Set key.[[Get]] to closure. + b. Otherwise, + i. Set key.[[Kind]] to "accessor". + ii. Set key.[[Brand]] to homeObject. + iii. Set key.[[Get]] to closure. + 10. Else, + a. Let desc be the PropertyDescriptor{[[Get]]: closure, [[Enumerable]]: enumerable, [[Configurable]]: true}. + b. Perform ? DefinePropertyOrThrow(homeObject, key, desc). +features: [class-methods-private, class] +---*/ + +class A { + method() { + return "Test262"; + } +} + +class C extends A { + get #m() { + return super.method(); + } + + access() { + return this.#m; + } +} + +let c = new C(); +assert.sameValue(c.access(), "Test262"); + +reportCompare(0, 0); |