public override object VisitFunctionStatement([NotNull] FunctionStatementContext context) { var id = (Result)Visit(context.id()); var obj = ""; // 异步 if (context.t.Type == FlowRight) { var pout = (string)Visit(context.parameterClauseOut()); if (pout != "void") { pout = $"{Task}<{pout}>"; } else { pout = Task; } obj += $" async {pout} {id.text}"; } else { obj += Visit(context.parameterClauseOut()) + " " + id.text; } // 泛型 if (context.templateDefine() != null) { obj += Visit(context.templateDefine()); } obj += $"{Visit(context.parameterClauseIn())} {Wrap} {BlockLeft} {Wrap}"; obj += ProcessFunctionSupport(context.functionSupportStatement()); obj += BlockRight + Wrap; return(obj); }
public override object VisitFunctionStatement(FunctionStatementContext context) { var id = ((Result)Visit(context.id())); var obj = ""; var pout = ""; if (context.parameterClauseOut() == null) { pout = "void"; } else { pout = ((string)Visit(context.parameterClauseOut())); } obj += (new System.Text.StringBuilder().Append(pout).Append(" ").Append(id.text)).To_Str(); var template_contract = ""; if (context.templateDefine() != null) { var template = ((TemplateItem)Visit(context.templateDefine())); obj += template.template; template_contract = template.contract; } Add_current_set(); obj += (new System.Text.StringBuilder().Append(Visit(context.parameterClauseIn())).Append(" ").Append(template_contract).Append(Wrap).Append(BlockLeft).Append(Wrap).Append(" ")).To_Str(); obj += ProcessFunctionSupport(context.functionSupportStatement()); obj += BlockRight + Wrap; Delete_current_set(); return(obj); }
public override object VisitFunctionStatement(FunctionStatementContext context) { var id = (Result)(Visit(context.id())); var obj = ""; var pout = ""; if (context.parameterClauseOut() != null) { pout = (string)(Visit(context.parameterClauseOut())); } if (context.t.Type == Right_Flow) { if (pout != "void") { pout = (new System.Text.StringBuilder().Append(Task).Append("<").Append(pout).Append(">")).to_str(); } else { pout = Task; } obj += (new System.Text.StringBuilder().Append(pout).Append(" ").Append(id.text)).to_str(); } else { if (context.y != null) { if (pout != "void") { pout = (new System.Text.StringBuilder().Append(IEnum).Append("<").Append(pout).Append(">")).to_str(); } } obj += (new System.Text.StringBuilder().Append(pout).Append(" ").Append(id.text)).to_str(); } var templateContract = ""; if (context.templateDefine() != null) { var template = (TemplateItem)(Visit(context.templateDefine())); obj += template.Template; templateContract = template.Contract; } this.add_current_set(); this.add_func_stack(); obj += (new System.Text.StringBuilder().Append(Visit(context.parameterClauseIn())).Append(" ").Append(templateContract).Append(Wrap).Append(BlockLeft).Append(Wrap).Append(" ")).to_str(); obj += ProcessFunctionSupport(context.functionSupportStatement()); obj += BlockRight + Wrap; this.delete_current_set(); if (get_func_async()) { obj = " async " + obj; } this.delete_func_stack(); return(obj); }