add setTimeout to get rid of max callstack size

pull/7/head
yann300 8 years ago
parent b520ae5970
commit 12f220336e
  1. 6
      src/util/internalCallTree.js

@ -109,9 +109,10 @@ function buildTree (tree, step, scopeId, cb) {
* @param {Function} cb - callback
*/
function visitStep (tree, step, scopeId, subScope, cb) {
setTimeout(() => {
extractSourceLocation(tree, step, (error, sourceLocation) => {
if (error) {
console.log(error)
cb(error)
} else {
if (sourceLocation.jump === 'i') {
buildTree(tree, step + 1, scopeId === '' ? subScope.toString() : scopeId + '.' + subScope, function (error, outStep) {
@ -129,7 +130,7 @@ function visitStep (tree, step, scopeId, subScope, cb) {
} else {
if (tree.includeLocalVariables) {
var variableDeclaration = resolveVariableDeclaration(tree, step, sourceLocation)
if (variableDeclaration) {
if (variableDeclaration && !tree.scopes[scopeId].locals[variableDeclaration.attributes.name]) {
tree.traceManager.getStackAt(step, (error, stack) => {
if (!error) {
tree.solidityProxy.contractNameAt(step, (error, contractName) => { // cached
@ -155,6 +156,7 @@ function visitStep (tree, step, scopeId, subScope, cb) {
}
}
})
}, 0)
}
function extractSourceLocation (tree, step, cb) {

Loading…
Cancel
Save