Commit 54dd28df authored by Iuri Matias's avatar Iuri Matias Committed by yann300

completly remove debuggerUI reference dependency

parent cdbd7114
...@@ -10,10 +10,9 @@ var DebuggerSolidityLocals = require('./solidityLocals') ...@@ -10,10 +10,9 @@ var DebuggerSolidityLocals = require('./solidityLocals')
class VmDebuggerLogic { class VmDebuggerLogic {
constructor (_parentUI, tx, _stepManager, _traceManager, _codeManager, _solidityProxy, _callTree) { constructor (_debugger, tx, _stepManager, _traceManager, _codeManager, _solidityProxy, _callTree) {
this.event = new EventManager() this.event = new EventManager()
this._parentUI = _parentUI this.debugger = _debugger
this.debugger = this._parentUI.debugger
this.stepManager = _stepManager this.stepManager = _stepManager
this._traceManager = _traceManager this._traceManager = _traceManager
this._codeManager = _codeManager this._codeManager = _codeManager
...@@ -63,7 +62,7 @@ class VmDebuggerLogic { ...@@ -63,7 +62,7 @@ class VmDebuggerLogic {
listenToTraceManagerEvents () { listenToTraceManagerEvents () {
const self = this const self = this
this._parentUI.event.register('indexChanged', this, function (index) { this.event.register('indexChanged', this, function (index) {
if (index < 0) return if (index < 0) return
if (self.stepManager.currentStepIndex !== index) return if (self.stepManager.currentStepIndex !== index) return
...@@ -217,7 +216,7 @@ class VmDebuggerLogic { ...@@ -217,7 +216,7 @@ class VmDebuggerLogic {
listenToSolidityStateEvents () { listenToSolidityStateEvents () {
const self = this const self = this
this._parentUI.event.register('indexChanged', this.debuggerSolidityState.init.bind(this.debuggerSolidityState)) this.event.register('indexChanged', this.debuggerSolidityState.init.bind(this.debuggerSolidityState))
this.debuggerSolidityState.event.register('solidityState', function (state) { this.debuggerSolidityState.event.register('solidityState', function (state) {
self.event.trigger('solidityState', [state]) self.event.trigger('solidityState', [state])
}) })
...@@ -227,13 +226,13 @@ class VmDebuggerLogic { ...@@ -227,13 +226,13 @@ class VmDebuggerLogic {
this.debuggerSolidityState.event.register('solidityStateUpdating', function () { this.debuggerSolidityState.event.register('solidityStateUpdating', function () {
self.event.trigger('solidityStateUpdating', []) self.event.trigger('solidityStateUpdating', [])
}) })
this._parentUI.event.register('traceUnloaded', this.debuggerSolidityState.reset.bind(this.debuggerSolidityState)) this.event.register('traceUnloaded', this.debuggerSolidityState.reset.bind(this.debuggerSolidityState))
this._parentUI.event.register('newTraceLoaded', this.debuggerSolidityState.reset.bind(this.debuggerSolidityState)) this.event.register('newTraceLoaded', this.debuggerSolidityState.reset.bind(this.debuggerSolidityState))
} }
listenToSolidityLocalsEvents () { listenToSolidityLocalsEvents () {
const self = this const self = this
this._parentUI.event.register('sourceLocationChanged', this.debuggerSolidityLocals.init.bind(this.debuggerSolidityLocals)) this.event.register('sourceLocationChanged', this.debuggerSolidityLocals.init.bind(this.debuggerSolidityLocals))
this.debuggerSolidityLocals.event.register('solidityLocals', function (state) { this.debuggerSolidityLocals.event.register('solidityLocals', function (state) {
self.event.trigger('solidityLocals', [state]) self.event.trigger('solidityLocals', [state])
}) })
......
...@@ -76,22 +76,29 @@ Debugger.prototype.registerAndHighlightCodeItem = function (index) { ...@@ -76,22 +76,29 @@ Debugger.prototype.registerAndHighlightCodeItem = function (index) {
}) })
} }
Debugger.prototype.debug = function (parent, tx, loadingCb) { Debugger.prototype.debug = function (tx, loadingCb) {
const self = this const self = this
this.step_manager = new StepManager(this.debugger, this.debugger.traceManager) this.step_manager = new StepManager(this.debugger, this.debugger.traceManager)
parent.event.register('indexChanged', this, (index) => {
self.step_manager.event.trigger('indexChanged', [index])
})
this.debugger.codeManager.event.register('changed', this, (code, address, instIndex) => { this.debugger.codeManager.event.register('changed', this, (code, address, instIndex) => {
self.debugger.callTree.sourceLocationTracker.getSourceLocationFromVMTraceIndex(address, this.step_manager.currentStepIndex, this.debugger.solidityProxy.contracts, (error, sourceLocation) => { self.debugger.callTree.sourceLocationTracker.getSourceLocationFromVMTraceIndex(address, this.step_manager.currentStepIndex, this.debugger.solidityProxy.contracts, (error, sourceLocation) => {
if (!error) { if (!error) {
parent.event.trigger('sourceLocationChanged', [sourceLocation]) self.vmDebuggerLogic.event.trigger('sourceLocationChanged', [sourceLocation])
} }
}) })
}) })
this.vmDebuggerLogic = new VmDebuggerLogic(parent, tx, this.step_manager, this.debugger.traceManager, this.debugger.codeManager, this.debugger.solidityProxy, this.debugger.callTree) this.vmDebuggerLogic = new VmDebuggerLogic(this.debugger, tx, this.step_manager, this.debugger.traceManager, this.debugger.codeManager, this.debugger.solidityProxy, this.debugger.callTree)
this.debugger.event.register('traceUnloaded', function () {
console.dir('---> traceUnloaded on debugger')
self.vmDebuggerLogic.event.trigger('traceUnloaded')
})
// TODO: doesn't seem to be triggered; parent=debuggerUI
// parent.event.register('newTraceLoaded', function () {
// self.vmDebuggerLogic.event.trigger('newTraceLoaded')
// })
loadingCb() loadingCb()
this.debugger.debug(tx) this.debugger.debug(tx)
......
...@@ -46,7 +46,6 @@ class DebuggerUI { ...@@ -46,7 +46,6 @@ class DebuggerUI {
this.sourceHighlighter = new SourceHighlighter() this.sourceHighlighter = new SourceHighlighter()
this.startTxBrowser() this.startTxBrowser()
// this.startStepManager()
this.stepManager = null this.stepManager = null
this.tx this.tx
...@@ -56,6 +55,8 @@ class DebuggerUI { ...@@ -56,6 +55,8 @@ class DebuggerUI {
this.event.register('indexChanged', this, function (index) { this.event.register('indexChanged', this, function (index) {
self.debugger.codeManager.resolveStep(index, self.tx) self.debugger.codeManager.resolveStep(index, self.tx)
self.transactionDebugger.step_manager.event.trigger('indexChanged', [index])
self.transactionDebugger.vmDebuggerLogic.event.trigger('indexChanged', [index])
}) })
container.appendChild(this.render()) container.appendChild(this.render())
...@@ -163,7 +164,7 @@ class DebuggerUI { ...@@ -163,7 +164,7 @@ class DebuggerUI {
// still here because tx is being reffered in children // still here because tx is being reffered in children
this.tx = tx this.tx = tx
this.transactionDebugger.debug(this, tx, () => { this.transactionDebugger.debug(tx, () => {
self.stepManager = new StepManagerUI(this.transactionDebugger.step_manager) self.stepManager = new StepManagerUI(this.transactionDebugger.step_manager)
self.stepManager.event.register('stepChanged', this, function (stepIndex) { self.stepManager.event.register('stepChanged', this, function (stepIndex) {
self.stepManager.currentStepIndex = stepIndex self.stepManager.currentStepIndex = stepIndex
......
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