move solidity locals logic to its own class

pull/1/head
Iuri Matias 6 years ago committed by yann300
parent 5b72f3bb3f
commit f8b97d514c
  1. 2
      src/app/debugger/debuggerUI/VmDebugger.js
  2. 96
      src/app/debugger/debuggerUI/vmDebugger/SolidityLocals.js

@ -202,7 +202,7 @@ function VmDebugger (_parentUI, _traceManager, _codeManager, _solidityProxy, _ca
self.storageResolver = new StorageResolver({web3: _parent.web3})
// self.solidityState.storageResolver = self.storageResolver
self.debuggerSolidityState.storageResolver = self.storageResolver
self.solidityLocals.storageResolver = self.storageResolver
self.solidityLocals.debuggerSolidityLocals.storageResolver = self.storageResolver
self.fullStoragesChangesPanel.storageResolver = self.storageResolver
self.asmCode.basicPanel.show()
self.stackPanel.basicPanel.show()

@ -8,58 +8,14 @@ var solidityTypeFormatter = require('./utils/SolidityTypeFormatter')
var StorageViewer = remixDebug.storage.StorageViewer
var yo = require('yo-yo')
// class DebuggerSolidityLocals {
//
// constructor (_parent, _traceManager, _internalTreeCall) {
//
// }
//
// }
class SolidityLocals {
class DebuggerSolidityLocals {
constructor (_parent, _traceManager, _internalTreeCall) {
const self = this
this.event = new EventManager()
this.parent = _parent
this.internalTreeCall = _internalTreeCall
this.storageResolver = null
this.traceManager = _traceManager
this.basicPanel = new DropdownPanel('Solidity Locals', {
json: true,
formatSelf: solidityTypeFormatter.formatSelf,
extractData: solidityTypeFormatter.extractData
})
this.init()
this.event.register('solidityLocals', this, function (state) {
self.update(state)
})
this.event.register('solidityLocalsMessage', this, function (message) {
self.setMessage(message)
})
this.event.register('solidityLocalsUpdating', this, function () {
self.setUpdating()
})
this.view
}
update (data) {
this.basicPanel.update(data)
}
setMessage (message) {
this.basicPanel.setMessage(message)
}
setUpdating () {
this.basicPanel.setUpdating()
}
render () {
this.view = yo`<div id='soliditylocals'>${this.basicPanel.render()}</div>`
return this.view
}
init () {
@ -109,6 +65,56 @@ class SolidityLocals {
}
})
}
}
class SolidityLocals {
constructor (_parent, _traceManager, _internalTreeCall) {
const self = this
this.event = new EventManager()
this.basicPanel = new DropdownPanel('Solidity Locals', {
json: true,
formatSelf: solidityTypeFormatter.formatSelf,
extractData: solidityTypeFormatter.extractData
})
this.debuggerSolidityLocals = new DebuggerSolidityLocals(_parent, _traceManager, _internalTreeCall)
this.parent = this.debuggerSolidityLocals.parent
this.internalTreeCall = this.debuggerSolidityLocals.internalTreeCall
this.storageResolver = this.debuggerSolidityLocals.storageResolver
this.traceManager = this.debuggerSolidityLocals.traceManager
this.debuggerSolidityLocals.event.register('solidityLocals', this, function (state) {
self.update(state)
})
this.debuggerSolidityLocals.event.register('solidityLocalsMessage', this, function (message) {
self.setMessage(message)
})
this.debuggerSolidityLocals.event.register('solidityLocalsUpdating', this, function () {
self.setUpdating()
})
this.debuggerSolidityLocals.init()
this.view
}
update (data) {
this.basicPanel.update(data)
}
setMessage (message) {
this.basicPanel.setMessage(message)
}
setUpdating () {
this.basicPanel.setUpdating()
}
render () {
this.view = yo`<div id='soliditylocals'>${this.basicPanel.render()}</div>`
return this.view
}
}
module.exports = SolidityLocals

Loading…
Cancel
Save