|
|
|
@ -21,9 +21,12 @@ AstWalker.prototype.walk = function (ast, callback) { |
|
|
|
|
if (!('*' in callback)) { |
|
|
|
|
callback['*'] = function () { return true } |
|
|
|
|
} |
|
|
|
|
if (manageCallBack(ast, callback) && ast.nodes && ast.nodes.length > 0) { |
|
|
|
|
for (let k in ast.nodes) { |
|
|
|
|
const child = ast.nodes[k] |
|
|
|
|
const nodes = ast.nodes || (ast.body && ast.body.statements) || ast.declarations |
|
|
|
|
if(ast.body && ast.initializationExpression) // 'for' loop handling
|
|
|
|
|
nodes.push(ast.initializationExpression) |
|
|
|
|
if (manageCallBack(ast, callback) && nodes && nodes.length > 0) { |
|
|
|
|
for (let k in nodes) { |
|
|
|
|
const child = nodes[k] |
|
|
|
|
this.walk(child, callback) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|