1
1
import * as Browser from "./types" ;
2
- import { mapToArray , distinct , map , toNameMap , mapDefined , arrayToMap , flatMap , integerTypes , baseTypeConversionMap } from "./helpers" ;
2
+ import { mapToArray , distinct , map , toNameMap , mapDefined , arrayToMap , integerTypes , baseTypeConversionMap } from "./helpers" ;
3
3
import { collectLegacyNamespaceTypes } from "./legacy-namespace" ;
4
4
5
5
export const enum Flavor {
@@ -131,14 +131,14 @@ export function emitWebIdl(webidl: Browser.WebIdl, flavor: Flavor, iterator: boo
131
131
getElements ( webidl . mixins , "mixin" ) ) ;
132
132
133
133
const allInterfacesMap = toNameMap ( allInterfaces ) ;
134
- const allLegacyWindowAliases = flatMap ( allInterfaces , i => i [ "legacy-window-alias" ] ) ;
134
+ const allLegacyWindowAliases = allInterfaces . flatMap ( i => i [ "legacy-window-alias" ] ) ;
135
135
const allDictionariesMap = webidl . dictionaries ? webidl . dictionaries . dictionary : { } ;
136
136
const allEnumsMap = webidl . enums ? webidl . enums . enum : { } ;
137
137
const allCallbackFunctionsMap = webidl [ "callback-functions" ] ? webidl [ "callback-functions" ] ! [ "callback-function" ] : { } ;
138
138
const allTypeDefsMap = new Set ( webidl . typedefs && webidl . typedefs . typedef . map ( td => td [ "new-type" ] ) ) ;
139
139
140
140
/// Event name to event type map
141
- const eNameToEType = arrayToMap ( flatMap ( allNonCallbackInterfaces , i => i . events ? i . events . event : [ ] ) , e => e . name , e => eventTypeMap [ e . name ] || e . type ) ;
141
+ const eNameToEType = arrayToMap ( allNonCallbackInterfaces . flatMap ( i => i . events ? i . events . event : [ ] ) , e => e . name , e => eventTypeMap [ e . name ] || e . type ) ;
142
142
143
143
/// Tag name to element name map
144
144
const tagNameToEleName = getTagNameToElementNameMap ( ) ;
@@ -149,7 +149,7 @@ export function emitWebIdl(webidl: Browser.WebIdl, flavor: Flavor, iterator: boo
149
149
150
150
/// Distinct event type list, used in the "createEvent" function
151
151
const distinctETypeList = distinct (
152
- flatMap ( allNonCallbackInterfaces , i => i . events ? i . events . event . map ( e => e . type ) : [ ] )
152
+ allNonCallbackInterfaces . flatMap ( i => i . events ? i . events . event . map ( e => e . type ) : [ ] )
153
153
. concat ( allNonCallbackInterfaces . filter ( i => i . extends && i . extends . endsWith ( "Event" ) && i . name . endsWith ( "Event" ) ) . map ( i => i . name ) )
154
154
) . sort ( ) ;
155
155
@@ -235,7 +235,7 @@ export function emitWebIdl(webidl: Browser.WebIdl, flavor: Flavor, iterator: boo
235
235
236
236
const iExtends = i . extends && i . extends . replace ( / < .* > $ / , '' ) ;
237
237
const parentWithEventHandler = allInterfacesMap [ iExtends ] && getParentEventHandler ( allInterfacesMap [ iExtends ] ) || [ ] ;
238
- const mixinsWithEventHandler = flatMap ( i . implements || [ ] , i => getParentEventHandler ( allInterfacesMap [ i ] ) ) ;
238
+ const mixinsWithEventHandler = ( i . implements || [ ] ) . flatMap ( i => getParentEventHandler ( allInterfacesMap [ i ] ) ) ;
239
239
240
240
return distinct ( parentWithEventHandler . concat ( mixinsWithEventHandler ) ) ;
241
241
}
@@ -246,7 +246,7 @@ export function emitWebIdl(webidl: Browser.WebIdl, flavor: Flavor, iterator: boo
246
246
return ( hasConst ? [ i ] : [ ] ) . concat ( getParentsWithConstant ( i ) ) ;
247
247
}
248
248
249
- const mixinsWithConstant = flatMap ( i . implements || [ ] , i => getParentConstant ( allInterfacesMap [ i ] ) ) ;
249
+ const mixinsWithConstant = ( i . implements || [ ] ) . flatMap ( i => getParentConstant ( allInterfacesMap [ i ] ) ) ;
250
250
251
251
return distinct ( mixinsWithConstant ) ;
252
252
}
0 commit comments