Skip to content

Commit f84d536

Browse files
caiolimaMs2ger
authored andcommitted
Adding test case when there's a setter on A.prototype
1 parent 833fed7 commit f84d536

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// Copyright (C) 2026 Igalia, S.L. All rights reserved.
2+
// This code is governed by the BSD license found in the LICENSE file.
3+
/*---
4+
esid: sec-ordinarysetwithowndescriptor
5+
description: >
6+
super.foo = V calls the accessor on super class instead of throwing
7+
ReferenceError for TDZ binding
8+
info: |
9+
OrdinarySetWithOwnDescriptor ( _O_, _P_, _V_, _Receiver_, _ownDesc_ )
10+
...
11+
1. Assert: IsAccessorDescriptor(_ownDesc_) is *true*.
12+
1. Let _setter_ be _ownDesc_.[[Set]].
13+
1. If _setter_ is *undefined*, return *false*.
14+
1. Perform ? Call(_setter_, _Receiver_, « _V_ »).
15+
1. Return *true*.
16+
17+
NOTE: When the super class has an accessor property, the setter is called
18+
directly and the Receiver's [[GetOwnProperty]] is never invoked, so the
19+
module namespace TDZ binding is not accessed.
20+
flags: [module]
21+
features: [let]
22+
---*/
23+
24+
import * as ns from './super-set-to-tdz-binding-with-accessor.js';
25+
26+
var setterValue;
27+
28+
class A {
29+
constructor() { return ns; }
30+
set foo(v) { setterValue = v; }
31+
};
32+
class B extends A {
33+
constructor() {
34+
super();
35+
super.foo = 14;
36+
}
37+
};
38+
39+
new B();
40+
41+
assert.sameValue(setterValue, 14, "setter on A.prototype should be called with the assigned value");
42+
43+
export let foo = 42;

0 commit comments

Comments
 (0)