Commit ebd0115c authored by yann300's avatar yann300

use soliditySlider

parent 00cd1e71
'use strict' 'use strict'
var ButtonNavigator = require('./ButtonNavigator') var ButtonNavigator = require('./ButtonNavigator')
var Slider = require('./Slider') var Slider = require('./Slider')
var SoliditySlider = require('./SoliditySlider')
var EventManager = require('../lib/eventManager') var EventManager = require('../lib/eventManager')
var SourceMappingDecoder = require('../util/sourceMappingDecoder')
var yo = require('yo-yo') var yo = require('yo-yo')
function StepManager (_parent, _traceManager) { function StepManager (_parent, _traceManager) {
this.event = new EventManager() this.event = new EventManager()
this.sourceMappingDecoder = new SourceMappingDecoder()
this.parent = _parent this.parent = _parent
this.traceManager = _traceManager this.traceManager = _traceManager
this.sourceMapByAddress = {}
var self = this var self = this
this.parent.event.register('newTraceLoaded', this, function () { this.parent.event.register('newTraceLoaded', this, function () {
...@@ -16,6 +20,7 @@ function StepManager (_parent, _traceManager) { ...@@ -16,6 +20,7 @@ function StepManager (_parent, _traceManager) {
console.log(error) console.log(error)
} else { } else {
self.slider.init(length) self.slider.init(length)
self.soliditySlider.init(self.parent.callTree.reducedTraceBySourceLocation.length)
self.init() self.init()
} }
}) })
...@@ -24,6 +29,14 @@ function StepManager (_parent, _traceManager) { ...@@ -24,6 +29,14 @@ function StepManager (_parent, _traceManager) {
this.slider = new Slider(this.traceManager) this.slider = new Slider(this.traceManager)
this.slider.event.register('moved', this, function (step) { this.slider.event.register('moved', this, function (step) {
self.sliderMoved(step) self.sliderMoved(step)
self.soliditySlider.setValue(step)
})
this.soliditySlider = new SoliditySlider(this.traceManager, self.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.buttonNavigator = new ButtonNavigator(_parent, this.traceManager) this.buttonNavigator = new ButtonNavigator(_parent, this.traceManager)
...@@ -48,12 +61,24 @@ function StepManager (_parent, _traceManager) { ...@@ -48,12 +61,24 @@ function StepManager (_parent, _traceManager) {
this.buttonNavigator.event.register('jumpToException', this, function (exceptionIndex) { this.buttonNavigator.event.register('jumpToException', this, function (exceptionIndex) {
self.jumpTo(exceptionIndex) self.jumpTo(exceptionIndex)
}) })
if (this.parent.solidityProxy.loaded()) {
this.parent.vmDebugger.asmCode.register('hide', () => {
this.soliditySlider.show()
this.slider.hide()
})
this.parent.vmDebugger.asmCode.register('show', () => {
this.soliditySlider.hide()
this.slider.show()
})
}
} }
StepManager.prototype.render = function () { StepManager.prototype.render = function () {
return ( return (
yo`<div> yo`<div>
${this.slider.render()} ${this.slider.render()}
${this.soliditySlider.render()}
${this.buttonNavigator.render()} ${this.buttonNavigator.render()}
</div>` </div>`
) )
...@@ -61,12 +86,14 @@ StepManager.prototype.render = function () { ...@@ -61,12 +86,14 @@ StepManager.prototype.render = function () {
StepManager.prototype.reset = function () { StepManager.prototype.reset = function () {
this.slider.setValue(0) this.slider.setValue(0)
this.soliditySlider.setValue(0)
this.currentStepIndex = 0 this.currentStepIndex = 0
this.buttonNavigator.reset() this.buttonNavigator.reset()
} }
StepManager.prototype.init = function () { StepManager.prototype.init = function () {
this.slider.setValue(0) this.slider.setValue(0)
this.soliditySlider.setValue(0)
this.changeState(0) this.changeState(0)
} }
...@@ -79,6 +106,7 @@ StepManager.prototype.jumpTo = function (step) { ...@@ -79,6 +106,7 @@ StepManager.prototype.jumpTo = function (step) {
return return
} }
this.slider.setValue(step) this.slider.setValue(step)
this.soliditySlider.setValue(step)
this.changeState(step) this.changeState(step)
} }
...@@ -98,6 +126,7 @@ StepManager.prototype.stepIntoForward = function () { ...@@ -98,6 +126,7 @@ StepManager.prototype.stepIntoForward = function () {
return return
} }
this.slider.setValue(step) this.slider.setValue(step)
this.soliditySlider.setValue(step)
this.changeState(step) this.changeState(step)
} }
...@@ -110,6 +139,7 @@ StepManager.prototype.stepIntoBack = function () { ...@@ -110,6 +139,7 @@ StepManager.prototype.stepIntoBack = function () {
return return
} }
this.slider.setValue(step) this.slider.setValue(step)
this.soliditySlider.setValue(step)
this.changeState(step) this.changeState(step)
} }
...@@ -119,6 +149,7 @@ StepManager.prototype.stepOverForward = function () { ...@@ -119,6 +149,7 @@ StepManager.prototype.stepOverForward = function () {
} }
var step = this.traceManager.findStepOverForward(this.currentStepIndex) var step = this.traceManager.findStepOverForward(this.currentStepIndex)
this.slider.setValue(step) this.slider.setValue(step)
this.soliditySlider.setValue(step)
this.changeState(step) this.changeState(step)
} }
...@@ -128,6 +159,7 @@ StepManager.prototype.stepOverBack = function () { ...@@ -128,6 +159,7 @@ StepManager.prototype.stepOverBack = function () {
} }
var step = this.traceManager.findStepOverBack(this.currentStepIndex) var step = this.traceManager.findStepOverBack(this.currentStepIndex)
this.slider.setValue(step) this.slider.setValue(step)
this.soliditySlider.setValue(step)
this.changeState(step) this.changeState(step)
} }
...@@ -137,6 +169,7 @@ StepManager.prototype.jumpNextCall = function () { ...@@ -137,6 +169,7 @@ StepManager.prototype.jumpNextCall = function () {
} }
var step = this.traceManager.findNextCall(this.currentStepIndex) var step = this.traceManager.findNextCall(this.currentStepIndex)
this.slider.setValue(step) this.slider.setValue(step)
this.soliditySlider.setValue(step)
this.changeState(step) this.changeState(step)
} }
...@@ -146,6 +179,7 @@ StepManager.prototype.jumpOut = function () { ...@@ -146,6 +179,7 @@ StepManager.prototype.jumpOut = function () {
} }
var step = this.traceManager.findStepOut(this.currentStepIndex) var step = this.traceManager.findStepOut(this.currentStepIndex)
this.slider.setValue(step) this.slider.setValue(step)
this.soliditySlider.setValue(step)
this.changeState(step) this.changeState(step)
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment