From 92641f12904460542b25985ba0b57d57aadde323 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Fri, 7 Sep 2018 12:05:42 -0400 Subject: [PATCH] simplify code --- src/app/debugger/debuggerUI/StepManager.js | 48 +++++++++------------- 1 file changed, 20 insertions(+), 28 deletions(-) diff --git a/src/app/debugger/debuggerUI/StepManager.js b/src/app/debugger/debuggerUI/StepManager.js index 4f69315113..48c4daa70a 100644 --- a/src/app/debugger/debuggerUI/StepManager.js +++ b/src/app/debugger/debuggerUI/StepManager.js @@ -53,32 +53,28 @@ function StepManager (_parent, _traceManager) { if (self.buttonNavigator) { self.buttonNavigator.resetWarning('') } - } else { - self.currentCall = callsPath[callsPath.length - 1] - if (self.currentCall.reverted) { - let revertedReason = self.currentCall.outofgas ? 'outofgas' : '' - if (self.buttonNavigator) { - self.revertionPoint = self.currentCall.return - self.buttonNavigator.resetWarning(revertedReason) - } - } else { - var k = callsPath.length - 2 - while (k >= 0) { - var parent = callsPath[k] - if (parent.reverted) { - let revertedReason = parent ? 'parenthasthrown' : '' - if (self.buttonNavigator) { - self.revertionPoint = parent.return - self.buttonNavigator.resetWarning(revertedReason) - } - } - k-- - } - if (self.buttonNavigator) { - self.buttonNavigator.resetWarning('') - } + return + } + self.currentCall = callsPath[callsPath.length - 1] + if (self.currentCall.reverted) { + let revertedReason = self.currentCall.outofgas ? 'outofgas' : '' + self.revertionPoint = self.currentCall.return + if (self.buttonNavigator) { + self.buttonNavigator.resetWarning(revertedReason) + } + return + } + for (var k = callsPath.length - 2; k >= 0; k--) { + var parent = callsPath[k] + if (!parent.reverted) continue + self.revertionPoint = parent.return + if (self.buttonNavigator) { + self.buttonNavigator.resetWarning('parenthasthrown') } } + if (self.buttonNavigator) { + self.buttonNavigator.resetWarning('') + } }) }) @@ -134,10 +130,6 @@ StepManager.prototype.init = function () { this.changeState(0) } -StepManager.prototype.newTraceAvailable = function () { - this.init() -} - StepManager.prototype.jumpTo = function (step) { if (!this.traceManager.inRange(step)) return this.slider.setValue(step)