Beispiel #1
0
        public override object VisitProtocolStatement([NotNull] ProtocolStatementContext context)
        {
            var id  = (Result)Visit(context.id());
            var obj = "";
            var interfaceProtocol = "";
            var ptclName          = id.text;

            if (context.annotationSupport() != null)
            {
                obj += Visit(context.annotationSupport());
            }
            foreach (var item in context.protocolSupportStatement())
            {
                var r = (Result)Visit(item);
                interfaceProtocol += r.text;
            }
            obj += "public partial interface " + ptclName;
            // 泛型
            if (context.templateDefine() != null)
            {
                obj += Visit(context.templateDefine());
            }
            obj += Wrap + BlockLeft + Wrap;
            obj += interfaceProtocol;
            obj += BlockRight + Wrap;
            return(obj);
        }
Beispiel #2
0
        public override object VisitProtocolStatement(ProtocolStatementContext context)
        {
            var id                = ((Result)Visit(context.id()));
            var obj               = "";
            var extend            = (new List <string>());
            var interfaceProtocol = "";
            var ptclName          = id.text;

            if (context.annotationSupport() != null)
            {
                obj += Visit(context.annotationSupport());
            }
            if (context.protocolSubStatement() != null)
            {
                var item = context.protocolSubStatement();
                var r    = ((Result)Visit(item));
                interfaceProtocol += r.text;
                extend.Append_all(((List <string>)r.data));
            }
            obj += (new System.Text.StringBuilder().Append("public partial interface ").Append(ptclName)).To_Str();
            if (extend.Size() > 0)
            {
                var temp = extend[(0)];
                foreach (var i in 1.Up_until(extend.Size()))
                {
                    temp += "," + extend[(i)];
                }
                obj += ":" + temp;
            }
            var template_contract = "";

            if (context.templateDefine() != null)
            {
                var template = ((TemplateItem)Visit(context.templateDefine()));
                obj += template.template;
                template_contract = template.contract;
            }
            obj += template_contract + BlockLeft + Wrap;
            obj += interfaceProtocol;
            obj += BlockRight + Wrap;
            return(obj);
        }
Beispiel #3
0
        public override object VisitProtocolStatement(ProtocolStatementContext context)
        {
            var id                = (Result)(Visit(context.id()));
            var obj               = "";
            var extend            = (new list <string>());
            var interfaceProtocol = "";
            var ptclName          = id.text;

            if (context.annotationSupport() != null)
            {
                obj += Visit(context.annotationSupport());
            }
            if (context.protocolSubStatement() != null)
            {
                var item = context.protocolSubStatement();
                var r    = (Result)(Visit(item));
                interfaceProtocol += r.text;
                extend            += (list <string>)(r.data);
            }
            obj += (new System.Text.StringBuilder().Append("public partial interface ").Append(ptclName)).to_str();
            if (extend.length > 0)
            {
                var temp = extend[0];
                foreach (var i in range(1, extend.length - 1, 1, true, true))
                {
                    temp += "," + extend[i];
                }
                obj += ":" + temp;
            }
            var templateContract = "";

            if (context.templateDefine() != null)
            {
                var template = (TemplateItem)(Visit(context.templateDefine()));
                obj += template.Template;
                templateContract = template.Contract;
            }
            obj += templateContract + BlockLeft + Wrap;
            obj += interfaceProtocol;
            obj += BlockRight + Wrap;
            return(obj);
        }