|
|
@ -21,7 +21,8 @@ AstWalker.prototype.walk = function (ast, callback) { |
|
|
|
if (!('*' in callback)) { |
|
|
|
if (!('*' in callback)) { |
|
|
|
callback['*'] = function () { return true } |
|
|
|
callback['*'] = function () { return true } |
|
|
|
} |
|
|
|
} |
|
|
|
const nodes = ast.nodes || (ast.body && ast.body.statements) || ast.declarations |
|
|
|
if(ast){ |
|
|
|
|
|
|
|
const nodes = ast.nodes || (ast.body && ast.body.statements) || ast.declarations || [] |
|
|
|
if(ast.body && ast.initializationExpression) // 'for' loop handling
|
|
|
|
if(ast.body && ast.initializationExpression) // 'for' loop handling
|
|
|
|
nodes.push(ast.initializationExpression) |
|
|
|
nodes.push(ast.initializationExpression) |
|
|
|
if (manageCallBack(ast, callback) && nodes && nodes.length > 0) { |
|
|
|
if (manageCallBack(ast, callback) && nodes && nodes.length > 0) { |
|
|
@ -31,6 +32,7 @@ AstWalker.prototype.walk = function (ast, callback) { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* walk the given @astList |
|
|
|
* walk the given @astList |
|
|
|