@ -176,7 +176,7 @@ class CompilerContainer {
this . compileTabLogic . compiler . event . register ( 'compilerLoaded' , ( version ) => this . setVersionText ( version ) )
this . fetchAllVersion ( ( allversions , selectedVersion , isURL ) => {
this . data . allversions = allversions
if ( isURL ) this . _updateVersionSelector ( selectedVersion )
if ( isURL ) this . _updateVersionSelector ( selectedVersion )
else {
this . data . selectedVersion = selectedVersion
if ( this . _view . versionSelector ) this . _updateVersionSelector ( )
@ -185,14 +185,28 @@ class CompilerContainer {
this . _view . warnCompilationSlow = yo ` <i title="Compilation Slow" style="visibility:hidden" class=" ${ css . warnCompilationSlow } fas fa-exclamation-triangle" aria-hidden="true"></i> `
this . _view . compileIcon = yo ` <i class="fas fa-sync ${ css . icon } " aria-hidden="true"></i> `
this . _view . autoCompile = yo ` <input class=" ${ css . autocompile } custom-control-input" onchange= ${ this . updateAutoCompile . bind ( this ) } data-id="compilerContainerAutoCompile" id="autoCompile" type="checkbox" title="Auto compile"> `
this . _view . hideWarningsBox = yo ` <input class=" ${ css . autocompile } custom-control-input" onchange= ${ this . hideWarnings . bind ( this ) } id="hideWarningsBox" type="checkbox" title="Hide warnings"> `
this . _view . autoCompile = yo ` <input class=" ${ css . autocompile } custom-control-input" onchange= ${ ( ) => this . updateAutoCompile ( ) } data-id="compilerContainerAutoCompile" id="autoCompile" type="checkbox" title="Auto compile"> `
this . _view . hideWarningsBox = yo ` <input class=" ${ css . autocompile } custom-control-input" onchange= ${ ( ) => this . hideWarnings ( ) } id="hideWarningsBox" type="checkbox" title="Hide warnings"> `
if ( this . data . autoCompile ) this . _view . autoCompile . setAttribute ( 'checked' , '' )
if ( this . data . hideWarnings ) this . _view . hideWarningsBox . setAttribute ( 'checked' , '' )
this . _view . optimize = yo ` <input onchange= ${ this . onchangeOptimize . bind ( this ) } class="custom-control-input" id="optimize" type="checkbox"> `
this . _view . optimize = yo ` <input onchange= ${ ( ) => this . onchangeOptimize ( ) } class="custom-control-input" id="optimize" type="checkbox"> `
if ( this . compileTabLogic . optimize ) this . _view . optimize . setAttribute ( 'checked' , '' )
this . _view . runs = yo ` <input
min = "1"
class = "custom-select ml-2 ${css.runs}"
id = "runs"
placeholder = "200"
type = "number"
title = "Number of optimisation runs."
onchange = $ { ( ) => this . onchangeRuns ( ) }
> `
if ( this . compileTabLogic . optimize ) this . _view . runs . removeAttribute ( 'disabled' )
else {
this . _view . runs . setAttribute ( 'disabled' , '' )
}
this . _view . versionSelector = yo `
< select onchange = "${this.onchangeLoadVersion.bind(this)}" class = "custom-select" id = "versionSelector" disabled >
< option disabled selected > $ { this . data . defaultVersion } < / o p t i o n >
@ -267,8 +281,11 @@ class CompilerContainer {
< label class = "form-check-label custom-control-label" for = "autoCompile" > Auto compile < / l a b e l >
< / d i v >
< div class = "mt-2 ${css.compilerConfig} custom-control custom-checkbox" >
$ { this . _view . optimize }
< label class = "form-check-label custom-control-label" for = "optimize" > Enable optimization < / l a b e l >
< div class = "justify-content-between align-items-center d-flex" >
$ { this . _view . optimize }
< label class = "form-check-label custom-control-label" for = "optimize" > Enable optimization < / l a b e l >
$ { this . _view . runs }
< / d i v >
< / d i v >
< div class = "mt-2 ${css.compilerConfig} custom-control custom-checkbox" >
$ { this . _view . hideWarningsBox }
@ -327,6 +344,16 @@ class CompilerContainer {
onchangeOptimize ( ) {
this . compileTabLogic . setOptimize ( ! ! this . _view . optimize . checked )
if ( this . compileTabLogic . optimize ) {
this . _view . runs . removeAttribute ( 'disabled' )
} else {
this . _view . runs . setAttribute ( 'disabled' , '' )
}
this . compileIfAutoCompileOn ( )
}
onchangeRuns ( ) {
this . compileTabLogic . setRuns ( parseInt ( this . _view . runs . value ) )
this . compileIfAutoCompileOn ( )
}
@ -360,6 +387,7 @@ class CompilerContainer {
this . setLanguage ( settings . language )
this . setEvmVersion ( settings . evmVersion )
this . setOptimize ( settings . optimize )
this . setRuns ( settings . runs )
this . setVersion ( settings . version )
}
@ -368,6 +396,13 @@ class CompilerContainer {
this . onchangeOptimize ( )
}
setRuns ( value ) {
if ( value ) {
this . _view . runs . value = value
this . onchangeRuns ( )
}
}
setLanguage ( lang ) {
this . _view . languageSelector . value = lang
this . onchangeLanguage ( )
@ -470,8 +505,8 @@ class CompilerContainer {
// Check if version is a URL and corresponding filename starts with 'soljson'
if ( selectedVersion . startsWith ( 'https://' ) ) {
const urlArr = selectedVersion . split ( '/' )
if ( urlArr [ urlArr . length - 1 ] . startsWith ( 'soljson' ) ) isURL = true
}
if ( urlArr [ urlArr . length - 1 ] . startsWith ( 'soljson' ) ) isURL = true
}
if ( wasmRes . event . type !== 'error' ) {
allVersionsWasm = JSON . parse ( wasmRes . json ) . builds . slice ( ) . reverse ( )
}