Example #1
0
 def visitFunc_decl(self, ctx: MCParser.Func_declContext):
     name = self.visit(ctx.func_name())
     param = []
     if ctx.one_para(0):
         for x in ctx.one_para():
             param += [self.visit(x)]
     returnType = self.visit(ctx.func_type())
     body = self.visit(ctx.block_statement())
     return FuncDecl(name, param, returnType, body)
Example #2
0
 def visitFunc_decl(self, ctx: MCParser.Func_declContext):
     return [
         FuncDecl(self.visit(ctx.func_name()),
                  self.visit(ctx.param_list()) if ctx.param_list() else [],
                  self.visit(ctx.mctype()), self.visit(ctx.block_stm()))
     ]