Esempio n. 1
0
 public void AddCache(ZLType descType, string sname)
 {
     try
     {
         if (!MarkCache.ContainsKey(descType.MarkType))
         {
             MarkCache.Add(descType.MarkType, descType);
         }
         if (!SharpCache.ContainsKey(descType.SharpType))
         {
             SharpCache.Add(descType.SharpType, descType);
         }
         if (!ZNameCache.ContainsKey(descType.ZTypeName))
         {
             ZNameCache.Add(descType.ZTypeName, descType);
         }
         if (!SNameCache.ContainsKey(sname))
         {
             SNameCache.Add(sname, descType);
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine("ZTypeManager.Cache.AddCache(IBLibType):" + sname + ":" + ex.Message);
     }
 }
Esempio n. 2
0
        public void AddUseType(ZLType iztype)
        {
            string key = iztype.ZTypeName;

            useTypes.Remove(key);
            useTypes.Add(iztype.ZTypeName, iztype);
        }
Esempio n. 3
0
 public void AddImportType(ZLType itype)
 {
     if (itype is ZLEnumInfo)
     {
         ContextFileManager.Import((ZLEnumInfo)itype);
     }
     else
     {
         ContextFileManager.Import((ZLClassInfo)itype);
     }
 }
Esempio n. 4
0
        public ZLType SearchZTypeOne(string zname)
        {
            ZLType ztype = null;

            ztype = EnumerableHelper.SearchOne <ZLEnumInfo>(EnumTypes, (ZLEnumInfo zenum) => zenum.ZTypeName == zname);
            if (ztype == null)
            {
                ztype = EnumerableHelper.SearchOne <ZLClassInfo>(ClassTypes, (ZLClassInfo zclass) => zclass.GetZClassName() == zname);
            }
            return(ztype);
        }
Esempio n. 5
0
 public static void EmitConv(ILGenerator il, ZType targetZType, ZType curZType)
 {
     if (targetZType is ZLType)
     {
         ZLType targetType = (ZLType)targetZType;
         if (curZType is ZLType)
         {
             ZLType curType = (ZLType)curZType;
             EmitConv(il, targetType.SharpType, curType.SharpType);
         }
     }
 }
Esempio n. 6
0
        public ZLType[] SearchZType(string zname)
        {
            ZLType ztype = SearchZTypeOne(zname);

            if (ztype == null)
            {
                return(new ZLType[] { });
            }
            else
            {
                return(new ZLType[] { ztype });
            }
        }
Esempio n. 7
0
        public static bool IsVoid(ZType ztype)
        {
            if (ztype == null)
            {
                throw new NullReferenceException();
            }
            if (!(ztype is ZLType))
            {
                return(false);
            }
            ZLType zltype = (ZLType)ztype;

            return(zltype.SharpType == typeof(void));
        }
Esempio n. 8
0
 public void AddZDescType(ZLType descType)
 {
     if (descType is ZLEnumInfo)
     {
         ZLEnumInfo zenum = descType as ZLEnumInfo;
         EnumTypes.Add(zenum);
     }
     else if (descType is ZLClassInfo)
     {
         ZLClassInfo zclass = descType as ZLClassInfo;
         ClassTypes.Add(zclass);
     }
     else
     {
         throw new ZyyRTException();
     }
 }
Esempio n. 9
0
        public static ZLType GetByMarkType(Type type)
        {
            if (type == null)
            {
                return(null);
            }
            if (Cache.MarkCache.ContainsKey(type))
            {
                return(Cache.MarkCache[type]);
            }
            ZLType descType = CreateZTypeImp(type);

            if (descType != null)
            {
                Cache.AddCache(descType);
            }
            return(descType);
        }
Esempio n. 10
0
 public void Add(ZLType iztype)
 {
     if (iztype is ZLEnumInfo)
     {
         UseZEnumList.Add(iztype as ZLEnumInfo);
     }
     else if (iztype is ZLDimInfo)
     {
         UseZDimList.Add(iztype as ZLDimInfo);
     }
     else if (iztype is ZLClassInfo)
     {
         UseZClassList.Add(iztype as ZLClassInfo);
     }
     else
     {
         throw new CCException();
     }
 }
Esempio n. 11
0
 public void Run(ProjectCompileResult result)
 {
     if (result.MessageCollection.Errors.Count == 0)
     {
         foreach (var item in result.CompiledTypes.ZClasses)
         {
             if (item is ZLType)
             {
                 ZLType zclass = item as ZLType;
                 Type   type   = zclass.SharpType;
                 using (TurtleForm turtleForm = new  TurtleForm())
                 {
                     TurtleSprite turtleSprite = ReflectionUtil.NewInstance(type) as TurtleSprite;
                     turtleSprite.SetForm(turtleForm);
                     turtleForm.Turtle = turtleSprite;
                     turtleForm.Run();
                 }
                 return;
             }
         }
     }
 }
Esempio n. 12
0
        public override Stmt Analy()
        {
            TypeArgParser parser = new TypeArgParser(this.ProcContext.ClassContext);

            TypeArgParser.ParseResult result = parser.Parse(Raw.ExceptionTypeVarToken);
            if (result.ResultCount == 1)
            {
                exTypeName = result.ArgZTypes[0].ZTypeName;
                exType     = (ZLType)result.ArgZTypes[0];
                exName     = result.ArgName;
            }
            if (this.ProcContext.ContainsVarName(exName) == false)
            {
                exSymbol = new ZCLocalVar(exName, exType, true);
                //exSymbol.LoacalVarIndex =this.ProcContext.CreateLocalVarIndex(exName);
                this.ProcContext.AddLocalVar(exSymbol);
            }
            else
            {
                if (this.ProcContext.LocalManager.IsDefLocal(exName))
                {
                    exSymbol = this.ProcContext.LocalManager.GetDefLocal(exName);
                    if (exSymbol.GetZType() != exType)
                    {
                        Errorf(Raw.ExceptionTypeVarToken.Position, "变量'{0}'的类型与异常的类型不一致", exName);
                    }
                }
                else
                {
                    Errorf(Raw.ExceptionTypeVarToken.Position, "变量名称'{0}'已经使用过", exName);
                }
            }
            //CatchBody.ProcContext = this.ProcContext;
            StmtBody.Analy();
            return(this);
        }
Esempio n. 13
0
 public void AddUseType(ZLType iztype)
 {
     useContext.Add(iztype);
 }