From 353f4812a5838de60c3c3f3a1b4d30c86a5a6b1d Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Sat, 8 Sep 2018 16:04:33 -0400 Subject: [PATCH] add new stack panel; refactor --- src/app/debugger/debuggerUI/VmDebugger.js | 16 +++++++++++++++- .../debuggerUI/vmDebugger/StackPanel.js | 17 +++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 src/app/debugger/debuggerUI/vmDebugger/StackPanel.js diff --git a/src/app/debugger/debuggerUI/VmDebugger.js b/src/app/debugger/debuggerUI/VmDebugger.js index 64e57da793..701fa54bb4 100644 --- a/src/app/debugger/debuggerUI/VmDebugger.js +++ b/src/app/debugger/debuggerUI/VmDebugger.js @@ -4,7 +4,7 @@ var CodeListView = require('./vmDebugger/CodeListView') var CalldataPanel = require('./vmDebugger/CalldataPanel') var MemoryPanel = require('./vmDebugger/MemoryPanel') var CallstackPanel = require('./vmDebugger/CallstackPanel') -var StackPanel = require('../remix-debugger/src/ui/StackPanel') +var StackPanel = require('./vmDebugger/StackPanel') var StoragePanel = require('../remix-debugger/src/ui/StoragePanel') var FullStoragesChangesPanel = require('../remix-debugger/src/ui/FullStoragesChanges') var StepDetail = require('../remix-debugger/src/ui/StepDetail') @@ -86,6 +86,20 @@ function VmDebugger (_parentUI, _traceManager, _codeManager, _solidityProxy, _ca }) this.stackPanel = new StackPanel(_parentUI, _traceManager) + _parentUI.event.register('indexChanged', this, function (index) { + if (index < 0) return + if (_parentUI.currentStepIndex !== index) return + + _traceManager.getMemoryAt(index, function (error, stack) { + if (error) { + console.log(error) + self.stackPanel.update({}) + } else if (_parentUI.currentStepIndex === index) { + self.stackPanel.update(stack) + } + }) + }) + this.storagePanel = new StoragePanel(_parentUI, _traceManager) this.stepDetail = new StepDetail(_parentUI, _traceManager) this.solidityState = new SolidityState(_parentUI, _traceManager, _codeManager, _solidityProxy) diff --git a/src/app/debugger/debuggerUI/vmDebugger/StackPanel.js b/src/app/debugger/debuggerUI/vmDebugger/StackPanel.js new file mode 100644 index 0000000000..f81a94d8d3 --- /dev/null +++ b/src/app/debugger/debuggerUI/vmDebugger/StackPanel.js @@ -0,0 +1,17 @@ +'use strict' +var DropdownPanel = require('./DropdownPanel') +var yo = require('yo-yo') + +function StackPanel () { + this.basicPanel = new DropdownPanel('Stack', {json: true, displayContentOnly: false}) +} + +StackPanel.prototype.update = function (calldata) { + this.basicPanel.update(calldata) +} + +StackPanel.prototype.render = function () { + return yo`
${this.basicPanel.render()}
` +} + +module.exports = StackPanel