Commit 4716dad8 authored by yann300's avatar yann300

retrieve sourcelocation and test against current

parent 2a181ebd
'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
}
}
}
})
})
})
})
}
}
......
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