@@ -226,6 +226,10 @@ export function emitWebIdl(webidl: Browser.WebIdl, flavor: Flavor) {
226226 return ehParents ;
227227 }
228228
229+ if ( ! i . name ) {
230+ throw new Error ( "Unexpected nameless object: " + JSON . stringify ( i ) ) ;
231+ }
232+
229233 const iExtends = i . extends && i . extends . replace ( / < .* > $ / , '' ) ;
230234 const parentWithEventHandler = allInterfacesMap [ iExtends ] && getParentEventHandler ( allInterfacesMap [ iExtends ] ) || [ ] ;
231235 const mixinsWithEventHandler = flatMap ( i . implements || [ ] , i => getParentEventHandler ( allInterfacesMap [ i ] ) ) ;
@@ -695,7 +699,7 @@ export function emitWebIdl(webidl: Browser.WebIdl, flavor: Flavor) {
695699 const value = subtype [ subtype . length - 1 ] ;
696700 const key = subtype . length > 1 ? subtype [ 0 ] :
697701 i . iterator . kind === "iterable" ? "number" : value ;
698- const name = i . name . replace ( / e x t e n d s \w + / , "" ) ;
702+ const name = i . name + ( i . generic ? `< ${ i . generic . split ( " " ) [ 0 ] } >` : "" ) ;
699703 printer . printLine ( `forEach(callbackfn: (value: ${ value } , key: ${ key } , parent: ${ name } ) => void, thisArg?: any): void;` ) ;
700704 }
701705
@@ -1229,8 +1233,9 @@ export function emitWebIdl(webidl: Browser.WebIdl, flavor: Flavor) {
12291233 if ( subtypes ) {
12301234 const iteratorExtends = getIteratorExtends ( i . iterator , subtypes ) ;
12311235 const name = extendConflictsBaseTypes [ i . name ] ? `${ i . name } Base` : i . name ;
1236+ const generic = i . generic ? `<${ i . generic } >` : "" ;
12321237 printer . printLine ( "" ) ;
1233- printer . printLine ( `interface ${ name } ${ iteratorExtends } {` ) ;
1238+ printer . printLine ( `interface ${ name } ${ generic } ${ iteratorExtends } {` ) ;
12341239 printer . increaseIndent ( ) ;
12351240 if ( ! iteratorExtends ) {
12361241 printer . printLine ( `[Symbol.iterator](): IterableIterator<${ stringifySingleOrTupleTypes ( subtypes ) } >;` ) ;
0 commit comments