From 2aa4a82499d4becd2284cdb482213d541b8804dd Mon Sep 17 00:00:00 2001 From: Daniel Baumann <daniel.baumann@progress-linux.org> Date: Sun, 28 Apr 2024 16:29:10 +0200 Subject: Adding upstream version 86.0.1. Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org> --- .../non262/PrivateName/nested-class-name-used.js | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 js/src/tests/non262/PrivateName/nested-class-name-used.js (limited to 'js/src/tests/non262/PrivateName/nested-class-name-used.js') diff --git a/js/src/tests/non262/PrivateName/nested-class-name-used.js b/js/src/tests/non262/PrivateName/nested-class-name-used.js new file mode 100644 index 0000000000..cc1a77f375 --- /dev/null +++ b/js/src/tests/non262/PrivateName/nested-class-name-used.js @@ -0,0 +1,33 @@ +// |reftest| shell-option(--enable-private-fields) skip-if(!xulRuntime.shell) -- requires shell-options + +// AllPrivateIdentifiersValid uses only lexical string names, not +// the dynamic private names; which means the below is not a syntax +// error but is instead a TypeError on access. + +class A { + #x = 10; + f() { + class B { + g() { + return this.#x; // note: #x isn't declared in this class, but + // the enclosing. + } + }; + this.y = new B; + } + constructor() { + this.f(); + } + g() { + return this.y.g(); + } +}; + +a = new A; +try { + a.g(); +} catch (e) { + assertEq(e instanceof TypeError, true); +} + +if (typeof reportCompare === 'function') reportCompare(0, 0); \ No newline at end of file -- cgit v1.2.3