public static ZLDimInfo CreateZLDimImp(Type type) { if (AttributeUtil.HasAttribute <ZDimAttribute>(type)) { ZLDimInfo zdim = new ZLDimInfo(type); return(zdim); } return(null); }
public void Import(ZLDimInfo zldim) { //AddZTypeWord(dtype); // ImportZDimItem(zldim); foreach (var dimName in zldim.Dims.Keys) { var dimType = zldim.Dims[dimName]; ZLDimItemDict.Add(dimName, dimType); FileSegementer.AddWord(dimName); ArgSegementer.AddWord(dimName); } }
private List <IZObj> EmitTypes() { if (FileContext.HasError()) { return(new List <IZObj>()); } List <IZObj> list = new List <IZObj>(); foreach (EnumAST item in EnumASTList) { item.EmitPropertiesBody(); ZLEnumInfo ze = item.CreateZType(); if (ze != null) { list.Add(ze); this.FileContext.ProjectContext.CompiledTypes.Add(ze); } } foreach (DimAST item in DimASTList) { item.EmitPropertiesBody(); ZLDimInfo zd = item.CreateZType(); if (zd != null) { list.Add(zd); this.FileContext.ProjectContext.CompiledTypes.Add(zd); } } foreach (ClassAST item in ClassASTList) { item.EmitMemberBody(); ZLClassInfo zc = item.CreateZType(); if (zc != null) { list.Add(zc); this.FileContext.ProjectContext.CompiledTypes.Add(zc); //this.FileContext.ImportUseContext.ContextFileManager.Import(zc); } } return(list); }
public void AnalyNameItemType(LexTokenText nameToken) { ContextImportUse importUseContext = this.ASTFile.FileContext.ImportUseContext; string typeName = nameToken.Text; var ztypes = importUseContext.SearchByTypeName(typeName); if (ztypes.Length == 0) { this.ASTFile.FileContext.Errorf(nameToken.Position, "没有搜索到'{0}'", typeName); return; } var descType = ztypes[0]; if (descType is ZLClassInfo) { ZLClassInfo zclass = descType as ZLClassInfo; if (zclass.IsStatic) { importUseContext.AddUseType(zclass); } else { this.ASTFile.FileContext.Errorf(nameToken.Position, "'{0}'不是唯一类型,不能被导入类", typeName); } } else if (descType is ZLEnumInfo) { ZLEnumInfo zenum = descType as ZLEnumInfo; importUseContext.AddUseType(zenum); } else if (descType is ZLDimInfo) { ZLDimInfo zdim = descType as ZLDimInfo; importUseContext.AddDimType(zdim); } else { throw new CCException(); } }
public void AddDimType(ZLDimInfo itype) { ContextFileManager.Import(itype); }