Skip to content

Commit 7d45dfc

Browse files
authored
Fix static attribute setters
Fixes #199.
1 parent 2732dd2 commit 7d45dfc

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

lib/constructs/interface.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1350,7 +1350,7 @@ class Interface {
13501350
addOne(`static get ${propName}`, [], body[0]);
13511351
}
13521352
if (body[1] !== undefined) {
1353-
addOne(`static set ${propName}`, args, body[0]);
1353+
addOne(`static set ${propName}`, args, body[1]);
13541354
}
13551355
}
13561356
}

test/__snapshots__/test.js.snap

+16-4
Original file line numberDiff line numberDiff line change
@@ -2010,7 +2010,11 @@ exports.install = (globalObject, globalNames) => {
20102010
static set staticAttr(V) {
20112011
const esValue = this !== null && this !== undefined ? this : globalObject;
20122012

2013-
return Impl.implementation[\\"staticAttr\\"];
2013+
V = conversions[\\"DOMString\\"](V, {
2014+
context: \\"Failed to set the 'staticAttr' property on 'Global': The provided value\\"
2015+
});
2016+
2017+
Impl.implementation[\\"staticAttr\\"] = V;
20142018
}
20152019
}
20162020
Object.defineProperties(Global.prototype, { [Symbol.toStringTag]: { value: \\"Global\\", configurable: true } });
@@ -4727,7 +4731,9 @@ exports.install = (globalObject, globalNames) => {
47274731
static set abc(V) {
47284732
const esValue = this !== null && this !== undefined ? this : globalObject;
47294733

4730-
return Impl.implementation[\\"abc\\"];
4734+
V = conversions[\\"DOMString\\"](V, { context: \\"Failed to set the 'abc' property on 'Static': The provided value\\" });
4735+
4736+
Impl.implementation[\\"abc\\"] = V;
47314737
}
47324738
}
47334739
Object.defineProperties(Static.prototype, {
@@ -10821,7 +10827,11 @@ exports.install = (globalObject, globalNames) => {
1082110827
static set staticAttr(V) {
1082210828
const esValue = this !== null && this !== undefined ? this : globalObject;
1082310829

10824-
return Impl.implementation[\\"staticAttr\\"];
10830+
V = conversions[\\"DOMString\\"](V, {
10831+
context: \\"Failed to set the 'staticAttr' property on 'Global': The provided value\\"
10832+
});
10833+
10834+
Impl.implementation[\\"staticAttr\\"] = V;
1082510835
}
1082610836
}
1082710837
Object.defineProperties(Global.prototype, { [Symbol.toStringTag]: { value: \\"Global\\", configurable: true } });
@@ -13522,7 +13532,9 @@ exports.install = (globalObject, globalNames) => {
1352213532
static set abc(V) {
1352313533
const esValue = this !== null && this !== undefined ? this : globalObject;
1352413534

13525-
return Impl.implementation[\\"abc\\"];
13535+
V = conversions[\\"DOMString\\"](V, { context: \\"Failed to set the 'abc' property on 'Static': The provided value\\" });
13536+
13537+
Impl.implementation[\\"abc\\"] = V;
1352613538
}
1352713539
}
1352813540
Object.defineProperties(Static.prototype, {

0 commit comments

Comments
 (0)