Skip to content

Commit 67076f3

Browse files
committed
handle interface forwarding
1 parent 2215e83 commit 67076f3

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

baselines/dom.generated.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7466,7 +7466,6 @@ interface CSSStyleProperties extends CSSStyleDeclarationBase {
74667466
zIndex: string;
74677467
/** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/zoom) */
74687468
zoom: string;
7469-
readonly [Symbol.toStringTag]: "CSSStyleProperties";
74707469
}
74717470

74727471
declare var CSSStyleProperties: {

src/build/emitter.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -197,14 +197,16 @@ export function emitWebIdl(
197197
(i) => getExtendList(i.name).concat(getImplementList(i.name)),
198198
);
199199

200-
/// Reverse map of interfaces to those that inherit from it
201-
/// e.g. If i1 depends on i2, i1 should be in childrenMap.[i2.Name]
202-
const iNameToIChildrenList = allNonCallbackInterfaces.reduce(
203-
(result, i): Record<string, string[]> => {
204-
result[i.name] ??= [];
200+
/// Interface name mapped to whether that interface is an inheritance target
201+
const iNameIsInheritanceTarget = allNonCallbackInterfaces.reduce(
202+
(result, i): Record<string, boolean> => {
203+
result[i.name] ??= false;
204+
if (i.forwardExtends) {
205+
result[i.forwardExtends] = true;
206+
}
205207
iNameToIDependList[i.name].forEach((name) => {
206208
name = name.replace(/<.*>$/, "");
207-
(result[name] ??= []).push(i.name);
209+
result[name] = true;
208210
});
209211
return result;
210212
},
@@ -1526,6 +1528,7 @@ export function emitWebIdl(
15261528
name: i.name,
15271529
extends: i.forwardExtends,
15281530
constructor: undefined,
1531+
noToStringTag: true,
15291532
});
15301533
}
15311534

@@ -1653,7 +1656,7 @@ export function emitWebIdl(
16531656
return;
16541657
}
16551658
// Do not emit toString tag if interface is an inheritance target of other interfaces
1656-
if (iNameToIChildrenList[i.name].length) {
1659+
if (iNameIsInheritanceTarget[i.name]) {
16571660
return;
16581661
}
16591662
printer.printLine(

0 commit comments

Comments
 (0)