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

Loading…
Cancel
Save