move asmCode logic to caller

pull/3094/head
Iuri Matias 6 years ago committed by yann300
parent 4828d99c81
commit 4e7b53b7eb
  1. 8
      src/app/debugger/debuggerUI/VmDebugger.js
  2. 13
      src/app/debugger/debuggerUI/vmDebugger/CodeListView.js

@ -31,7 +31,13 @@ function VmDebugger (_parentUI, _traceManager, _codeManager, _solidityProxy, _ca
let _parent = _parentUI.debugger let _parent = _parentUI.debugger
var self = this var self = this
this.view this.view
this.asmCode = new CodeListView(_parent, _codeManager)
this.asmCode = new CodeListView()
_codeManager.event.register('changed', this.asmCode.changed.bind(this.asmCode))
_parent.event.register('traceUnloaded', this, function () {
self.asmCode.changed([], '', -1)
})
this.stackPanel = new StackPanel(_parentUI, _traceManager) this.stackPanel = new StackPanel(_parentUI, _traceManager)
this.storagePanel = new StoragePanel(_parentUI, _traceManager) this.storagePanel = new StoragePanel(_parentUI, _traceManager)
this.memoryPanel = new MemoryPanel(_parentUI, _traceManager) this.memoryPanel = new MemoryPanel(_parentUI, _traceManager)

@ -15,10 +15,8 @@ var css = csjs`
max-height: 150px; max-height: 150px;
} }
` `
function CodeListView (_parent, _codeManager) { function CodeListView () {
this.event = new EventManager() this.event = new EventManager()
this.parent = _parent
this.codeManager = _codeManager
this.code this.code
this.address this.address
this.codeView this.codeView
@ -30,21 +28,12 @@ function CodeListView (_parent, _codeManager) {
this.basicPanel.event.register('show', () => { this.basicPanel.event.register('show', () => {
this.event.trigger('show', []) this.event.trigger('show', [])
}) })
this.init()
} }
CodeListView.prototype.render = function () { CodeListView.prototype.render = function () {
return yo`<div id='asmcodes' >${this.basicPanel.render({height: style.instructionsList.height})}</div>` return yo`<div id='asmcodes' >${this.basicPanel.render({height: style.instructionsList.height})}</div>`
} }
CodeListView.prototype.init = function () {
var self = this
this.codeManager.event.register('changed', this, this.changed)
this.parent.event.register('traceUnloaded', this, function () {
self.changed([], '', -1)
})
}
CodeListView.prototype.indexChanged = function (index) { CodeListView.prototype.indexChanged = function (index) {
if (index < 0) return if (index < 0) return
if (this.itemSelected) { if (this.itemSelected) {

Loading…
Cancel
Save