remove logic to set revertPoint and reason from button navigator into caller

pull/1/head
Iuri Matias 6 years ago committed by yann300
parent 19f7507dab
commit b3bd2656e0
  1. 53
      src/app/debugger/debuggerUI/ButtonNavigator.js
  2. 39
      src/app/debugger/debuggerUI/StepManager.js

@ -49,42 +49,6 @@ function ButtonNavigator (_parent, _traceManager) {
this.traceManager = _traceManager
this.currentCall = null
this.revertionPoint = null
_parent.event.register('indexChanged', this, (index) => {
if (!this.view) return
if (index < 0) return
if (_parent.currentStepIndex !== index) return
this.traceManager.buildCallPath(index, (error, callsPath) => {
if (error) {
console.log(error)
resetWarning(this)
} else {
this.currentCall = callsPath[callsPath.length - 1]
if (this.currentCall.reverted) {
this.revertionPoint = this.currentCall.return
this.view.querySelector('#reverted').style.display = 'block'
this.view.querySelector('#reverted #outofgas').style.display = this.currentCall.outOfGas ? 'inline' : 'none'
this.view.querySelector('#reverted #parenthasthrown').style.display = 'none'
} else {
var k = callsPath.length - 2
while (k >= 0) {
var parent = callsPath[k]
if (parent.reverted) {
this.revertionPoint = parent.return
this.view.querySelector('#reverted').style.display = 'block'
this.view.querySelector('#reverted #parenthasthrown').style.display = parent ? 'inline' : 'none'
this.view.querySelector('#reverted #outofgas').style.display = 'none'
return
}
k--
}
resetWarning(this)
}
}
})
})
this.view
}
@ -125,7 +89,7 @@ ButtonNavigator.prototype.reset = function () {
this.jumpOutDisabled = true
this.jumpNextBreakpointDisabled = true
this.jumpPreviousBreakpointDisabled = true
resetWarning(this)
this.resetWarning('')
}
ButtonNavigator.prototype.stepChanged = function (stepState, jumpOutDisabled) {
@ -166,10 +130,17 @@ ButtonNavigator.prototype.updateDisabled = function (id, disabled) {
}
}
function resetWarning (self) {
self.view.querySelector('#reverted #outofgas').style.display = 'none'
self.view.querySelector('#reverted #parenthasthrown').style.display = 'none'
self.view.querySelector('#reverted').style.display = 'none'
ButtonNavigator.prototype.resetAndCheckRevertionPoint = function (revertedReason, revertionPoint) {
if (revertionPoint) {
this.revertionPoint = revertionPoint
}
this.resetWarning(revertedReason)
}
ButtonNavigator.prototype.resetWarning = function (revertedReason) {
this.view.querySelector('#reverted #outofgas').style.display = (revertedReason === 'outofgas') ? 'inline' : 'none'
this.view.querySelector('#reverted #parenthasthrown').style.display = (revertedReason === 'parenthasthrown') ? 'inline' : 'none'
this.view.querySelector('#reverted').style.display = (revertedReason === '') ? 'none' : 'block'
}
module.exports = ButtonNavigator

@ -41,6 +41,45 @@ function StepManager (_parent, _traceManager) {
})
this.buttonNavigator = new ButtonNavigator(_parent, this.traceManager)
_parent.event.register('indexChanged', this, (index) => {
// if (!this.view) return
if (index < 0) return
if (_parent.currentStepIndex !== index) return
self.traceManager.buildCallPath(index, (error, callsPath) => {
if (error) {
console.log(error)
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.buttonNavigator.resetAndCheckRevertionPoint(revertedReason, self.currentCall.return)
}
} else {
var k = callsPath.length - 2
while (k >= 0) {
var parent = callsPath[k]
if (parent.reverted) {
let revertedReason = parent ? 'parenthasthrown' : ''
if (self.buttonNavigator) {
return self.buttonNavigator.resetAndCheckRevertionPoint(revertedReason, parent.return)
}
}
k--
}
if (self.buttonNavigator) {
self.buttonNavigator.resetWarning('')
}
}
}
})
})
this.buttonNavigator.event.register('stepIntoBack', this, function () {
self.stepIntoBack()
})

Loading…
Cancel
Save