Commit ffbd855c authored by yann300's avatar yann300

put includion of variable declaration in a separate function

parent f51b56d8
...@@ -109,6 +109,15 @@ async function buildTree (tree, step, scopeId) { ...@@ -109,6 +109,15 @@ async function buildTree (tree, step, scopeId) {
return { outStep: step + 1 } return { outStep: step + 1 }
} else { } else {
if (tree.includeLocalVariables) { if (tree.includeLocalVariables) {
includeVariableDeclaration(tree, step, sourceLocation, scopeId)
}
step++
}
}
return { outStep: step }
}
function includeVariableDeclaration (tree, step, sourceLocation, scopeId) {
var variableDeclaration = resolveVariableDeclaration(tree, step, sourceLocation) var variableDeclaration = resolveVariableDeclaration(tree, step, sourceLocation)
if (variableDeclaration && !tree.scopes[scopeId].locals[variableDeclaration.attributes.name]) { if (variableDeclaration && !tree.scopes[scopeId].locals[variableDeclaration.attributes.name]) {
tree.traceManager.getStackAt(step, (error, stack) => { tree.traceManager.getStackAt(step, (error, stack) => {
...@@ -126,11 +135,6 @@ async function buildTree (tree, step, scopeId) { ...@@ -126,11 +135,6 @@ async function buildTree (tree, step, scopeId) {
} }
}) })
} }
}
step++
}
}
return { outStep: step }
} }
function extractSourceLocation (tree, step) { function extractSourceLocation (tree, step) {
......
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