switch async exposed method to sync is possible

pull/3094/head
Grandschtroumpf 6 years ago
parent 90544db5c5
commit 2808c15c72
  1. 24
      src/app/editor/SourceHighlighters.js
  2. 14
      src/app/tabs/compile-tab.js

@ -19,27 +19,21 @@ class SourceHighlighters extends ApiFactory {
} }
} }
// TODO what to do with mod? highlight (lineColumnPos, filePath, hexColor) {
async highlight (mod, lineColumnPos, filePath, hexColor) { const { from } = this.currentRequest
return new Promise((resolve, reject) => {
let position
try { try {
position = JSON.parse(lineColumnPos) const position = JSON.parse(lineColumnPos)
if (!this.highlighters[from]) this.highlighters[from] = new SourceHighlighter()
this.highlighters[from].currentSourceLocation(null)
this.highlighters[from].currentSourceLocationFromfileName(position, filePath, hexColor)
} catch (e) { } catch (e) {
throw e throw e
} }
if (!this.highlighters[mod]) this.highlighters[mod] = new SourceHighlighter()
this.highlighters[mod].currentSourceLocation(null)
this.highlighters[mod].currentSourceLocationFromfileName(position, filePath, hexColor)
resolve()
})
} }
async discardHighlight (mod) { discardHighlight () {
return new Promise((resolve, reject) => { const { from } = this.currentRequest
if (this.highlighters[mod]) this.highlighters[mod].currentSourceLocation(null) if (this.highlighters[from]) this.highlighters[from].currentSourceLocation(null)
resolve()
})
} }
} }

@ -71,14 +71,6 @@ class CompileTab extends ApiFactory {
} }
} }
activate () {
this.listenToEvents()
this.compilerContainer.activate()
}
deactivate () {
}
/************ /************
* EVENTS * EVENTS
*/ */
@ -147,9 +139,7 @@ class CompileTab extends ApiFactory {
} }
getCompilationResult () { getCompilationResult () {
return new Promise((resolve, reject) => { return this.compileTabLogic.compiler.lastCompilationResult
resolve(this.compileTabLogic.compiler.lastCompilationResult)
})
} }
/********* /*********
@ -343,6 +333,8 @@ class CompileTab extends ApiFactory {
render () { render () {
if (this._view.el) return this._view.el if (this._view.el) return this._view.el
this.listenToEvents()
this.compilerContainer.activate()
this._view.errorContainer = yo`<div></div>` this._view.errorContainer = yo`<div></div>`
this._view.contractSelection = this.contractSelection() this._view.contractSelection = this.contractSelection()

Loading…
Cancel
Save