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);
         }
     }
 }
Beispiel #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);
 }
 public override void StoreReference(ILGenerator gen)
 {
     OpCodeUtil.EmitStoreIndirectOpCodeForType(gen, base.Type);
 }
Beispiel #4
0
 public override void LoadReference(ILGenerator gen)
 {
     OpCodeUtil.EmitLoadOpCodeForConstantValue(gen, this._value);
 }