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); } }
public void AddUseType(ZLType iztype) { string key = iztype.ZTypeName; useTypes.Remove(key); useTypes.Add(iztype.ZTypeName, iztype); }
public void AddImportType(ZLType itype) { if (itype is ZLEnumInfo) { ContextFileManager.Import((ZLEnumInfo)itype); } else { ContextFileManager.Import((ZLClassInfo)itype); } }
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); }
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); } } }
public ZLType[] SearchZType(string zname) { ZLType ztype = SearchZTypeOne(zname); if (ztype == null) { return(new ZLType[] { }); } else { return(new ZLType[] { ztype }); } }
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)); }
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(); } }
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); }
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(); } }
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; } } } }
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); }
public void AddUseType(ZLType iztype) { useContext.Add(iztype); }