Skip to content

Commit

Permalink
Merge pull request #2087 from ethereum/Yul
Browse files Browse the repository at this point in the history
Select Yul compiler
  • Loading branch information
yann300 committed Jun 20, 2019
2 parents f4d9507 + c1e3fbf commit 0674d26
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/app/tabs/compileTab/compileTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,20 @@ class CompileTab {
this.compiler.setEvmVersion(this.evmVersion)
}

/**
* Set the compiler to using Solidity or Yul (default to Solidity)
* @params lang {'Solidity' | 'Yul'} ...
*/
setLanguage (lang) {
this.compiler.setLanguage(lang)
}

/**
* Compile a specific file of the file manager
* @param {string} target the path to the file to compile
*/
compileFile (target) {
if (!target) throw new Error('No target provided for compiliation')
if (!/\.sol/.exec(target)) throw new Error(`${target} is not a solidity file. It cannot be compiled with solidity compiler`)
// only compile *.sol file.
const provider = this.fileManager.fileProviderOf(target)
if (!provider) throw new Error(`cannot compile ${target}. Does not belong to any explorer`)
return new Promise((resolve, reject) => {
Expand Down
16 changes: 16 additions & 0 deletions src/app/tabs/compileTab/compilerContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,17 @@ class CompilerContainer {
${this._view.versionSelector}
</div>
</div>
<div class="row w-100 no-gutters mb-2">
<div class="col-sm-4">
<label class="input-group-text border-0" for="languageSelector">Language</label>
</div>
<div class="col-sm-8">
<select onchange="${this.onchangeLanguage.bind(this)}" class="custom-select" id="languageSelector">
<option>Solidity</option>
<option>Yul</option>
</select>
</div>
</div>
<div class="row w-100 no-gutters">
<div class="col-sm-4">
<label class="input-group-text border-0" for="evmVersionSelector">EVM Version</label>
Expand Down Expand Up @@ -227,6 +238,11 @@ class CompilerContainer {
this.compileTabLogic.runCompiler()
}

onchangeLanguage (event) {
this.compileTabLogic.setLanguage(event.target.value)
this.compile()
}

onchangeEvmVersion (_) {
let s = this._view.evmVersionSelector
let v = s.value
Expand Down

0 comments on commit 0674d26

Please sign in to comment.