switch async exposed method to sync is possible

pull/3094/head
Grandschtroumpf 6 years ago
parent 90544db5c5
commit 2808c15c72
  1. 32
      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?
async highlight (mod, lineColumnPos, filePath, hexColor) {
return new Promise((resolve, reject) => {
let position
try {
position = JSON.parse(lineColumnPos)
} catch (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()
})
highlight (lineColumnPos, filePath, hexColor) {
const { from } = this.currentRequest
try {
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) {
throw e
}
}
async discardHighlight (mod) {
return new Promise((resolve, reject) => {
if (this.highlighters[mod]) this.highlighters[mod].currentSourceLocation(null)
resolve()
})
discardHighlight () {
const { from } = this.currentRequest
if (this.highlighters[from]) this.highlighters[from].currentSourceLocation(null)
}
}

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

Loading…
Cancel
Save