astwalker improved

pull/5370/head
aniket-engg 4 years ago committed by Aniket
parent c278347fd8
commit 5be55b3f24
  1. 4
      libs/remix-debug/src/source/astWalker.js

@ -21,7 +21,8 @@ AstWalker.prototype.walk = function (ast, callback) {
if (!('*' in callback)) {
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
nodes.push(ast.initializationExpression)
if (manageCallBack(ast, callback) && nodes && nodes.length > 0) {
@ -31,6 +32,7 @@ AstWalker.prototype.walk = function (ast, callback) {
}
}
}
}
/**
* walk the given @astList

Loading…
Cancel
Save