warn if compilation result not provided

pull/7/head
yann300 8 years ago
parent 48611de363
commit 5ea84f979f
  1. 3
      src/solidity/localDecoder.js
  2. 12
      src/util/internalCallTree.js

@ -2,6 +2,9 @@
function solidityLocals (vmtraceIndex, internalTreeCall, stack, memory) { function solidityLocals (vmtraceIndex, internalTreeCall, stack, memory) {
var scope = internalTreeCall.findScope(vmtraceIndex) var scope = internalTreeCall.findScope(vmtraceIndex)
if (!scope) {
return { 'error': 'Can\'t display locals. reason: compilation result might not have been provided' }
}
var locals = {} var locals = {}
for (var local in scope.locals) { for (var local in scope.locals) {
let variable = scope.locals[local] let variable = scope.locals[local]

@ -20,7 +20,11 @@ class InternalCallTree {
} }
buildTree (trace) { buildTree (trace) {
buildTree(this, 0, '', trace) if (!this.solidityProxy.loaded()) {
console.log('compilation result not loaded. Cannot build internal call tree')
} else {
buildTree(this, 0, '', trace)
}
} }
reset () { reset () {
@ -31,7 +35,11 @@ class InternalCallTree {
} }
findScope (vmtraceIndex) { 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] scopeId = this.scopeStarts[scopeId]
var scope = this.scopes[scopeId] var scope = this.scopes[scopeId]
var reg = /(.\d|\d)$/ var reg = /(.\d|\d)$/

Loading…
Cancel
Save