@@ -59,12 +59,8 @@ function createTextWriter(newLine: string) {
59
59
/** print declarations conflicting with base interface to a side list to write them under a diffrent name later */
60
60
let stack : { content : string , indent : number } [ ] = [ ] ;
61
61
62
- const indentStrings : string [ ] = [ "" , " " ] ;
63
62
function getIndentString ( level : number ) {
64
- if ( indentStrings [ level ] === undefined ) {
65
- indentStrings [ level ] = getIndentString ( level - 1 ) + indentStrings [ 1 ] ;
66
- }
67
- return indentStrings [ level ] ;
63
+ return " " . repeat ( level ) ;
68
64
}
69
65
70
66
function write ( s : string ) {
@@ -90,13 +86,12 @@ function createTextWriter(newLine: string) {
90
86
reset ( ) ;
91
87
92
88
return {
93
- reset : reset ,
89
+ reset,
94
90
95
- resetIndent ( ) { indent = 0 ; } ,
96
91
increaseIndent ( ) { indent ++ ; } ,
97
92
decreaseIndent ( ) { indent -- ; } ,
98
93
99
- endLine : endLine ,
94
+ endLine,
100
95
print : write ,
101
96
printLine ( c : string ) { write ( c ) ; endLine ( ) ; } ,
102
97
@@ -830,7 +825,7 @@ export function emitWebIdl(webidl: Browser.WebIdl, flavor: Flavor) {
830
825
. filter ( i => i !== "Object" )
831
826
. map ( processIName ) ) ;
832
827
833
- if ( finalExtends && finalExtends . length ) {
828
+ if ( finalExtends . length ) {
834
829
printer . print ( ` extends ${ finalExtends . join ( ", " ) } ` ) ;
835
830
}
836
831
printer . print ( " {" ) ;
@@ -916,7 +911,6 @@ export function emitWebIdl(webidl: Browser.WebIdl, flavor: Flavor) {
916
911
printer . clearStack ( ) ;
917
912
emitInterfaceEventMap ( i ) ;
918
913
919
- printer . resetIndent ( ) ;
920
914
emitInterfaceDeclaration ( i ) ;
921
915
printer . increaseIndent ( ) ;
922
916
@@ -950,7 +944,6 @@ export function emitWebIdl(webidl: Browser.WebIdl, flavor: Flavor) {
950
944
// Because in the two cases the interface contains different things, it might be easier to
951
945
// read to separate them into two functions.
952
946
function emitStaticInterfaceWithNonStaticMembers ( ) {
953
- printer . resetIndent ( ) ;
954
947
emitInterfaceDeclaration ( i ) ;
955
948
printer . increaseIndent ( ) ;
956
949
@@ -971,7 +964,6 @@ export function emitWebIdl(webidl: Browser.WebIdl, flavor: Flavor) {
971
964
}
972
965
973
966
function emitPureStaticInterface ( ) {
974
- printer . resetIndent ( ) ;
975
967
emitInterfaceDeclaration ( i ) ;
976
968
printer . increaseIndent ( ) ;
977
969
0 commit comments