예제 #1
0
        public override object VisitImplementStatement(ImplementStatementContext context)
        {
            var id     = (Result)(Visit(context.id()));
            var obj    = "";
            var extend = (new list <string>());

            if (context.packageFieldStatement() != null)
            {
                var item = context.packageFieldStatement();
                var r    = (Result)(Visit(item));
                obj += r.text;
            }
            if (context.packageNewStatement() != null)
            {
                var item = context.packageNewStatement();
                var r    = (string)(Visit(item));
                obj += (new System.Text.StringBuilder().Append("public ").Append(id.text).Append(" ").Append(r)).to_str();
            }
            obj += BlockRight + Wrap;
            var header = "";

            header += (new System.Text.StringBuilder().Append(id.permission).Append(" partial class ").Append(id.text)).to_str();
            var template         = "";
            var templateContract = "";

            if (context.templateDefine() != null)
            {
                var item = (TemplateItem)(Visit(context.templateDefine()));
                template        += item.Template;
                templateContract = item.Contract;
                header          += template;
            }
            if (extend.length > 0)
            {
                var temp = extend[0];
                foreach (var i in range(1, extend.length - 1, 1, true, true))
                {
                    temp += "," + extend[i];
                }
                header += ":" + temp;
            }
            header      += templateContract + BlockLeft + Wrap;
            obj          = header + obj;
            this.selfID  = "";
            this.superID = "";
            return(obj);
        }
예제 #2
0
        public override object VisitImplementStatement(ImplementStatementContext context)
        {
            var id     = ((Result)Visit(context.id()));
            var obj    = "";
            var extend = (new List <string>());

            if (context.packageFieldStatement() != null)
            {
                var item = context.packageFieldStatement();
                var r    = ((Result)Visit(item));
                obj += r.text;
            }
            if (context.packageNewStatement() != null)
            {
                var item = context.packageNewStatement();
                var r    = ((string)Visit(item));
                obj += (new System.Text.StringBuilder().Append("public ").Append(id.text).Append(" ").Append(r)).To_Str();
            }
            obj += BlockRight + Wrap;
            var header            = (new System.Text.StringBuilder().Append(id.permission).Append(" partial class ").Append(id.text)).To_Str();
            var template          = "";
            var template_contract = "";

            if (context.templateDefine() != null)
            {
                var item = ((TemplateItem)Visit(context.templateDefine()));
                template         += item.template;
                template_contract = item.contract;
                header           += template;
            }
            if (extend.Size() > 0)
            {
                var temp = extend[(0)];
                foreach (var i in 1.Up_until(extend.Size()))
                {
                    temp += "," + extend[(i)];
                }
                header += ":" + temp;
            }
            header  += template_contract + BlockLeft + Wrap;
            obj      = header + obj;
            self_ID  = "";
            super_ID = "";
            return(obj);
        }