From 828ce7bc562bb23af1a46c27b1ce6d11e4ffcc9f Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Fri, 7 Sep 2018 11:34:33 -0400 Subject: [PATCH] remove unused solidityMode variable; remove all code associated --- src/app/debugger/debuggerUI/Slider.js | 50 ++++--------- src/app/debugger/debuggerUI/StepManager.js | 83 +++++----------------- 2 files changed, 32 insertions(+), 101 deletions(-) diff --git a/src/app/debugger/debuggerUI/Slider.js b/src/app/debugger/debuggerUI/Slider.js index 3ca7eb8ffc..56f632456a 100644 --- a/src/app/debugger/debuggerUI/Slider.js +++ b/src/app/debugger/debuggerUI/Slider.js @@ -4,39 +4,16 @@ var EventManager = remixLib.EventManager var yo = require('yo-yo') class Slider { - constructor (_stepOverride) { + constructor () { this.event = new EventManager() this.max this.disabled = true this.view - this.stepOverride = _stepOverride - this.previousValue = null } - render () { - var self = this - var view = yo`
- -
` - if (!this.view) { - this.view = view - } - return view - } - setSliderLength (length) { - var slider = this.view.querySelector('#slider') - slider.setAttribute('max', length - 1) + this.view.querySelector('#slider').setAttribute('max', length - 1) this.max = length - 1 this.disabled = (length === 0) @@ -51,18 +28,9 @@ class Slider { onChange (event) { var value = parseInt(this.view.querySelector('#slider').value) - - if (this.stepOverride) { - var correctedValue = this.stepOverride(value) - if (correctedValue !== value) { - this.setValue(correctedValue) - value = correctedValue - } - } - if (value === this.previousValue) return - this.previousValue = value + this.previousValue = value this.event.trigger('sliderMoved', [value]) } @@ -70,6 +38,18 @@ class Slider { this.view.querySelector('#slider').value = value } + render () { + var self = this + var view = yo`
+ +
` + if (!this.view) { + this.view = view + } + return view + } + } module.exports = Slider diff --git a/src/app/debugger/debuggerUI/StepManager.js b/src/app/debugger/debuggerUI/StepManager.js index 221ceb69ce..4f69315113 100644 --- a/src/app/debugger/debuggerUI/StepManager.js +++ b/src/app/debugger/debuggerUI/StepManager.js @@ -1,10 +1,11 @@ 'use strict' -var ButtonNavigator = require('./ButtonNavigator') -var Slider = require('./Slider') + var remixLib = require('remix-lib') var EventManager = remixLib.EventManager var yo = require('yo-yo') -var util = remixLib.util + +var ButtonNavigator = require('./ButtonNavigator') +var Slider = require('./Slider') function StepManager (_parent, _traceManager) { this.event = new EventManager() @@ -20,17 +21,14 @@ function StepManager (_parent, _traceManager) { if (!this.slider) return self.traceManager.getLength(function (error, length) { if (error) { - console.log(error) - } else { - self.slider.setSliderLength(length) - self.init() + return console.log(error) } + self.slider.setSliderLength(length) + self.init() }) }) - this.slider = new Slider((step) => { - return this.solidityMode ? this.resolveToReducedTrace(step, 0) : step - }) + this.slider = new Slider() this.slider.event.register('sliderMoved', this, function (step) { self.sliderMoved(step) }) @@ -118,20 +116,6 @@ StepManager.prototype.remove = function () { this.buttonNavigator = null } -StepManager.prototype.resolveToReducedTrace = function (value, incr) { - if (this.parent.callTree.reducedTrace.length) { - var nextSource = util.findClosestIndex(value, this.parent.callTree.reducedTrace) - nextSource = nextSource + incr - if (nextSource <= 0) { - nextSource = 0 - } else if (nextSource > this.parent.callTree.reducedTrace.length) { - nextSource = this.parent.callTree.reducedTrace.length - 1 - } - return this.parent.callTree.reducedTrace[nextSource] - } - return value -} - StepManager.prototype.render = function () { return yo`
${this.slider.render()} @@ -155,30 +139,19 @@ StepManager.prototype.newTraceAvailable = function () { } StepManager.prototype.jumpTo = function (step) { - if (!this.traceManager.inRange(step)) { - return - } + if (!this.traceManager.inRange(step)) return this.slider.setValue(step) this.changeState(step) } StepManager.prototype.sliderMoved = function (step) { - if (!this.traceManager.inRange(step)) { - return - } + if (!this.traceManager.inRange(step)) return this.changeState(step) } StepManager.prototype.stepIntoForward = function () { - if (!this.traceManager.isLoaded()) { - return - } - var step = this.currentStepIndex - if (this.solidityMode) { - step = this.resolveToReducedTrace(step, 1) - } else { - step += 1 - } + if (!this.traceManager.isLoaded()) return + var step = this.currentStepIndex + 1 if (!this.traceManager.inRange(step)) { return } @@ -187,15 +160,8 @@ StepManager.prototype.stepIntoForward = function () { } StepManager.prototype.stepIntoBack = function () { - if (!this.traceManager.isLoaded()) { - return - } - var step = this.currentStepIndex - if (this.solidityMode) { - step = this.resolveToReducedTrace(step, -1) - } else { - step -= 1 - } + if (!this.traceManager.isLoaded()) return + var step = this.currentStepIndex - 1 if (!this.traceManager.inRange(step)) { return } @@ -204,37 +170,22 @@ StepManager.prototype.stepIntoBack = function () { } StepManager.prototype.stepOverForward = function () { - if (!this.traceManager.isLoaded()) { - return - } + if (!this.traceManager.isLoaded()) return var step = this.traceManager.findStepOverForward(this.currentStepIndex) - if (this.solidityMode) { - step = this.resolveToReducedTrace(step, 1) - } this.slider.setValue(step) this.changeState(step) } StepManager.prototype.stepOverBack = function () { - if (!this.traceManager.isLoaded()) { - return - } + if (!this.traceManager.isLoaded()) return var step = this.traceManager.findStepOverBack(this.currentStepIndex) - if (this.solidityMode) { - step = this.resolveToReducedTrace(step, -1) - } this.slider.setValue(step) this.changeState(step) } StepManager.prototype.jumpOut = function () { - if (!this.traceManager.isLoaded()) { - return - } + if (!this.traceManager.isLoaded()) return var step = this.traceManager.findStepOut(this.currentStepIndex) - if (this.solidityMode) { - step = this.resolveToReducedTrace(step, 0) - } this.slider.setValue(step) this.changeState(step) }