Commit d599f95a authored by yann300's avatar yann300

warn if compilation result not provided

parent e426e784
......@@ -2,6 +2,9 @@
function solidityLocals (vmtraceIndex, internalTreeCall, stack, memory) {
var scope = internalTreeCall.findScope(vmtraceIndex)
if (!scope) {
return { 'error': 'Can\'t display locals. reason: compilation result might not have been provided' }
}
var locals = {}
for (var local in scope.locals) {
let variable = scope.locals[local]
......
......@@ -20,8 +20,12 @@ class InternalCallTree {
}
buildTree (trace) {
if (!this.solidityProxy.loaded()) {
console.log('compilation result not loaded. Cannot build internal call tree')
} else {
buildTree(this, 0, '', trace)
}
}
reset () {
this.scopes = {}
......@@ -31,7 +35,11 @@ class InternalCallTree {
}
findScope (vmtraceIndex) {
var scopeId = util.findLowerBoundValue(vmtraceIndex, Object.keys(this.scopeStarts))
var scopes = Object.keys(this.scopeStarts)
if (!scopes.length) {
return null
}
var scopeId = util.findLowerBoundValue(vmtraceIndex, scopes)
scopeId = this.scopeStarts[scopeId]
var scope = this.scopes[scopeId]
var reg = /(.\d|\d)$/
......
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