@@ -18,8 +18,8 @@ enum CompilationEvents {
1818
1919export interface CompileOutput {
2020 file : string ;
21- out ?: String ;
22- err ?: String ;
21+ out ?: string ;
22+ err ?: string ;
2323 map ?: SourceMap . Mapping ;
2424}
2525
@@ -33,13 +33,13 @@ export class CompilerFactory {
3333 }
3434
3535 public pickCompiler ( file : string ) : Compiler {
36- let fileType = getFileExtension ( file ) ;
36+ const fileType = getFileExtension ( file ) ;
3737 switch ( fileType ) {
38- case 'wast' :
39- case 'wat' :
40- return this . wat ;
41- case 'ts' :
42- return this . asc ;
38+ case 'wast' :
39+ case 'wat' :
40+ return this . wat ;
41+ case 'ts' :
42+ return this . asc ;
4343 }
4444 throw new Error ( 'Unsupported file type' ) ;
4545 }
@@ -95,15 +95,15 @@ export class WatCompiler extends Compiler {
9595 return new Promise < CompileOutput > ( ( resolve , reject ) => {
9696 const file = `${ dir } /upload.wasm` ;
9797 const command = `${ this . wabt } /wat2wasm --no-canonicalize-leb128s --disable-bulk-memory --debug-names -v -o ${ file } ${ program } ` ;
98- let out : String = '' ;
99- let err : String = '' ;
98+ let out : string = '' ;
99+ let err : string = '' ;
100100
101- function handle ( error : ExecException | null , stdout : String , stderr : any ) {
101+ function handle ( error : ExecException | null , stdout : string ) {
102102 out = stdout ;
103103 err = error ?. message ?? '' ;
104104 }
105105
106- let compile = exec ( command , handle ) ;
106+ const compile = exec ( command , handle ) ;
107107 this . emit ( CompilationEvents . started , command ) ;
108108
109109 compile . on ( 'close' , ( code ) => {
@@ -124,7 +124,7 @@ export class WatCompiler extends Compiler {
124124 return new Promise < CompileOutput > ( ( resolve , reject ) => {
125125 const command = `${ this . wabt } /wasm-objdump -x -m ${ output . file } ` ;
126126
127- let compile = exec ( command , ( error : ExecException | null , stdout : String , stderr : any ) => {
127+ const compile = exec ( command , ( error : ExecException | null , stdout : string ) => {
128128 output . map = this . parseWasmObjDump ( output , stdout . toString ( ) ) ;
129129 this . emit ( CompilationEvents . sourcemap ) ;
130130 resolve ( output ) ;
@@ -212,17 +212,17 @@ export class AsScriptCompiler extends Compiler {
212212
213213 // compile AS to Wasm and WAT
214214 return new Promise < CompileOutput > ( async ( resolve , reject ) => {
215- let file = `${ dir } /upload.wasm` ;
215+ const file = `${ dir } /upload.wasm` ;
216216 const command = await this . getCompilationCommand ( program , file ) ;
217- let out : String = '' ;
218- let err : String = '' ;
217+ let out : string = '' ;
218+ let err : string = '' ;
219219
220- function handle ( error : ExecException | null , stdout : String , stderr : any ) {
220+ function handle ( error : ExecException | null , stdout : string ) {
221221 out = stdout ;
222222 err = error ?. message ?? '' ;
223223 }
224224
225- let compile = exec ( command , handle ) ;
225+ const compile = exec ( command , handle ) ;
226226
227227 compile . on ( 'close' , ( code ) => {
228228 if ( code !== 0 ) {
@@ -239,23 +239,23 @@ export class AsScriptCompiler extends Compiler {
239239 private getCompilationCommand ( program : string , output : string ) : Promise < string > {
240240 // builds asc command based on the version of asc
241241 return new Promise < string > ( async ( resolve ) => {
242- let version : Version = await AsScriptCompiler . retrieveVersion ( ) ;
242+ const version : Version = await AsScriptCompiler . retrieveVersion ( ) ;
243243 resolve ( `npx asc ${ program } --exportTable --disable bulk-memory --sourceMap --debug ` +
244244 `${ ( version . major > 0 || + version . minor >= 20 ) ? '--outFile' : '--binaryFile' } ${ output } ` ) ;
245245 } ) ;
246246 }
247247
248248 private static retrieveVersion ( ) : Promise < Version > {
249249 return new Promise < Version > ( ( resolve , reject ) => {
250- let out : String = '' ;
251- let err : String = '' ;
250+ let out : string = '' ;
251+ let err : string = '' ;
252252
253- function handle ( error : ExecException | null , stdout : String , stderr : any ) {
253+ function handle ( error : ExecException | null , stdout : string ) {
254254 out = stdout ;
255255 err = error ?. message ?? '' ;
256256 }
257257
258- let compilerVersion = exec ( 'npx asc --version' , handle ) ;
258+ const compilerVersion = exec ( 'npx asc --version' , handle ) ;
259259 compilerVersion . on ( 'close' , ( code ) => {
260260 if ( code !== 0 ) {
261261 reject ( `asc --version failed: ${ err } ` ) ;
@@ -299,7 +299,7 @@ function parseLines(context: CompileOutput): SourceMap.SourceLine[] {
299299
300300 const lines : string [ ] = context . out . split ( '\n' ) ;
301301 const corrections = extractSectionAddressCorrections ( lines ) ;
302- let result : SourceLine [ ] = [ ] ;
302+ const result : SourceLine [ ] = [ ] ;
303303 let lastLineInfo = undefined ;
304304 for ( let i = 0 ; i < lines . length ; i ++ ) {
305305 const line = lines [ i ] ;
@@ -331,8 +331,8 @@ function parseLines(context: CompileOutput): SourceMap.SourceLine[] {
331331}
332332
333333export function extractAddressInformation ( addressLine : string ) : string {
334- let regexpr = / ^ (?< address > ( [ \d a - f ] ) + ) : / ;
335- let match = addressLine . match ( regexpr ) ;
334+ const regexpr = / ^ (?< address > ( [ \d a - f ] ) + ) : / ;
335+ const match = addressLine . match ( regexpr ) ;
336336 if ( match ?. groups ) {
337337 return match . groups . address ;
338338 }
0 commit comments