コード例 #1
0
ファイル: ExpNew.cs プロジェクト: xonoer/ZCompileCore2
        public override Exp Analy( )
        {
            TypeExp    = AnalySubExp(TypeExp) as ExpType;       //TypeExp = ArgExp.Analy();
            BracketExp = AnalySubExp(BracketExp) as ExpBracket; //BracketExp.Analy();
            if (!AnalyCorrect)
            {
                return(this);
            }

            //Type subjectType = TypeExp.RetType.SharpType;
            if (IsList())
            {
                ExpNewList newListExp = new ExpNewList(this.ExpContext, TypeExp, BracketExp);
                //newListExp.SetContext(this.ExpContext);
                return(newListExp.Analy());
            }
            else
            {
                var args = BracketExp.GetCallNormalArgs();
                //ZMethodArgCollection argCollection = new ZMethodArgCollection(args);
                newDesc      = new ZNewDesc(args);
                ZConstructor = (TypeExp.RetType as ZClassType).FindDeclaredZConstructor(newDesc);
                if (ZConstructor == null)
                {
                    ErrorE(BracketExp.Postion, "没有正确的创建过程");
                }
                else
                {
                    RetType = TypeExp.RetType;
                }
            }
            return(this);
        }
コード例 #2
0
ファイル: ExpNew.cs プロジェクト: pyzh/ZLanguage3
        public override Exp Analy( )
        {
            if (this.IsAnalyed)
            {
                return(this);
            }
            TypeExp    = (ExpTypeBase)(AnalySubExp(TypeExp));
            BracketExp = AnalySubExp(BracketExp) as ExpBracket;
            if (!AnalyCorrect)
            {
                return(this);
            }

            if (ZTypeUtil.IsListClass(TypeExp.RetType))
            {
                ExpNewList newListExp = new ExpNewList(this.ExpContext, TypeExp, BracketExp);
                IsAnalyed = true;
                return(newListExp.Analy());
            }
            else
            {
                return(AnalyNewExpOrQiangDiao());
            }
        }