From 7ac460aa09b06c100a0ab6741956e406354b9373 Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 22 Nov 2016 16:09:40 +0100 Subject: [PATCH] use only compiler compilation result property + send compilation result to the debugger --- src/app/debugger.js | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/app/debugger.js b/src/app/debugger.js index fe94132910..742436d1c4 100644 --- a/src/app/debugger.js +++ b/src/app/debugger.js @@ -23,11 +23,6 @@ function Debugger (id, editor, compiler, executionContextEvent, switchToFile, of self.switchProvider(context) }) - this.lastCompilationResult = null - this.debugger.event.register('newTraceLoaded', this, function () { - self.lastCompilationResult = self.compiler.lastCompilationResult - }) - this.debugger.event.register('traceUnloaded', this, function () { self.removeCurrentMarker() }) @@ -40,10 +35,10 @@ function Debugger (id, editor, compiler, executionContextEvent, switchToFile, of // register selected code item, highlight the corresponding source location this.debugger.codeManager.event.register('changed', this, function (code, address, index) { - if (self.lastCompilationResult) { - this.debugger.sourceLocationTracker.getSourceLocation(address, index, self.lastCompilationResult.data.contracts, function (error, rawLocation) { + if (self.compiler.lastCompilationResult) { + this.debugger.sourceLocationTracker.getSourceLocation(address, index, self.compiler.lastCompilationResult.data.contracts, function (error, rawLocation) { if (!error) { - var lineColumnPos = self.offsetToLineColumnConverter.offsetToLineColumn(rawLocation, rawLocation.file, self.editor, self.lastCompilationResult.data) + var lineColumnPos = self.offsetToLineColumnConverter.offsetToLineColumn(rawLocation, rawLocation.file, self.editor, self.compiler.lastCompilationResult.data) self.highlight(lineColumnPos, rawLocation) } else { self.removeCurrentMarker() @@ -62,6 +57,7 @@ Debugger.prototype.debug = function (txHash) { var self = this this.debugger.web3().eth.getTransaction(txHash, function (error, tx) { if (!error) { + self.debugger.setCompilationResult(self.compiler.lastCompilationResult.data) self.debugger.debug(tx) } }) @@ -75,7 +71,7 @@ Debugger.prototype.debug = function (txHash) { */ Debugger.prototype.highlight = function (lineColumnPos, rawLocation) { var name = utils.fileNameFromKey(this.editor.getCacheFile()) // current opened tab - var source = this.lastCompilationResult.data.sourceList[rawLocation.file] // auto switch to that tab + var source = this.compiler.lastCompilationResult.data.sourceList[rawLocation.file] // auto switch to that tab this.removeCurrentMarker() if (name !== source) { this.switchToFile(source) // command the app to swicth to the next file