示例#1
0
 public override void Emit(IEasyMember member, ILGenerator gen)
 {
     this._right.Emit(member, gen);
     if (this._fromType != this._target)
     {
         if (this._fromType.IsByRef)
         {
             throw new NotSupportedException("Cannot convert from ByRef types");
         }
         if (this._target.IsByRef)
         {
             throw new NotSupportedException("Cannot convert to ByRef types");
         }
         if (this._target.IsValueType)
         {
             if (this._fromType.IsValueType)
             {
                 throw new NotImplementedException("Cannot convert between distinct value types at the moment");
             }
             gen.Emit(OpCodes.Unbox, this._target);
             OpCodeUtil.EmitLoadIndirectOpCodeForType(gen, this._target);
         }
         else if (this._fromType.IsValueType)
         {
             gen.Emit(OpCodes.Box, this._fromType);
             this.EmitCastIfNeeded(typeof(object), this._target, gen);
         }
         else
         {
             this.EmitCastIfNeeded(this._fromType, this._target, gen);
         }
     }
 }
示例#2
0
 public override void Emit(IEasyMember member, ILGenerator gen)
 {
     if (this._reference != null)
     {
         ArgumentsUtil.EmitLoadOwnerAndReference(this._reference, gen);
     }
     else if (this._expression != null)
     {
         this._expression.Emit(member, gen);
     }
     else if (member.ReturnType != typeof(void))
     {
         OpCodeUtil.EmitLoadOpCodeForDefaultValueOfType(gen, member.ReturnType);
     }
     gen.Emit(OpCodes.Ret);
 }
示例#3
0
 public override void StoreReference(ILGenerator gen)
 {
     OpCodeUtil.EmitStoreIndirectOpCodeForType(gen, base.Type);
 }
示例#4
0
 public override void LoadReference(ILGenerator gen)
 {
     OpCodeUtil.EmitLoadOpCodeForConstantValue(gen, this._value);
 }