set solidityMode to slider

pull/7/head
yann300 8 years ago
parent 922fe98794
commit 1d32da5cbf
  1. 14
      src/ui/Slider.js
  2. 28
      src/ui/StepManager.js
  3. 4
      src/util/internalCallTree.js

@ -2,6 +2,7 @@
var style = require('./styles/sliderStyles')
var EventManager = require('../lib/eventManager')
var yo = require('yo-yo')
var utils = require('../helpers/util.js')
var ui = require('../helpers/ui')
class Slider {
@ -11,6 +12,7 @@ class Slider {
this.max
this.disabled = true
this.view
this.solidityMode = false
this.previousValue = null
}
@ -46,6 +48,10 @@ class Slider {
onChange (event) {
var value = parseInt(this.view.querySelector('#slider').value)
if (this.solidityMode) {
value = utils.findLowerBound(value, this.reducedTrace)
this.view.querySelector('#slider').value = value
}
if (value === this.previousValue) return
this.previousValue = value
this.event.trigger('moved', [value])
@ -61,6 +67,14 @@ class Slider {
}
}
setReducedTrace (trace) {
this.reducedTrace = trace
}
setSolidityMode (mode) {
this.solidityMode = false
}
updateDisabled (disabled) {
if (disabled) {
this.view.querySelector('#slider').setAttribute('disabled', true)

@ -1,7 +1,6 @@
'use strict'
var ButtonNavigator = require('./ButtonNavigator')
var Slider = require('./Slider')
var SoliditySlider = require('./SoliditySlider')
var EventManager = require('../lib/eventManager')
var SourceMappingDecoder = require('../util/sourceMappingDecoder')
var yo = require('yo-yo')
@ -28,26 +27,15 @@ function StepManager (_parent, _traceManager) {
this.slider = new Slider(this.traceManager)
this.slider.event.register('moved', this, function (step) {
self.sliderMoved(step)
self.soliditySlider.setValue(step)
})
this.soliditySlider = new SoliditySlider(this.traceManager)
this.parent.callTree.event.register('callTreeReady', () => {
this.soliditySlider.setReducedTrace(this.parent.callTree.reducedTraceBySourceLocation)
this.soliditySlider.event.register('moved', this, function (srcLocationStep) {
var step = self.parent.callTree.reducedTraceBySourceLocation[srcLocationStep]
self.sliderMoved(step)
self.slider.setValue(step)
})
this.slider.setReducedTrace(this.parent.callTree.reducedTrace)
this.parent.vmDebugger.asmCode.event.register('hide', () => {
this.soliditySlider.show()
this.slider.hide()
this.slider.setSolidityMode(true)
})
this.parent.vmDebugger.asmCode.event.register('show', () => {
this.soliditySlider.hide()
this.slider.show()
this.slider.setSolidityMode(false)
})
})
@ -79,7 +67,6 @@ StepManager.prototype.render = function () {
return (
yo`<div>
${this.slider.render()}
${this.soliditySlider.render()}
${this.buttonNavigator.render()}
</div>`
)
@ -87,14 +74,12 @@ StepManager.prototype.render = function () {
StepManager.prototype.reset = function () {
this.slider.setValue(0)
this.soliditySlider.setValue(0)
this.currentStepIndex = 0
this.buttonNavigator.reset()
}
StepManager.prototype.init = function () {
this.slider.setValue(0)
this.soliditySlider.setValue(0)
this.changeState(0)
}
@ -107,7 +92,6 @@ StepManager.prototype.jumpTo = function (step) {
return
}
this.slider.setValue(step)
this.soliditySlider.setValue(step)
this.changeState(step)
}
@ -127,7 +111,6 @@ StepManager.prototype.stepIntoForward = function () {
return
}
this.slider.setValue(step)
this.soliditySlider.setValue(step)
this.changeState(step)
}
@ -140,7 +123,6 @@ StepManager.prototype.stepIntoBack = function () {
return
}
this.slider.setValue(step)
this.soliditySlider.setValue(step)
this.changeState(step)
}
@ -150,7 +132,6 @@ StepManager.prototype.stepOverForward = function () {
}
var step = this.traceManager.findStepOverForward(this.currentStepIndex)
this.slider.setValue(step)
this.soliditySlider.setValue(step)
this.changeState(step)
}
@ -160,7 +141,6 @@ StepManager.prototype.stepOverBack = function () {
}
var step = this.traceManager.findStepOverBack(this.currentStepIndex)
this.slider.setValue(step)
this.soliditySlider.setValue(step)
this.changeState(step)
}
@ -170,7 +150,6 @@ StepManager.prototype.jumpNextCall = function () {
}
var step = this.traceManager.findNextCall(this.currentStepIndex)
this.slider.setValue(step)
this.soliditySlider.setValue(step)
this.changeState(step)
}
@ -180,7 +159,6 @@ StepManager.prototype.jumpOut = function () {
}
var step = this.traceManager.findStepOut(this.currentStepIndex)
this.slider.setValue(step)
this.soliditySlider.setValue(step)
this.changeState(step)
}

@ -58,7 +58,7 @@ class InternalCallTree {
this.scopeStarts = {}
this.variableDeclarationByFile = {}
this.astWalker = new AstWalker()
this.reducedTraceBySourceLocation = []
this.reducedTrace = []
}
/**
@ -96,7 +96,7 @@ async function buildTree (tree, step, scopeId) {
sourceLocation.start !== currentSourceLocation.start ||
sourceLocation.length !== currentSourceLocation.length ||
sourceLocation.file !== currentSourceLocation.file) {
tree.reducedTraceBySourceLocation.push(step)
tree.reducedTrace.push(step)
currentSourceLocation = sourceLocation
}
} catch (e) {

Loading…
Cancel
Save