retrieve sourcelocation and test against current

pull/7/head
yann300 8 years ago
parent 2a181ebd07
commit 4716dad855
  1. 4
      src/solidity/localDecoder.js
  2. 36
      src/ui/SolidityLocals.js

@ -1,6 +1,6 @@
'use strict'
function solidityLocals (vmtraceIndex, internalTreeCall, stack, memory, storage) {
function solidityLocals (vmtraceIndex, internalTreeCall, stack, memory, storage, currentSourceLocation) {
var scope = internalTreeCall.findScope(vmtraceIndex)
if (!scope) {
var error = { 'message': 'Can\'t display locals. reason: compilation result might not have been provided' }
@ -10,7 +10,7 @@ function solidityLocals (vmtraceIndex, internalTreeCall, stack, memory, storage)
memory = formatMemory(memory)
for (var local in scope.locals) {
let variable = scope.locals[local]
if (variable.stackDepth < stack.length) {
if (variable.stackDepth < stack.length && variable.sourceLocation.start <= currentSourceLocation.start) {
locals[variable.name] = variable.type.decodeFromStack(variable.stackDepth, stack, memory, storage)
}
}

@ -38,26 +38,24 @@ class SolidityLocals {
if (this.parent.currentStepIndex !== index) return
this.traceManager.waterfall([
this.traceManager.getStackAt,
this.traceManager.getMemoryAt],
index,
(error, result) => {
if (!error) {
var stack = result[0].value
var memory = result[1].value
try {
this.traceManager.getStorageAt(index, this.parent.tx, (error, storage) => {
if (!error) {
var locals = localDecoder.solidityLocals(index, this.internalTreeCall, stack, memory, storage)
this.basicPanel.update(locals)
}
})
} catch (e) {
warningDiv.innerHTML = e.message
this.parent.event.register('sourceLocationChanged', this, (sourceLocation) => {
this.traceManager.waterfall([
this.traceManager.getStackAt,
this.traceManager.getMemoryAt],
index,
(error, result) => {
if (!error) {
var stack = result[0].value
var memory = result[1].value
try {
var locals = localDecoder.solidityLocals(index, this.internalTreeCall, stack, memory, sourceLocation)
this.basicPanel.update(locals)
} catch (e) {
warningDiv.innerHTML = e.message
}
}
}
})
})
})
})
}
}

Loading…
Cancel
Save