Commit 8b0f3e1d authored by yann300's avatar yann300

check if compilation available

parent 51c57b3d
...@@ -17,29 +17,18 @@ function Debugger (id, appAPI, executionContextEvent, editorEvent) { ...@@ -17,29 +17,18 @@ function Debugger (id, appAPI, executionContextEvent, editorEvent) {
}) })
this.debugger.setBreakpointManager(this.breakPointManager) this.debugger.setBreakpointManager(this.breakPointManager)
this.breakPointManager.event.register('breakpointHit', (sourceLocation) => {}) this.breakPointManager.event.register('breakpointHit', (sourceLocation) => {
})
function convertSourceLocation (self, fileName, row) {
var source = {}
for (let file in self.compiler.lastCompilationResult.data.sourceList) {
if (self.compiler.lastCompilationResult.data.sourceList[file] === fileName) {
source.file = file
break
}
}
source.row = row
return source
}
editorEvent.register('breakpointCleared', (fileName, row) => { editorEvent.register('breakpointCleared', (fileName, row) => {
if (self.compiler.lastCompilationResult.data) { if (self.compiler.lastCompilationResult.data) {
this.breakPointManager.remove(convertSourceLocation(this, fileName, row)) this.breakPointManager.remove({fileName: fileName, row: row})
} }
}) })
editorEvent.register('breakpointAdded', (fileName, row) => { editorEvent.register('breakpointAdded', (fileName, row) => {
if (self.compiler.lastCompilationResult.data) { if (self.compiler.lastCompilationResult.data) {
this.breakPointManager.add(convertSourceLocation(this, fileName, row)) this.breakPointManager.add({fileName: fileName, row: row})
} }
}) })
...@@ -90,9 +79,11 @@ Debugger.prototype.debug = function (txHash) { ...@@ -90,9 +79,11 @@ Debugger.prototype.debug = function (txHash) {
Debugger.prototype.switchFile = function (rawLocation) { Debugger.prototype.switchFile = function (rawLocation) {
var name = this.editor.getCacheFile() // current opened tab var name = this.editor.getCacheFile() // current opened tab
var source = this.compiler.lastCompilationResult.data.sourceList[rawLocation.file] // auto switch to that tab if (this.compiler.lastCompilationResult.data) {
if (name !== source) { var source = this.compiler.lastCompilationResult.data.sourceList[rawLocation.file] // auto switch to that tab
this.switchToFile(source) // command the app to swicth to the next file if (name !== source) {
this.switchToFile(source) // command the app to swicth to the next file
}
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment