void GenenrateSubject(EmitExpContext context) { ILGenerator il = context.ILout; bool isgen = false; if ((SubjectExp is VarExp)) { VarExp varexp = SubjectExp as VarExp; if (ReflectionUtil.IsStruct(varexp.RetType)) { if (varexp.VarSymbol is SymbolVar) { il.Emit(OpCodes.Ldloca, (varexp.VarSymbol as SymbolVar).VarBuilder); isgen = true; } else if (varexp.VarSymbol is SymbolArg) { il.Emit(OpCodes.Ldarga, (varexp.VarSymbol as SymbolArg).ArgIndex); isgen = true; } } } if (!isgen) { SubjectExp.Generate(context); } }
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 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 GenerateArgILBox(EmitExpContext context,int i) * { * ILGenerator il = context.ILout; * var arg = ExpProcDesc.GetArg(i); * var exp = (arg.Value as Exp); * var rettype = exp.RetType; * TKTProcArg procArg = searchedProcDesc.GetArg(i); * Type callArgType = procArg.ArgType; * EmitHelper.Box(il, rettype, callArgType); * }*/ public void GenerateSubject(EmitExpContext context) { ILGenerator il = context.ILout; if (SubjectExp != null) { SubjectExp.Generate(context); } else { if (!CallExMethod.Method.IsStatic) { il.Emit(OpCodes.Ldarg_0); } } }