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-method.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-method.js')
-rw-r--r-- | js/src/tests/test262/language/statements/class/elements/super-access-inside-a-private-method.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-method.js b/js/src/tests/test262/language/statements/class/elements/super-access-inside-a-private-method.js new file mode 100644 index 0000000000..df4478828f --- /dev/null +++ b/js/src/tests/test262/language/statements/class/elements/super-access-inside-a-private-method.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 method contains proper HomeObject +esid: sec-method-definitions-runtime-semantics-classelementevaluation +info: | + MethodDefinition : ClassElementName ( UniqueFormalParameters ) { FunctionBody } + 1. Let methodDef be DefineMethod of MethodDefinition with argument homeObject. + 2. ReturnIfAbrupt(methodDef). + 3. Perform ? DefineOrdinaryMethod(methodDef.[[Key]], homeObject, methodDef.[[Closure]], _enumerable). + + MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody } + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. Let scope be the running execution context's LexicalEnvironment. + 4. If functionPrototype is present as a parameter, then + a. Let kind be Normal. + b. Let prototype be functionPrototype. + 5. Else, + a. Let kind be Method. + b. Let prototype be the intrinsic object %FunctionPrototype%. + 6. Let closure be FunctionCreate(kind, UniqueFormalParameters, FunctionBody, scope, prototype). + 7. Perform MakeMethod(closure, object). + 8. Set closure.[[SourceText]] to the source text matched by MethodDefinition. + 9. Return the Record { [[Key]]: propKey, [[Closure]]: closure }. +features: [class-methods-private, class] +---*/ + +class A { + method() { + return "Test262"; + } +} + +class C extends A { + #m() { + return super.method(); + } + + access(o) { + return this.#m.call(o); + } +} + +let c = new C(); +assert.sameValue(c.access(c), "Test262"); + +let o = {}; +assert.sameValue(c.access(o), "Test262"); + +reportCompare(0, 0); |