def visitFunc_decl(self, ctx: MCParser.Func_declContext): #name: Id #param: list(VarDecl) #returnType: Type #body: Block #ID = Id(ctx.ID().getText()) #p = self.visit(ctx.paralist()) if ctx.paralist() else [] return FuncDecl(Id(ctx.ID().getText()), self.visit(ctx.paralist()) if ctx.paralist() else [], self.visit(ctx.functype()), self.visit(ctx.block_stmt()))
def visitFunc_decl(self, ctx:MCParser.Func_declContext): func_type = self.visitFunc_type(ctx.func_type()) paralist = self.visitParalist(ctx.paralist()) block_stmt = self.visitBlock_stmt(ctx.block_stmt()) id = Id(ctx.ID().getText()) return FuncDecl(id, paralist, func_type, block_stmt)