Commit 12f22033 authored by yann300's avatar yann300

add setTimeout to get rid of max callstack size

parent b520ae59
...@@ -109,9 +109,10 @@ function buildTree (tree, step, scopeId, cb) { ...@@ -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) { ...@@ -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) { ...@@ -155,6 +156,7 @@ function visitStep (tree, step, scopeId, subScope, cb) {
} }
} }
}) })
}, 0)
} }
function extractSourceLocation (tree, step, cb) { function extractSourceLocation (tree, step, cb) {
......
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