@ -134,6 +134,33 @@ class CompilerContainer {
< / s e l e c t > `
this . _view . version = yo ` <span id="version"></span> `
this . _view . evmVersionSelector = yo `
< select onchange = "${this.onchangeEvmVersion.bind(this)}" class = "custom-select" id = "evmVersionSelector" >
< option disabled selected > EVM Version : default < / o p t i o n >
< option value = "default" > compiler default < / o p t i o n >
< option > petersburg < / o p t i o n >
< option > constantinople < / o p t i o n >
< option > byzantium < / o p t i o n >
< option > spuriousDragon < / o p t i o n >
< option > tangerineWhistle < / o p t i o n >
< option > homestead < / o p t i o n >
< / s e l e c t > `
if ( this . compileTabLogic . evmVersion ) {
let s = this . _view . evmVersionSelector
let i
for ( i = 0 ; i < s . options . length ; i ++ ) {
if ( s . options [ i ] . value === this . compileTabLogic . evmVersion ) {
break
}
}
if ( i === s . options . length ) { // invalid evmVersion from queryParams
s . selectedIndex = 1 // compiler default
this . onchangeEvmVersion ( )
} else {
s . selectedIndex = i
}
}
this . _view . compilationButton = this . compilationButton ( )
this . _view . compileContainer = yo `
@ -145,6 +172,9 @@ class CompilerContainer {
< label class = "input-group-text border-0" for = "versionSelector" > Compiler < / l a b e l >
< / d i v >
$ { this . _view . versionSelector }
< div class = "input-group-prepend" >
< / d i v >
$ { this . _view . evmVersionSelector }
< / h e a d e r >
$ { this . _view . compilationButton }
< / a r t i c l e >
@ -189,6 +219,22 @@ class CompilerContainer {
this . compileTabLogic . runCompiler ( )
}
onchangeEvmVersion ( _ ) {
let s = this . _view . evmVersionSelector
let v = s . value
if ( v === 'default' ) {
v = null
}
this . compileTabLogic . setEvmVersion ( v )
if ( ! v ) {
v = 'default'
}
const o = yo ` <option disabled="disabled" selected="selected">EVM Version: ${ v } </option> `
s . options [ 0 ] = o
s . selectedIndex = 0
// calling `runCompiler()` here would cause the UI to freeze with the selection drop down menu open
}
onchangeLoadVersion ( event ) {
this . data . selectedVersion = this . _view . versionSelector . value
this . _updateVersionSelector ( )