示例#1
0
        public override object VisitProtocolFunctionStatement(ProtocolFunctionStatementContext context)
        {
            var id  = (Result)(Visit(context.id()));
            var obj = "";

            if (context.annotationSupport() != null)
            {
                obj += Visit(context.annotationSupport());
            }
            var pout = (string)(Visit(context.parameterClauseOut()));

            if (context.t.Type == Right_Flow)
            {
                if (pout != "void")
                {
                    if (context.y != null)
                    {
                        pout = (new System.Text.StringBuilder().Append(IEnum).Append("<").Append(pout).Append(">")).to_str();
                    }
                    pout = (new System.Text.StringBuilder().Append(Task).Append("<").Append(pout).Append(">")).to_str();
                }
                else
                {
                    pout = Task;
                }
                obj += pout + " " + id.text;
            }
            else
            {
                if (context.y != null)
                {
                    if (pout != "void")
                    {
                        pout = (new System.Text.StringBuilder().Append(IEnum).Append("<").Append(pout).Append(">")).to_str();
                    }
                }
                obj += pout + " " + id.text;
            }
            var templateContract = "";

            if (context.templateDefine() != null)
            {
                var template = (TemplateItem)(Visit(context.templateDefine()));
                obj += template.Template;
                templateContract = template.Contract;
            }
            obj += Visit(context.parameterClauseIn()) + templateContract + Terminate + Wrap;
            return(obj);
        }
示例#2
0
        public override object VisitProtocolFunctionStatement(ProtocolFunctionStatementContext context)
        {
            var id  = ((Result)Visit(context.id()));
            var obj = "";

            if (context.annotationSupport() != null)
            {
                obj += Visit(context.annotationSupport());
            }
            var pout = ((string)Visit(context.parameterClauseOut()));

            obj += pout + " " + id.text;
            var template_contract = "";

            if (context.templateDefine() != null)
            {
                var template = ((TemplateItem)Visit(context.templateDefine()));
                obj += template.template;
                template_contract = template.contract;
            }
            obj += Visit(context.parameterClauseIn()) + template_contract + Terminate + Wrap;
            return(obj);
        }
示例#3
0
        public override object VisitProtocolFunctionStatement([NotNull] ProtocolFunctionStatementContext context)
        {
            var id = (Result)Visit(context.id());
            var r  = new Result();

            if (context.annotationSupport() != null)
            {
                r.text += Visit(context.annotationSupport());
            }
            r.permission = "public";
            // 异步
            if (context.t.Type == FlowRight)
            {
                var pout = (string)Visit(context.parameterClauseOut());
                if (pout != "void")
                {
                    pout = $"{Task}<{pout}>";
                }
                else
                {
                    pout = Task;
                }
                r.text += pout + " " + id.text;
            }
            else
            {
                r.text += Visit(context.parameterClauseOut()) + " " + id.text;
            }
            // 泛型
            if (context.templateDefine() != null)
            {
                r.text += Visit(context.templateDefine());
            }
            r.text += Visit(context.parameterClauseIn()) + Terminate + Wrap;
            return(r);
        }