Commit c71e8249 authored by aniket-engg's avatar aniket-engg Committed by Aniket

handle object subnodes

parent f0ef450b
......@@ -80,7 +80,7 @@ export class AstWalker extends EventEmitter {
}
getASTNodeChildren(ast: AstNode): AstNode[] {
const nodes = ast.nodes // for ContractDefinition
let nodes = ast.nodes // for ContractDefinition
|| ast.body // for FunctionDefinition, ModifierDefinition, WhileStatement, DoWhileStatement, ForStatement
|| ast.statements // for Block, YulBlock
|| ast.members // for StructDefinition, EnumDefinition
......@@ -93,6 +93,13 @@ export class AstWalker extends EventEmitter {
|| ast.eventCall // for EmitStatement
|| []
// If 'nodes' is not an array, convert it into one, for example: ast.body
if(nodes && !Array.isArray(nodes)) {
const tempArr = []
tempArr.push(nodes)
nodes = tempArr
}
if (ast.body && ast.overrides && ast.parameters && ast.returnParameters && ast.modifiers) { // for FunctionDefinition
nodes.push(ast.overrides)
nodes.push(ast.parameters)
......
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