use only compiler compilation result property + send compilation result to the debugger

pull/1/head
yann300 8 years ago
parent b4a512ddba
commit 7ac460aa09
  1. 14
      src/app/debugger.js

@ -23,11 +23,6 @@ function Debugger (id, editor, compiler, executionContextEvent, switchToFile, of
self.switchProvider(context) 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 () { this.debugger.event.register('traceUnloaded', this, function () {
self.removeCurrentMarker() self.removeCurrentMarker()
}) })
@ -40,10 +35,10 @@ function Debugger (id, editor, compiler, executionContextEvent, switchToFile, of
// register selected code item, highlight the corresponding source location // register selected code item, highlight the corresponding source location
this.debugger.codeManager.event.register('changed', this, function (code, address, index) { this.debugger.codeManager.event.register('changed', this, function (code, address, index) {
if (self.lastCompilationResult) { if (self.compiler.lastCompilationResult) {
this.debugger.sourceLocationTracker.getSourceLocation(address, index, self.lastCompilationResult.data.contracts, function (error, rawLocation) { this.debugger.sourceLocationTracker.getSourceLocation(address, index, self.compiler.lastCompilationResult.data.contracts, function (error, rawLocation) {
if (!error) { 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) self.highlight(lineColumnPos, rawLocation)
} else { } else {
self.removeCurrentMarker() self.removeCurrentMarker()
@ -62,6 +57,7 @@ Debugger.prototype.debug = function (txHash) {
var self = this var self = this
this.debugger.web3().eth.getTransaction(txHash, function (error, tx) { this.debugger.web3().eth.getTransaction(txHash, function (error, tx) {
if (!error) { if (!error) {
self.debugger.setCompilationResult(self.compiler.lastCompilationResult.data)
self.debugger.debug(tx) self.debugger.debug(tx)
} }
}) })
@ -75,7 +71,7 @@ Debugger.prototype.debug = function (txHash) {
*/ */
Debugger.prototype.highlight = function (lineColumnPos, rawLocation) { Debugger.prototype.highlight = function (lineColumnPos, rawLocation) {
var name = utils.fileNameFromKey(this.editor.getCacheFile()) // current opened tab 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() this.removeCurrentMarker()
if (name !== source) { if (name !== source) {
this.switchToFile(source) // command the app to swicth to the next file this.switchToFile(source) // command the app to swicth to the next file

Loading…
Cancel
Save