From 1b6626054da6bc1e6a76c54d1d379f52dbc959b2 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Tue, 25 Sep 2018 14:54:29 -0400 Subject: [PATCH] move return value logic and transform it into an event --- src/app/debugger/debuggerUI/VmDebugger.js | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/src/app/debugger/debuggerUI/VmDebugger.js b/src/app/debugger/debuggerUI/VmDebugger.js index 59ab098995..9847a2888a 100644 --- a/src/app/debugger/debuggerUI/VmDebugger.js +++ b/src/app/debugger/debuggerUI/VmDebugger.js @@ -149,6 +149,14 @@ class VmDebuggerLogic { self._traceManager.getRemainingGas(index, function (error, remaining) { self.event.trigger('traceRemainingGasUpdate', [error, remaining]) }) + + self._traceManager.getReturnValue(index, function (error, returnValue) { + if (error) { + self.event.trigger('traceReturnValueUpdate', [[error]]) + } else if (self._parentUI.currentStepIndex === index) { + self.event.trigger('traceReturnValueUpdate', [[returnValue]]) + } + }) }) } @@ -234,21 +242,9 @@ function VmDebugger (_parentUI, _traceManager, _codeManager, _solidityProxy, _ca }) this.debuggerSolidityLocals.init() - /* Return values - */ this.returnValuesPanel = new DropdownPanel('Return Value', {json: true}) this.returnValuesPanel.data = {} - _parentUI.event.register('indexChanged', this.returnValuesPanel, function (index) { - if (!self.view) return - var innerself = this - _traceManager.getReturnValue(index, function (error, returnValue) { - if (error) { - innerself.update([error]) - } else if (_parentUI.currentStepIndex === index) { - innerself.update([returnValue]) - } - }) - }) - /* Return values - */ + this.debuggerSolidityLocals.event.register('traceReturnValueUpdate', this.returnValuesPanel.update.bind(this.returnValuesPanel)) this.fullStoragesChangesPanel = new FullStoragesChangesPanel(_parentUI, _traceManager) this.addresses = []