move memory panel logic to caller

pull/1/head
Iuri Matias 6 years ago committed by yann300
parent 508f47ec77
commit e57a2bc7f7
  1. 18
      src/app/debugger/debuggerUI/VmDebugger.js
  2. 28
      src/app/debugger/debuggerUI/vmDebugger/MemoryPanel.js

@ -12,6 +12,8 @@ var DropdownPanel = require('../remix-debugger/src/ui/DropdownPanel')
var SolidityState = require('../remix-debugger/src/ui/SolidityState')
var SolidityLocals = require('../remix-debugger/src/ui/SolidityLocals')
var remixDebug = require('remix-debug')
var remixLib = require('remix-lib')
var ui = remixLib.helpers.ui
var StorageResolver = remixDebug.storage.StorageResolver
var yo = require('yo-yo')
@ -53,9 +55,23 @@ function VmDebugger (_parentUI, _traceManager, _codeManager, _solidityProxy, _ca
})
})
this.memoryPanel = new MemoryPanel()
_parentUI.event.register('indexChanged', this, function (index) {
if (index < 0) return
if (_parentUI.currentStepIndex !== index) return
_traceManager.getMemoryAt(index, function (error, memory) {
if (error) {
console.log(error)
self.memoryPanel.update({})
} else if (_parentUI.currentStepIndex === index) {
self.memoryPanel.update(ui.formatMemory(memory, 16))
}
})
})
this.stackPanel = new StackPanel(_parentUI, _traceManager)
this.storagePanel = new StoragePanel(_parentUI, _traceManager)
this.memoryPanel = new MemoryPanel(_parentUI, _traceManager)
this.callstackPanel = new CallstackPanel(_parentUI, _traceManager)
this.stepDetail = new StepDetail(_parentUI, _traceManager)
this.solidityState = new SolidityState(_parentUI, _traceManager, _codeManager, _solidityProxy)

@ -1,39 +1,21 @@
'use strict'
var DropdownPanel = require('./DropdownPanel')
var remixLib = require('remix-lib')
var ui = remixLib.helpers.ui
var yo = require('yo-yo')
function MemoryPanel (_parent, _traceManager) {
this.parent = _parent
this.traceManager = _traceManager
function MemoryPanel () {
this.basicPanel = new DropdownPanel('Memory', {
json: true,
css: {
'font-family': 'monospace'
}})
this.init()
}
MemoryPanel.prototype.render = function () {
return yo`<div id='memorypanel' >${this.basicPanel.render()}</div>`
MemoryPanel.prototype.update = function (calldata) {
this.basicPanel.update(calldata)
}
MemoryPanel.prototype.init = function () {
var self = this
this.parent.event.register('indexChanged', this, function (index) {
if (index < 0) return
if (self.parent.currentStepIndex !== index) return
self.traceManager.getMemoryAt(index, function (error, memory) {
if (error) {
console.log(error)
self.basicPanel.update({})
} else if (self.parent.currentStepIndex === index) {
self.basicPanel.update(ui.formatMemory(memory, 16))
}
})
})
MemoryPanel.prototype.render = function () {
return yo`<div id='memorypanel' >${this.basicPanel.render()}</div>`
}
module.exports = MemoryPanel

Loading…
Cancel
Save