예제 #1
0
        private Exp SearchSubject( )
        {
            Exp SubjectExp = Elements[0];

            if (SubjectExp is ExpProcNamePart)
            {
                return(null);
            }
            else if (SubjectExp is ExpNameValue)
            {
                return(null);
            }
            else
            {
                while (SubjectExp is ExpBracket)
                {
                    ExpBracket expBracket = SubjectExp as ExpBracket;
                    if (expBracket.Count == 1)
                    {
                        SubjectExp = expBracket.GetSubExps()[0];
                    }
                    else
                    {
                        throw new CCException();
                    }
                }
                ZMethodCall    tailDesc       = CallDesc.CreateTail();
                List <Exp>     argExps        = ListHelper.GetSubs <Exp>(ArgExps, 1);
                ExpCallSubject expCallSubject = new ExpCallSubject(this.ExpContext, SubjectExp, tailDesc, this.SrcExp, argExps);
                return(expCallSubject);
            }
        }
예제 #2
0
 public ExpCallThis(ContextExp context, ZMethodCall expProcDesc, ZCMethodInfo searchedMethod, Exp srcExp, List <Exp> argExps) : base(context)
 {
     this.ExpProcDesc = expProcDesc;
     this.ZMethod     = searchedMethod;
     this.SrcExp      = srcExp;
     this.ArgExps     = argExps;
 }
예제 #3
0
 public ExpCallNone(ContextExp context, ZMethodCall expProcDesc, Exp srcExp)
     : base(context)
 {
     this.ExpProcDesc = expProcDesc;
     this.SrcExp      = srcExp;
     AnalyCorrect     = false;
 }
예제 #4
0
 private void AnalyProcDesc()
 {
     CallDesc = new ZMethodCall();
     ArgExps  = new List <Exp>();
     foreach (var item in this.Elements)
     {
         //if (this.Elements[0].ToString().StartsWith("战场参数的绘图器"))
         //{
         //    Console.WriteLine(this.ToString());
         //}
         if (item is ExpProcNamePart)
         {
             ExpProcNamePart namePartExp = item as ExpProcNamePart;
             CallDesc.Add(namePartExp.PartName);
         }
         else if (item is ExpBracket)
         {
             ExpBracket   bracketExp   = item as ExpBracket;
             ZBracketCall zbracketDesc = bracketExp.GetCallDesc();
             CallDesc.Add(zbracketDesc);
             ArgExps.AddRange(bracketExp.GetSubExps());
         }
         else
         {
             throw new CCException();
         }
     }
 }
예제 #5
0
        private ZLMethodInfo SearchZMethod(string name)
        {
            ZMethodCall calldesc = new ZMethodCall();

            calldesc.Add(name);
            ContextImportUse contextiu = this.FileContext.ImportUseContext;

            return(contextiu.SearchUseMethod(calldesc)[0]);
        }
예제 #6
0
        private ZLMethodInfo SearchZMethod(string name)
        {
            ZMethodCall calldesc = new ZMethodCall();

            calldesc.Add(name);
            var methods = this.ClassContext.SearchSuperProc(calldesc);

            return(methods[0]);
        }
예제 #7
0
        public bool IsThisMethodSingle(string name)
        {
            ZMethodCall calldesc = new ZMethodCall();

            calldesc.Add(name);
            //ZClassCompilingType zcc = this.ClassContext.ThisCompilingType;
            var methods = this.ClassContext.SearchThisProc(calldesc);

            return(methods.Length > 0);
        }
예제 #8
0
        public bool IsUseMethodSingle(string name)
        {
            ContextImportUse importUseContext = this.ClassContext.FileContext.ImportUseContext;
            //ContextUse cu = this.ClassContext.FileContext.UseContext;
            ZMethodCall calldesc = new ZMethodCall();

            calldesc.Add(name);
            var methods = importUseContext.SearchUseMethod(calldesc);

            return(methods != null && methods.Length > 0);
        }
예제 #9
0
 public ExpCallUse(ContextExp context, ZMethodCall expProcDesc, ZLMethodInfo zmethod,
                   Exp srcExp, List <Exp> argExps) : base(context)
 {
     this.ExpProcDesc    = expProcDesc;
     this.SearchedMethod = zmethod;
     this.SrcExp         = srcExp;
     this.ArgExps        = argExps;
     foreach (Exp sub in ArgExps)
     {
         sub.ParentExp = this;
     }
 }
예제 #10
0
 public ExpCallSubject(ContextExp context, Exp SubjectExp, ZMethodCall expProcDesc, Exp srcExp, List <Exp> argExps)
     : base(context)
 {
     this.SubjectExp  = SubjectExp;
     this.ExpProcDesc = expProcDesc;
     this.SrcExp      = srcExp;
     this.ArgExps     = argExps;
     foreach (Exp sub in ArgExps)
     {
         sub.ParentExp = this;
     }
 }
예제 #11
0
        public bool IsSuperMethodSingle(string name)
        {
            if (this.IsStatic())
            {
                return(false);
            }
            ZMethodCall calldesc = new ZMethodCall();

            calldesc.Add(name);
            var methods = this.ClassContext.SearchSuperProc(calldesc);

            return(methods.Length > 0);
        }
예제 #12
0
        private ZLMethodInfo SearchZMethod(string name)
        {
            ZType       mainType = SubjectAnalyedExp.RetType;
            ZMethodCall calldesc = new ZMethodCall();

            calldesc.Add(name);
            if (mainType is ZLClassInfo)
            {
                var methods = (mainType as ZLClassInfo).SearchZMethod(calldesc);
                return(methods[0]);
            }
            return(null);
        }
예제 #13
0
        private ZCMethodInfo SearchZMethod(string name)
        {
            ZMethodCall calldesc = new ZMethodCall();

            calldesc.Add(name);
            var methods = this.ClassContext.SearchThisProc(calldesc);

            if (methods.Length == 0)
            {
                throw new CCException();
            }
            return(methods[0]);
        }
예제 #14
0
        public ZLMethodInfo[] SearchUseMethod(ZMethodCall calldesc)
        {
            List <ZLMethodInfo> list = new List <ZLMethodInfo>();

            foreach (ZLClassInfo zclass in UseZClassList)
            {
                var zitem = zclass.SearchZMethod(calldesc);
                if (zitem != null && zitem.Length > 0)
                {
                    list.AddRange(zitem);
                }
            }
            return(list.ToArray());
        }
예제 #15
0
        public override Exp Analy()
        {
            if (this.IsAnalyed)
            {
                return(this);
            }
            MethodName = MethodToken.Text;
            CallDesc   = new ZMethodCall();
            CallDesc.Add(MethodName);

            Method    = SearchZMethod(MethodName);
            RetType   = Method.RetZType;
            IsAnalyed = true;
            return(this);
        }
예제 #16
0
 public static bool ZEqualsDesc(ZCMethodDesc zmc1, ZMethodCall zmc2)
 {
     if (!ZDescUtil.ZEqualsIPartsCount(zmc1, zmc2))
     {
         return(false);
     }
     if (!ZDescUtil.ZEqualsIPartsText(zmc1, zmc2))
     {
         return(false);
     }
     if (!ZDescUtil.ZEqualsIPartsParameters(zmc1, zmc2))
     {
         return(false);
     }
     return(true);
 }
예제 #17
0
 public ZCMethodInfo[] SearchThisProc(ZMethodCall procDesc)
 {
     return((ZCMethodInfo[])SelfCompilingType.SearchDeclaredZMethod(procDesc));
 }
예제 #18
0
 public ZLMethodInfo[] SearchSuperProc(ZMethodCall procDesc)
 {
     return(SelfCompilingType.BaseZClass.SearchZMethod(procDesc));
 }
예제 #19
0
 public ZLMethodInfo[] SearchUseMethod(ZMethodCall calldesc)
 {
     return(useContext.SearchUseMethod(calldesc));
 }