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 { ...@@ -80,7 +80,7 @@ export class AstWalker extends EventEmitter {
} }
getASTNodeChildren(ast: AstNode): AstNode[] { 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.body // for FunctionDefinition, ModifierDefinition, WhileStatement, DoWhileStatement, ForStatement
|| ast.statements // for Block, YulBlock || ast.statements // for Block, YulBlock
|| ast.members // for StructDefinition, EnumDefinition || ast.members // for StructDefinition, EnumDefinition
...@@ -92,6 +92,13 @@ export class AstWalker extends EventEmitter { ...@@ -92,6 +92,13 @@ export class AstWalker extends EventEmitter {
|| ast.subExpression // for UnaryOperation || ast.subExpression // for UnaryOperation
|| ast.eventCall // for EmitStatement || 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 if (ast.body && ast.overrides && ast.parameters && ast.returnParameters && ast.modifiers) { // for FunctionDefinition
nodes.push(ast.overrides) nodes.push(ast.overrides)
......
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