|
|
|
@ -42,6 +42,9 @@ class CompilerContainer { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
deactivate () { |
|
|
|
|
// deactivate editor listeners
|
|
|
|
|
this.editor.event.unregister('contentChanged') |
|
|
|
|
this.editor.event.unregister('sessionSwitched') |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
activate () { |
|
|
|
@ -50,8 +53,10 @@ class CompilerContainer { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
listenToEvents () { |
|
|
|
|
this.editor.event.register('contentChanged', this.scheduleCompilation.bind(this)) |
|
|
|
|
this.editor.event.register('sessionSwitched', this.scheduleCompilation.bind(this)) |
|
|
|
|
this.editor.event.register('sessionSwitched', () => { |
|
|
|
|
if (!this._view.compileIcon) return |
|
|
|
|
this.scheduleCompilation() |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
this.compileTabLogic.event.on('startingCompilation', () => { |
|
|
|
|
if (!this._view.compileIcon) return |
|
|
|
@ -73,6 +78,7 @@ class CompilerContainer { |
|
|
|
|
|
|
|
|
|
this.editor.event.register('contentChanged', () => { |
|
|
|
|
if (!this._view.compileIcon) return |
|
|
|
|
this.scheduleCompilation.bind(this) |
|
|
|
|
this._view.compileIcon.classList.add(`${css.bouncingIcon}`) // @TODO: compileView tab
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
@ -131,12 +137,13 @@ class CompilerContainer { |
|
|
|
|
|
|
|
|
|
// Load solc compiler version according to pragma in contract file
|
|
|
|
|
_setCompilerVersionFromPragma (filename) { |
|
|
|
|
if (!this.data.allversions) return |
|
|
|
|
this.compileTabLogic.fileManager.getFile(filename).then(data => { |
|
|
|
|
const pragmaArr = data.match(/(pragma solidity (.+?);)/g) |
|
|
|
|
if (pragmaArr && pragmaArr.length === 1) { |
|
|
|
|
const pragmaStr = pragmaArr[0].replace('pragma solidity', '').trim() |
|
|
|
|
const pragma = pragmaStr.substring(0, pragmaStr.length - 1) |
|
|
|
|
const releasedVersions = (this.data.allversions) ? this.data.allversions.filter(obj => !obj.prerelease).map(obj => obj.version) : [] |
|
|
|
|
const releasedVersions = this.data.allversions.filter(obj => !obj.prerelease).map(obj => obj.version) |
|
|
|
|
const allVersions = this.data.allversions.map(obj => this._retrieveVersion(obj.version)) |
|
|
|
|
const currentCompilerName = this._retrieveVersion(this._view.versionSelector.selectedOptions[0].label) |
|
|
|
|
// contains only numbers part, for example '0.4.22'
|
|
|
|
|