예제 #1
0
 public override void GenerateSet(ILGenerator gen, CodeExpression value)
 {
     if (type.IsByRef)
     {
         gen.Emit(OpCodes.Ldarg, argNum);
         value.Generate(gen);
         CodeGenerationHelper.GenerateSafeConversion(gen, type.GetElementType(), value.GetResultType());
         CodeGenerationHelper.SaveToPtr(gen, type.GetElementType());
     }
     else
     {
         value.Generate(gen);
         CodeGenerationHelper.GenerateSafeConversion(gen, type, value.GetResultType());
         gen.Emit(OpCodes.Starg, argNum);
     }
 }
예제 #2
0
 public override void GenerateSet(ILGenerator gen, CodeExpression value)
 {
     if (field.IsStatic)
     {
         value.Generate(gen);
         CodeGenerationHelper.GenerateSafeConversion(gen, field.FieldType, value.GetResultType());
         gen.Emit(OpCodes.Stsfld, field);
     }
     else
     {
         target.Generate(gen);
         value.Generate(gen);
         CodeGenerationHelper.GenerateSafeConversion(gen, field.FieldType, value.GetResultType());
         gen.Emit(OpCodes.Stfld, field);
     }
 }
 public override void GenerateSet(ILGenerator gen, CodeExpression value)
 {
     value.Generate(gen);
     CodeGenerationHelper.GenerateSafeConversion(gen, type, value.GetResultType());
     gen.Emit(OpCodes.Stloc, localBuilder);
 }