@@ -288,8 +288,11 @@ export function emitWebIdl(
288
288
289
289
function getExtendList ( iName : string ) : string [ ] {
290
290
const i = allInterfacesMap [ iName ] ;
291
- if ( ! i || ! i . extends || i . extends === "Object" ) return [ ] ;
292
- else return getExtendList ( i . extends ) . concat ( i . extends ) ;
291
+ if ( ! i || ! i . extends || i . extends === "Object" ) {
292
+ return [ ] ;
293
+ } else {
294
+ return getExtendList ( i . extends ) . concat ( i . extends ) ;
295
+ }
293
296
}
294
297
295
298
function getImplementList ( iName : string ) {
@@ -377,8 +380,9 @@ export function emitWebIdl(
377
380
if ( obj . overrideType ) {
378
381
return obj . nullable ? makeNullable ( obj . overrideType ) : obj . overrideType ;
379
382
}
380
- if ( ! obj . type )
383
+ if ( ! obj . type ) {
381
384
throw new Error ( "Missing 'type' field in " + JSON . stringify ( obj ) ) ;
385
+ }
382
386
let type = convertDomTypeToTsTypeWorker ( obj , forReturn ) ;
383
387
if ( type === "Promise<undefined>" ) {
384
388
type = "Promise<void>" ;
@@ -501,7 +505,9 @@ export function emitWebIdl(
501
505
return objDomType ;
502
506
}
503
507
// Name of a type alias. Just return itself
504
- if ( allTypedefsMap [ objDomType ] ) return objDomType ;
508
+ if ( allTypedefsMap [ objDomType ] ) {
509
+ return objDomType ;
510
+ }
505
511
506
512
throw new Error ( "Unknown DOM type: " + objDomType ) ;
507
513
}
@@ -522,9 +528,15 @@ export function emitWebIdl(
522
528
function nameWithForwardedTypes ( i : Browser . Interface ) {
523
529
const typeParameters = i . typeParameters ;
524
530
525
- if ( i . overrideThis ) return i . overrideThis ;
526
- if ( ! typeParameters ) return i . name ;
527
- if ( ! typeParameters . length ) return i . name ;
531
+ if ( i . overrideThis ) {
532
+ return i . overrideThis ;
533
+ }
534
+ if ( ! typeParameters ) {
535
+ return i . name ;
536
+ }
537
+ if ( ! typeParameters . length ) {
538
+ return i . name ;
539
+ }
528
540
529
541
return `${ i . name } <${ typeParameters . map ( ( t ) => t . name ) } >` ;
530
542
}
@@ -971,7 +983,9 @@ export function emitWebIdl(
971
983
comments . push ( "Available only in secure contexts." ) ;
972
984
}
973
985
if ( entity . mdnUrl ) {
974
- if ( comments . length > 0 ) comments . push ( "" ) ;
986
+ if ( comments . length > 0 ) {
987
+ comments . push ( "" ) ;
988
+ }
975
989
comments . push ( `[MDN Reference](${ entity . mdnUrl } )` ) ;
976
990
}
977
991
@@ -1384,30 +1398,34 @@ export function emitWebIdl(
1384
1398
mTypes . length === 0 &&
1385
1399
amTypes . length === 1 &&
1386
1400
pTypes . length === 0
1387
- )
1401
+ ) {
1388
1402
return amTypes [ 0 ] === sig . type ;
1403
+ }
1389
1404
if (
1390
1405
mTypes . length === 1 &&
1391
1406
amTypes . length === 1 &&
1392
1407
pTypes . length === 0
1393
- )
1408
+ ) {
1394
1409
return mTypes [ 0 ] === amTypes [ 0 ] && amTypes [ 0 ] === sig . type ;
1410
+ }
1395
1411
if (
1396
1412
mTypes . length === 0 &&
1397
1413
amTypes . length === 1 &&
1398
1414
pTypes . length === 1
1399
- )
1415
+ ) {
1400
1416
return amTypes [ 0 ] === pTypes [ 0 ] && amTypes [ 0 ] === sig . type ;
1417
+ }
1401
1418
if (
1402
1419
mTypes . length === 1 &&
1403
1420
amTypes . length === 1 &&
1404
1421
pTypes . length === 1
1405
- )
1422
+ ) {
1406
1423
return (
1407
1424
mTypes [ 0 ] === amTypes [ 0 ] &&
1408
1425
amTypes [ 0 ] === pTypes [ 0 ] &&
1409
1426
amTypes [ 0 ] === sig . type
1410
1427
) ;
1428
+ }
1411
1429
}
1412
1430
}
1413
1431
}
@@ -1674,7 +1692,9 @@ export function emitWebIdl(
1674
1692
}
1675
1693
1676
1694
function emitSelfIterator ( i : Browser . Interface ) {
1677
- if ( ! compilerBehavior . useIteratorObject ) return ;
1695
+ if ( ! compilerBehavior . useIteratorObject ) {
1696
+ return ;
1697
+ }
1678
1698
const async = i . iterator ?. kind === "async_iterable" ;
1679
1699
const name = getName ( i ) ;
1680
1700
const iteratorBaseType = `${ async ? "Async" : "" } IteratorObject` ;
@@ -1770,10 +1790,13 @@ export function emitWebIdl(
1770
1790
isIndexedPropertyGetter ,
1771
1791
) ;
1772
1792
1773
- if ( anonymousGetter ) return anonymousGetter ;
1774
- else if ( i . methods )
1793
+ if ( anonymousGetter ) {
1794
+ return anonymousGetter ;
1795
+ } else if ( i . methods ) {
1775
1796
return mapToArray ( i . methods . method ) . find ( isIndexedPropertyGetter ) ;
1776
- else return undefined ;
1797
+ } else {
1798
+ return undefined ;
1799
+ }
1777
1800
}
1778
1801
1779
1802
function getIteratorSubtypes ( ) {
0 commit comments