remove unused solidityMode variable; remove all code associated

pull/3094/head
Iuri Matias 6 years ago committed by yann300
parent 6afca782da
commit 828ce7bc56
  1. 50
      src/app/debugger/debuggerUI/Slider.js
  2. 83
      src/app/debugger/debuggerUI/StepManager.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`<div>
<input
id='slider'
style='width: 100%'
type='range'
min=0
max=${this.max}
value=0
onchange=${function () { self.onChange() }}
oninput=${function () { self.onChange() }}
disabled=${this.disabled} />
</div>`
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`<div>
<input id='slider' style='width: 100%' type='range' min=0 max=${this.max} value=0
onchange=${function () { self.onChange() }} oninput=${function () { self.onChange() }} disabled=${this.disabled} />
</div>`
if (!this.view) {
this.view = view
}
return view
}
}
module.exports = Slider

@ -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`<div>
${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)
}

Loading…
Cancel
Save