public override void Emit() { //ILGenerator il = context.ILout; base.EmitArgsExp(OpMethod.GetParameters(), new Exp[] { LeftExp, RightExp }); EmitHelper.CallDynamic(IL, OpMethod); base.EmitConv(); }
void emitItem() { EmitHelper.LoadVar(IL, listSymbol.VarBuilder); EmitHelper.LoadVar(IL, indexSymbol.VarBuilder); EmitHelper.CallDynamic(IL, itemMethod); EmitHelper.StormVar(IL, itemSymbol.VarBuilder); }
public override void Emit() { EmitSubject(); base.EmitArgs(ExpProcDesc, SearchedMethod.ZDesces[0]); //GenerateArgs(context); EmitHelper.CallDynamic(IL, SearchedMethod.SharpMethod); EmitConv(); //base.GenerateConv(context); }
public override void Emit() { EmitLoadMain(); EmitArgsThis(ZMethod, ArgExps); EmitHelper.CallDynamic(IL, ZMethod.SharpMethod); EmitConv(); }
public void Generate(TypeBuilder classBuilder, bool isStatic) { var symbols = MethodContext.Symbols; EmitStmtContext stmtContext = new EmitStmtContext(MethodContext.EmitContext); var il = MethodContext.EmitContext.ILout; for (int i = 0; i < MethodContext.LoacalVarList.Count; i++) { string ident = MethodContext.LoacalVarList[i]; SymbolVar varSymbol = symbols.Get(ident) as SymbolVar; varSymbol.VarBuilder = il.DeclareLocal(varSymbol.DimType); varSymbol.VarBuilder.SetLocalSymInfo(varSymbol.SymbolName); } if (MethodContext.RetType != typeof(void)) { if (MethodContext.RetType.IsValueType) { EmitHelper.LoadInt(il, 0); } else { il.Emit(OpCodes.Ldnull); } EmitHelper.StormVar(il, (symbols.Get(MethodContext.LoacalVarList[0]) as SymbolVar).VarBuilder); } if (FnName.IsConstructor(this.ClassName) != -1) { if (!isStatic) { callBaseDefault(); if (ClassContext.InitMemberValueMethod != null) { il.Emit(OpCodes.Ldarg_0); EmitHelper.CallDynamic(il, ClassContext.InitMemberValueMethod, true);//EmitHelper.CallDynamic(il, ClassContext.InitMemberValueMethod); } } else { if (ClassContext.InitMemberValueMethod != null) { EmitHelper.CallDynamic(il, ClassContext.InitMemberValueMethod, true);//EmitHelper.CallDynamic(il, ClassContext.InitMemberValueMethod); } } } //var MethodName = getMethodName(isStatic); //if(MethodName=="启动") //{ // //EmitHelper.CallDynamic(il, typeof(DebugHelper).GetMethod("PrintBaseDirectory")); //} FnBody.Generate(stmtContext); if (MethodContext.RetType != typeof(void)) { il.Emit(OpCodes.Ldloc, retResult.VarBuilder); EmitHelper.EmitConv(il, MethodContext.RetType, retResult.DimType); } il.Emit(OpCodes.Ret); }
public override void Generate(EmitExpContext context) { ILGenerator il = context.ILout; base.GenerateArgsExp(context, OpMethod.GetParameters(), new Exp[] { LeftExp, RightExp }); EmitHelper.CallDynamic(il, OpMethod, true); base.GenerateConv(context); }
public void EmitGet( ) { MethodInfo getMethod = Property.GetGetMethod(); EmitHelper.LoadVar(IL, ListSymbol.VarBuilder);//SubjectExp.Emit(); EmitHelper.LoadVar(IL, IndexSymbol.VarBuilder); EmitHelper.CallDynamic(IL, getMethod); }
void generateCount(EmitStmtContext context) { ILGenerator il = context.ILout; EmitHelper.LoadVar(il, listSymbol.VarBuilder); EmitHelper.CallDynamic(il, getCountMethod); EmitHelper.StormVar(il, countSymbol.VarBuilder); }
public override void Emit() { base.EmitArgsExp(new Exp[] { LeftExp, RightExp }, OpMethod); EmitHelper.CallDynamic(IL, OpMethod); EmitSymbolHelper.EmitStorm(IL, TempStormLocalVarSymbol); EmitSymbolHelper.EmitLoad(IL, TempStormLocalVarSymbol); base.EmitConv(); }
public void GenerateGet(EmitExpContext context) { ILGenerator il = context.ILout; MethodInfo getMethod = ExProperty.Property.GetGetMethod(); GenenrateSubject(context); EmitHelper.CallDynamic(il, getMethod, ExProperty.IsSelf); }
void generateCondition(EmitStmtContext context) { EmitHelper.LoadVar(IL, indexSymbol.VarBuilder); EmitHelper.LoadVar(IL, countSymbol.VarBuilder); EmitHelper.CallDynamic(IL, compareMethod, true); EmitHelper.LoadInt(IL, 1); IL.Emit(OpCodes.Ceq); }
protected void EmitCondition( ) { EmitHelper.LoadVar(IL, IndexSymbol.VarBuilder); EmitHelper.LoadVar(IL, CountSymbol.VarBuilder); EmitHelper.CallDynamic(IL, LEMethod); EmitHelper.LoadInt(IL, 1); IL.Emit(OpCodes.Ceq); }
public void EmitSet(Exp valueExp) { MethodInfo setMethod = Property.GetSetMethod(); EmitHelper.LoadVar(IL, ListSymbol.VarBuilder); EmitHelper.LoadVar(IL, IndexSymbol.VarBuilder); valueExp.Emit(); EmitHelper.CallDynamic(IL, setMethod); }
private void EmitSetProperty(Exp valueExp) { EmitHelper.EmitThis(IL, true); EmitValueExp(valueExp); MethodInfo setMethod = ZProperty.SharpProperty.GetSetMethod(); EmitHelper.CallDynamic(IL, setMethod); base.EmitConv(); }
void generateElement(EmitStmtContext context) { ILGenerator il = context.ILout; EmitHelper.LoadVar(il, listSymbol.VarBuilder); EmitHelper.LoadVar(il, indexSymbol.VarBuilder); EmitHelper.CallDynamic(il, diMethod); EmitHelper.StormVar(il, elementSymbol.VarBuilder); }
void genBody(EmitExpContext context) { ILGenerator il = context.ILout; invokeExp.GenerateSubject(context); generateElement(context); invokeExp.GenerateArgs(context); EmitHelper.CallDynamic(il, invokeExp.CallExMethod); }
public void AnalyBody() { Body.ProcContext = this.ProcContext; if (this.ProcContext.ClassContext.InitPropertyMethod != null) { EmitHelper.CallDynamic(Body.IL, this.ProcContext.ClassContext.InitPropertyMethod); } Body.Analy(); }
public void EmitGet( ) { MethodInfo getMethod = Property.GetGetMethod(); SubjectExp.Emit(); ArgExp.RequireType = ZTypeManager.GetBySharpType(getMethod.ReturnType) as ZType; ArgExp.Emit(); EmitHelper.CallDynamic(IL, getMethod); }
public override void Generate(EmitExpContext context) { ILGenerator il = context.ILout; GenerateSubject(context); base.GenerateArgsExp(context, ExpProcDesc, searchedProcDesc); //GenerateArgs(context); EmitHelper.CallDynamic(il, CallExMethod); base.GenerateConv(context); }
public void GenerateSet(EmitExpContext context, Exp valueExpr) { ILGenerator il = context.ILout; MethodInfo setMethod = ExProperty.Property.GetSetMethod(); GenenrateSubject(context); valueExpr.Generate(context); EmitHelper.CallDynamic(il, setMethod, ExProperty.IsSelf); }
void generateCondition(EmitStmtContext context) { ILGenerator il = context.ILout; EmitHelper.LoadVar(il, indexSymbol.VarBuilder); EmitHelper.LoadVar(il, countSymbol.VarBuilder); EmitHelper.CallDynamic(il, compareMethod, true); EmitHelper.LoadInt(il, 1); il.Emit(OpCodes.Ceq); }
public virtual void EmitGetProperty() { //bool isstatic = GetIsStatic(); MethodInfo getMethod = GetGetMethod(); //EmitHelper.EmitThis(IL, isstatic); EmitLoadMain(); EmitHelper.CallDynamic(IL, getMethod); base.EmitConv(); }
//public virtual void EmitGetNestedProperty() //{ // bool isstatic = GetIsStatic(); // MethodInfo getMethod = GetGetMethod(); // EmitHelper.EmitThis(IL, isstatic); // EmitSymbolHelper.EmitLoad(IL, LambdaThis); // EmitHelper.CallDynamic(IL, getMethod); // base.EmitConv(); //} public virtual void EmitSetProperty(Exp valueExp) { //bool isstatic = GetIsStatic(); MethodInfo setMethod = GetSetMethod(); //EmitHelper.EmitThis(IL, isstatic); EmitLoadMain(); EmitValueExp(valueExp); EmitHelper.CallDynamic(IL, setMethod); }
public void GenerateGet(EmitExpContext context) { ILGenerator il = context.ILout; MethodInfo getMethod = ExProperty.Property.GetGetMethod(); SubjectExp.Generate(context); ArgExp.RequireType = getMethod.ReturnType; ArgExp.Generate(context); EmitHelper.CallDynamic(il, getMethod, ExProperty.IsSelf); }
public virtual void EmitSetNestedProperty(Exp valueExp) { bool isstatic = GetIsStatic(); MethodInfo setMethod = GetSetMethod(); EmitHelper.EmitThis(IL, false); EmitSymbolHelper.EmitLoad(IL, LambdaThis); EmitValueExp(valueExp); EmitHelper.CallDynamic(IL, setMethod); }
public void EmitSet(Exp valueExp) { MethodInfo setMethod = Property.GetSetMethod(); SubjectExp.Emit(); ArgExp.RequireType = ZTypeManager.GetBySharpType(setMethod.GetParameters()[0].ParameterType) as ZType; ArgExp.Emit(); //EmitHelper.Box(il, ArgExp.RetType, setMethod.GetParameters()[0].ParameterType); valueExp.RequireType = ZTypeManager.GetBySharpType(setMethod.GetParameters()[1].ParameterType) as ZType; valueExp.Emit(); EmitHelper.CallDynamic(IL, setMethod); }
public void GenerateSet(EmitExpContext context, Exp valueExpr) { ILGenerator il = context.ILout; MethodInfo setMethod = ExProperty.Property.GetSetMethod(); SubjectExp.Generate(context); ArgExp.RequireType = setMethod.GetParameters()[0].ParameterType; ArgExp.Generate(context); //EmitHelper.Box(il, ArgExp.RetType, setMethod.GetParameters()[0].ParameterType); valueExpr.RequireType = setMethod.GetParameters()[1].ParameterType; valueExpr.Generate(context); EmitHelper.CallDynamic(il, setMethod, ExProperty.IsSelf); }
public void EmitGet( ) { if (ZMember is ZPropertyInfo) { MethodInfo getMethod = (ZMember as ZPropertyInfo).SharpProperty.GetGetMethod(); EmitSubject(); EmitHelper.CallDynamic(IL, getMethod); } else { EmitSubject(); EmitHelper.LoadField(IL, (ZMember as ZFieldInfo).SharpField); } }
public override void Generate(EmitExpContext context) { ILGenerator il = context.ILout; if (newCode == 1) { var Constructor = ConstructorDesc.Constructor; LocalBuilder varLocal = il.DeclareLocal(SubjectGCL.ForType); EmitHelper.NewObj(il, Constructor); il.Emit(OpCodes.Stloc, varLocal); MethodInfo addMethod = SubjectGCL.ForType.GetMethod("Add"); ExMethodInfo exAddMethodInfo = GclUtil.CreatExMethodInfo(addMethod, SubjectGCL.ForType); if (BrackestArgs != null) { foreach (var exp in BrackestArgs.InneExps) { EmitHelper.LoadVar(il, varLocal);//il.Emit(OpCodes.Ldloc, varLocal); (exp).Generate(context); EmitHelper.CallDynamic(il, exAddMethodInfo); } } EmitHelper.LoadVar(il, varLocal);//il.Emit(OpCodes.Ldloc, varLocal); } else if (newCode == 2) { var Constructor = ConstructorDesc.Constructor; if (!IsAssignedValue) { LocalBuilder varLocal = il.DeclareLocal(SubjectGCL.ForType); emitConstructor(context);//emitArgs(context); EmitHelper.NewObj(il, Constructor); il.Emit(OpCodes.Stloc, varLocal); EmitHelper.LoadVar(il, varLocal);//il.Emit(OpCodes.Ldloc, varLocal); } else { emitConstructor(context);//emitArgs(context); EmitHelper.NewObj(il, Constructor); } } else { var Method = ProcDesc.ExMethod; emitProc(context); EmitHelper.CallDynamic(il, Method); } base.GenerateConv(context); }
public void EmitSet(Exp valueExp) { if (ZMember is ZPropertyInfo) { MethodInfo setMethod = (ZMember as ZPropertyInfo).SharpProperty.GetSetMethod(); EmitSubject(); valueExp.Emit(); EmitHelper.CallDynamic(IL, setMethod); } else { EmitSubject(); valueExp.Emit(); EmitHelper.StormField(IL, (ZMember as ZFieldInfo).SharpField); } }