private ZType GetZTypeByTypeName(string typeName) { //if (typeName == "Func<bool>") //{ // arg = new ZMethodArg(typeName, ZTypeCache.GetByZType(typeof(Func<bool>))); //} //else if (argtypename == "Action") //{ // arg = new ZMethodArg(realArgName, ZTypeCache.GetByZType(typeof(Action))); //} //else //{ var ztypes = ZTypeManager.GetByMarkName(typeName); if (ztypes.Length == 0) { ztypes = ZTypeManager.GetBySharpName(typeName); } if (ztypes.Length > 0) { ZType ztype = ztypes[0] as ZType; //arg = new ZMethodArg(typeName, ztype); return(ztype); } else { } return(null); }
//public Type DimType { get; set; } //public SymbolLocalVar(string name) //{ // this.SymbolName = name; //} public SymbolLocalVar(string name, ZType type) { this.SymbolName = name; SymbolZType = type; CanRead = true; CanWrite = true; }
/// <summary> /// Date Coder Vers Notes /// 2020-01-09 Clay 1.0 Initial /// /// There will be several overloads for the constructor. /// </summary> /// <param name="L"></param> /// <param name="N"></param> /// <param name="ZType"></param> /// <param name="Size"></param> public Horde(GeoEngine_Workspace.Location L, String N, ZType ZType, HordeSize Size) { this.ContactLocation = L; this.ContactName = N; this.ContactType = ZType; this.ContactHordeSize = Size; }
private void AnalyType() { if (_IsExist) { return; } ContextImportUse contextiu = this.FileContext.ImportUseContext; string[] names = contextiu.GetArgSegementer().Cut(ArgText); if (names.Length != 2) { throw new CCException(); } ArgZTypeName = names[0]; ArgName = names[1]; if (this.MethodContext.HasParameter(ArgName)) { _IsExist = true; CodePosition argPos = new CodePosition(ParameterRaw.ParameterToken.Line, ParameterRaw.ParameterToken.Col + ArgZTypeName.Length); FileContext.Errorf(argPos, "参数'{0}'重复", ArgName); } else { ZType[] ztypes = contextiu.SearchZTypesByClassNameOrDimItem(ArgZTypeName); ArgZType = ztypes[0]; //_argSymbol = new SymbolArg(ArgName, ArgZType); //this.ProcContext.AddParameter(_argSymbol); //_argSymbol = new ZCParamInfo(ArgName, ArgZType); //ProcContext.AddParameter(_argSymbol); _ZCParam = MethodContext.AddParameterName(ArgName); _ZCParam.ZParamType = ArgZType; } }
public static ZTypeCompareEnum Compare(ZType z1, ZType z2) { if (z1 is ZLEnumInfo || z2 is ZLEnumInfo) { return(ZTypeCompareEnum.NEQ); } if (z1.IsRuntimeType || z2.IsRuntimeType) { return(ZTypeCompareEnum.NEQ); } if (z1 is ZCClassInfo) { if (z2 is ZCClassInfo) { return(Compare((ZCClassInfo)z1, (ZCClassInfo)z2)); } else { return(Compare((ZCClassInfo)z1, (ZLClassInfo)z2)); } } else { if (z2 is ZCClassInfo) { return(Compare((ZLClassInfo)z1, (ZCClassInfo)z2)); } else { return(Compare((ZLClassInfo)z1, (ZLClassInfo)z2)); } } }
public async Task <IActionResult> Edit(int id, [Bind("Id,Code,DescriptionRU,DescriptionKK,DescriptionEN,Color")] ZType zType) { if (id != zType.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(zType); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ZTypeExists(zType.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(zType)); }
private void AnalyFields( ) { var symbols = NestedClassContext.Symbols; FieldSymbols = new List <SymbolDefField>(); if (ExpContext.ClassContext.IsStaticClass == false) { TypeBuilder builder = ExpContext.ClassContext.EmitContext.ClassBuilder; FieldBuilder field = ClassBuilder.DefineField(OutClassFieldName, builder, FieldAttributes.Public); ZType ztype = new ZClassType(builder, builder, false); SymbolDefField fieldSymbol = new SymbolDefField(OutClassFieldName, ztype, false); fieldSymbol.Field = field; FieldSymbols.Add(fieldSymbol); symbols.Add(fieldSymbol); this.NestedClassContext.NestedOutFieldSymbol = fieldSymbol; } foreach (SymbolBase symbol in BodyVars) { ZType ztype = symbol.SymbolZType; FieldBuilder field = ClassBuilder.DefineField(symbol.SymbolName, ztype.SharpType, FieldAttributes.Public); SymbolDefField fieldSymbol = new SymbolDefField(symbol.SymbolName, ztype, false); fieldSymbol.Field = field; FieldSymbols.Add(fieldSymbol); symbols.Add(fieldSymbol); } foreach (ExpVar expVar in FieldExpVars) { SymbolDefField symbol = symbols.Get(expVar.VarName) as SymbolDefField; expVar.SetAsLambdaFiled(symbol); } }
public SymbolDefMember(string name, ZType memberType, bool isStatic) { this.SymbolName = name; SymbolZType = memberType; HasDefaultValue = true; IsStatic = isStatic; }
protected void DownToExcel_B_Click(object sender, EventArgs e) { OfficeHelper office = new OfficeHelper(); string name = ZType.ToLower().Equals("comment") ? "评论排行.xls" : "点击排行.xls"; SafeC.DownStr(office.ExportExcel(GetDt(), "标题,点击数,评论数,录入者,录入时间"), DateTime.Now.ToString("yyyyMMdd") + "点击排行.xls", Encoding.Default); }
private void AnalyCountMethod() { ZType subjectZType = SubjectExp.RetType; Type mainType = ZTypeUtil.GetTypeOrBuilder(subjectZType); // subjectZType.SharpType; PropertyInfo countProperty = mainType.GetProperty(ZLangUtil.ZListCountPropertyName); //"Count"); getCountMethod = countProperty.GetGetMethod(); }
public static MethodInfo GetCalcMethod(TokenKindSymbol opKind, ZType ltype, ZType rtype) { if (ltype is ZLType && rtype is ZLType) { return(GetCalcMethod(opKind, (ltype as ZLType).SharpType, (rtype as ZLType).SharpType)); } return(null); }
//ContextExp OutExpContext; public ExpLambdaBody(Exp exp, ZType fnRetType, List <SymbolBase> bodyVars, List <ExpVar> fieldExpVars, ContextExp outExpContext) { BodyExp = exp; FnRetType = fnRetType; BodyVars = bodyVars; FieldExpVars = fieldExpVars; ExpContext = outExpContext; }
/// <summary> /// Date Coder Vers Notes /// 2020-01-18 Clay 1.0 Initial /// /// /// This is the biggie constructor without the Serial Number. /// Why would I need to different constructors. The answer is /// to remember who gives out the serial numbers. The database. :) /// </summary> /// <param name="Lat"></param> /// <param name="Long"></param> /// <param name="Elevate"></param> /// <param name="Year"></param> /// <param name="Month"></param> /// <param name="Day"></param> /// <param name="ZType"></param> /// <param name="Name"></param> public Zombie(double Lat, double Long, double Elevate, int Year, int Month, int Day, ZType ZType, String Name) { ContactLocation = new GeoEngine_Workspace.Location(Lat, Long, Elevate); ContactLocation.SetDate(Year, Month, Day); ContactType = ZType; ContactName = Name; ZombieSerialNumber = 0; }
private void AnalyCountMethod() { ZType subjectZType = SubjectExp.RetType; Type mainType = subjectZType.SharpType; PropertyInfo countProperty = mainType.GetProperty(CompileConstant.ZListCountPropertyName);//"Count"); getCountMethod = countProperty.GetGetMethod(); }
public override Exp Analy( ) { if (this.IsAnalyed) { return(this); } AnalyCorrect = true; if (LeftExp == null && RightExp != null) { ExpUnary unexp = new ExpUnary(this.ExpContext, OpToken, RightExp); var exp = unexp.Analy(); return(exp); } else if (LeftExp == null && RightExp == null) { Errorf(this.OpToken.Position, "运算符'{0}'两边缺少表达式", OpToken.Text); } OpKind = OpToken.Kind; LeftExp = AnalySubExp(LeftExp); RightExp = AnalySubExp(RightExp); if (RightExp == null) { Errorf(OpToken.Position, "运算符'{0}'右边缺少运算元素", OpToken.Text); } else { this.AnalyCorrect = this.LeftExp.AnalyCorrect && RightExp.AnalyCorrect && this.AnalyCorrect; if (LeftExp.AnalyCorrect && RightExp.AnalyCorrect) { ZType ltype = LeftExp.RetType; ZType rtype = RightExp.RetType; if (ZTypeUtil.IsVoid(ltype) || ZTypeUtil.IsVoid(rtype)) { Errorf(OpToken.Position, "没有结果的表达式无法进行'{0}'运算", OpToken.ToCode()); } else { OpMethod = ExpBinaryUtil.GetCalcMethod(OpKind, ltype, rtype); if (OpMethod != null) { RetType = ZTypeManager.GetBySharpType(OpMethod.ReturnType) as ZType; } else { Errorf(OpToken.Position, "两种类型无法进行'{0}'运算", OpToken.ToCode()); } } } else { this.RetType = ZLangBasicTypes.ZOBJECT; } } //AnalyResultLocal(); IsAnalyed = true; return(this); }
private bool checkCanForeach(ZType ztype) { if (ztype is ZLType) { Type type = ((ZLType)ztype).SharpType; return(checkCanForeach(type)); } return(false); }
public async Task <ActionResult> DeleteConfirmed(int id) { ZType zType = await db.ZTypes.FindAsync(id); db.ZTypes.Remove(zType); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public void AnalyType() { if (IsExists) { return; } PropertyZType = AnalyPropertyZType(); ZPropertyCompiling.ZPropertyType = PropertyZType;//.SetMemberType(PropertyZType); }
public SymbolArg(string name, ZType argType, int argIndex) { this.SymbolName = name; ArgZType = argType; ArgIndex = argIndex; SymbolZType = ArgZType; CanRead = true; CanWrite = true; }
public ExpTypeTwo(ContextExp expContext, LexToken varToken1, LexToken varToken2, ZType varZtype1, ZType varZtype2, ZType varZtypeCreated) : base(expContext) { VarToken1 = varToken1; VarToken2 = varToken2; VarZtype1 = varZtype1; VarZtype2 = varZtype2; VarZtypeCreated = varZtypeCreated; this.RetType = varZtypeCreated; }
public async Task <IActionResult> Create([Bind("Id,Code,DescriptionRU,DescriptionKK,DescriptionEN,Color")] ZType zType) { if (ModelState.IsValid) { _context.Add(zType); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(zType)); }
public bool AnalyNameType(NameTypeParser parser) { NameTypeParser.ParseResult result = parser.ParseVar(ArgToken); if (result != null) { ArgName = result.VarName; ArgZType = result.ZType; return(true); } return(false); }
public async Task <ActionResult> Edit([Bind(Include = "Id,Code,Description,Color")] ZType zType) { if (ModelState.IsValid) { db.Entry(zType).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(zType)); }
private MethodInfo MakeCastMethod(ZType ztype) { if (ztype is ZLType) { return(caseMethod.MakeGenericMethod(new Type[] { ((ZLType)ztype).SharpType })); } else { return(caseMethod.MakeGenericMethod(new Type[] { ((ZCClassInfo)ztype).ClassBuilder })); } }
public ZType Compile(ModuleBuilder moduleBuilder, string packageName) { AnalyName(); EmitName(moduleBuilder, packageName); AnalyBody(); EmitBody(); var EmitedType = Builder.CreateType(); ZType ztype = ZTypeManager.GetByMarkType(EmitedType) as ZType; return(ztype); }
private ZType SearchZType(LexToken token) { string typeName = token.Text; var ztypes = this.ExpContext.FileContext.ImportUseContext.SearchImportType(typeName); ZType ztype = ztypes[0] as ZType; if (ztype == null) { Errorf(token.Position, "类型'{0}'不存在", token.Text); } return(ztype); }
private void AnalyGeneric_1() { Token genericArgTypeToken = TypeTokens[0]; ZType genericArgZType = SearchZType(genericArgTypeToken); if (genericArgZType != null) { Type newType = mainZType.SharpType.MakeGenericType(genericArgZType.SharpType); ZType newZtype = ZTypeManager.RegNewGenericType(newType); RetType = newZtype; } }
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); } } }
private ZType SearchZType(Token token) { string typeName = token.GetText(); var ztypes = this.ExpContext.FileContext.SearchZDescType(typeName); ZType ztype = ztypes[0] as ZType; if (ztype == null) { ErrorE(token.Position, "类型'{0}'不存在", token.GetText()); } return(ztype); }
private bool CanUnary(ZType ztype) { if (ztype is ZLType) { Type stype = ((ZLType)ztype).SharpType; if (stype == typeof(int) || stype == typeof(float) || stype == typeof(double) || stype == typeof(decimal)) { return(true); } } return(false); }