EmitGetHelper() 개인적인 메소드

private EmitGetHelper ( Operand op, Type desiredType, Conversion conv, Type from = null ) : void
op Operand
desiredType IKVM.Reflection.Type
conv Conversion
from IKVM.Reflection.Type
리턴 void
예제 #1
0
        void EmitArg(CodeGen g, int index, Operand arg)
        {
            if (_appliedSignature[index].IsByRef)
            {
                arg.EmitAddressOf(g);
                return;
            }

            g.EmitGetHelper(arg, _appliedSignature[index], _conversions[index], @from: _paramsSignature[index]);
        }
예제 #2
0
 internal override void EmitSet(CodeGen g, Operand value, bool allowExplicitConversion)
 {
     if (IsReference)
     {
         g.EmitLdargHelper(_index);
         g.EmitStindHelper(GetReturnType(g.TypeMapper), value, allowExplicitConversion);
     }
     else
     {
         g.EmitGetHelper(value, GetReturnType(g.TypeMapper), allowExplicitConversion);
         g.EmitStargHelper(_index);
     }
 }
예제 #3
0
 internal override void EmitSet(CodeGen g, Operand value, bool allowExplicitConversion)
 {
     if (IsReference)
     {
         g.EmitLdargHelper(index);
         g.EmitStindHelper(Type, value, allowExplicitConversion);
     }
     else
     {
         g.EmitGetHelper(value, Type, allowExplicitConversion);
         g.EmitStargHelper(index);
     }
 }
예제 #4
0
 protected internal override void EmitSet(CodeGen g, Operand value, bool allowExplicitConversion)
 {
     OperandExtensions.SetLeakedState(this, false);
     if (IsReference)
     {
         g.EmitLdargHelper(_index);
         g.EmitStindHelper(GetReturnType(g.TypeMapper), value, allowExplicitConversion);
     }
     else
     {
         g.EmitGetHelper(value, GetReturnType(g.TypeMapper), allowExplicitConversion);
         g.EmitStargHelper(_index);
     }
 }
예제 #5
0
            protected internal override void EmitSet(CodeGen g, Operand value, bool allowExplicitConversion)
            {
                OperandExtensions.SetLeakedState(this, false);
                CheckScope(g);

                if (_t == null)
                {
                    _t = value.GetReturnType(g.TypeMapper);
                }

                if (_var == null)
                {
                    _var = g.IL.DeclareLocal(_t);
                }

                Type nullableUnderlyingType = Helpers.GetNullableUnderlyingType(_t);

                if (ReferenceEquals(value, null))
                {
                    if (nullableUnderlyingType != null)
                    {
                        g.InitObj(this);
                        return;
                    }
                }
                else if (nullableUnderlyingType == value.GetReturnType(g.TypeMapper))
                {
                    EmitAddressOf(g);
                    g.EmitGetHelper(value, nullableUnderlyingType, false);
                    ConstructorInfo ctor = _t.GetConstructor(new [] { nullableUnderlyingType });
                    g.IL.Emit(OpCodes.Call, ctor);
                    return;
                }
                g.EmitGetHelper(value, _t, allowExplicitConversion);

                EmitSetFromStack(g);
            }
예제 #6
0
        public override void EmitSet(CodeGen g, Operand value, bool allowExplicitConversion)
        {
            if (!IsStatic)
            {
                if (g.Context.IsStatic || g.Context.OwnerType != owner.TypeBuilder)
                {
                    throw new InvalidOperationException("The field is accessed from an invalid context");
                }

                g.IL.Emit(OpCodes.Ldarg_0);
            }

            g.EmitGetHelper(value, type, allowExplicitConversion);
            g.IL.Emit(IsStatic ? OpCodes.Stsfld : OpCodes.Stfld, fb);
        }
예제 #7
0
        internal override void EmitSet(CodeGen g, Operand value, bool allowExplicitConversion)
        {
            if (!IsStatic)
            {
                if (g.Context.IsStatic || g.Context.OwnerType != owner.TypeBuilder)
                {
                    throw new InvalidOperationException(Properties.Messages.ErrInvalidFieldContext);
                }

                g.IL.Emit(OpCodes.Ldarg_0);
            }

            g.EmitGetHelper(value, type, allowExplicitConversion);
            g.IL.Emit(IsStatic ? OpCodes.Stsfld : OpCodes.Stfld, fb);
        }
예제 #8
0
            internal override void EmitSet(CodeGen g, Operand value, bool allowExplicitConversion)
            {
                CheckScope(g);

                if (t == null)
                {
                    t = value.Type;
                }

                if (var == null)
                {
                    var = g.il.DeclareLocal(t);
                }

                g.EmitGetHelper(value, t, allowExplicitConversion);
                g.il.Emit(OpCodes.Stloc, var);
            }
예제 #9
0
            internal override void EmitSet(CodeGen g, Operand value, bool allowExplicitConversion)
            {
                CheckScope(g);

                if (_t == null)
                {
                    _t = value.GetReturnType(g.TypeMapper);
                }

                if (_var == null)
                {
                    _var = g.IL.DeclareLocal(_t);
                }

                g.EmitGetHelper(value, _t, allowExplicitConversion);
                g.IL.Emit(OpCodes.Stloc, _var);
            }
예제 #10
0
        public override void EmitSet(CodeGen g, Operand value, bool allowExplicitConversion)
        {
            if (setter == null)
            {
                base.EmitSet(g, value, allowExplicitConversion);
            }

            if (indexParameters.Count != 0)
            {
                throw new InvalidOperationException("Cannot access indexed property without indexes");
            }

            if (!IsStatic && (g.Context.IsStatic || g.Context.OwnerType != owner.TypeBuilder))
            {
                throw new InvalidOperationException("The property is accessed from an invalid context");
            }

            g.IL.Emit(OpCodes.Ldarg_0);
            g.EmitGetHelper(value, Type, allowExplicitConversion);
            g.EmitCallHelper(setter.GetMethodBuilder(), null);
        }
예제 #11
0
        internal override void EmitSet(CodeGen g, Operand value, bool allowExplicitConversion)
        {
            if (setter == null)
            {
                base.EmitSet(g, value, allowExplicitConversion);
            }

            if (indexParameters.Count != 0)
            {
                throw new InvalidOperationException(Properties.Messages.ErrMissingPropertyIndex);
            }

            if (!IsStatic && (g.Context.IsStatic || g.Context.OwnerType != owner.TypeBuilder))
            {
                throw new InvalidOperationException(Properties.Messages.ErrInvalidPropertyContext);
            }

            g.IL.Emit(OpCodes.Ldarg_0);
            g.EmitGetHelper(value, Type, allowExplicitConversion);
            g.EmitCallHelper(setter.GetMethodBuilder(), null);
        }
예제 #12
0
        protected internal override void EmitSet(CodeGen g, Operand value, bool allowExplicitConversion)
        {
            OperandExtensions.SetLeakedState(this, false);
            if (_setter == null)
            {
                base.EmitSet(g, value, allowExplicitConversion);
            }

            if (_indexParameters.Count != 0)
            {
                throw new InvalidOperationException(Properties.Messages.ErrMissingPropertyIndex);
            }

            if (!IsStatic && (g.Context.IsStatic || g.Context.OwnerType != _owner.TypeBuilder))
            {
                throw new InvalidOperationException(Properties.Messages.ErrInvalidPropertyContext);
            }

            g.IL.Emit(OpCodes.Ldarg_0);
            g.EmitGetHelper(value, GetReturnType(TypeMapper), allowExplicitConversion);
            g.EmitCallHelper(_setter.GetMethodBuilder(), null);
        }
예제 #13
0
        internal override void EmitSet(CodeGen g, Operand value, bool allowExplicitConversion)
        {
            if (setter == null)
                base.EmitSet(g, value, allowExplicitConversion);

            if (indexParameters.Count != 0)
                throw new InvalidOperationException(Properties.Messages.ErrMissingPropertyIndex);

            if (!IsStatic && (g.Context.IsStatic || g.Context.OwnerType != owner.TypeBuilder))
                throw new InvalidOperationException(Properties.Messages.ErrInvalidPropertyContext);

            g.IL.Emit(OpCodes.Ldarg_0);
            g.EmitGetHelper(value, Type, allowExplicitConversion);
            g.EmitCallHelper(setter.GetMethodBuilder(), null);
        }
예제 #14
0
		protected internal override void EmitSet(CodeGen g, Operand value, bool allowExplicitConversion)
		{
		    OperandExtensions.SetLeakedState(this, false);  
			if (!IsStatic)
			{
				if (g.Context.IsStatic || g.Context.OwnerType != _owner.TypeBuilder)
					throw new InvalidOperationException(Properties.Messages.ErrInvalidFieldContext);

				g.IL.Emit(OpCodes.Ldarg_0);
			}

			g.EmitGetHelper(value, _type, allowExplicitConversion);
			g.IL.Emit(IsStatic ? OpCodes.Stsfld : OpCodes.Stfld, _fb);
		}
예제 #15
0
	    protected void EmitGetHelper(CodeGen g, Operand op, Type desiredType, bool allowExplicitConversion)
	    {
            g.EmitGetHelper(op, desiredType,allowExplicitConversion);
	    }
예제 #16
0
 protected void EmitGetHelper(CodeGen g, Operand op, Type desiredType, bool allowExplicitConversion)
 {
     g.EmitGetHelper(op, desiredType, allowExplicitConversion);
 }
예제 #17
0
		    protected internal override void EmitSet(CodeGen g, Operand value, bool allowExplicitConversion)
		    {
		        OperandExtensions.SetLeakedState(this, false); 
				if (IsReference)
				{
					g.EmitLdargHelper(_index);
					g.EmitStindHelper(GetReturnType(g.TypeMapper), value, allowExplicitConversion);
				}
				else
				{
					g.EmitGetHelper(value, GetReturnType(g.TypeMapper), allowExplicitConversion);
					g.EmitStargHelper(_index);
				}
			}
예제 #18
0
			protected internal override void EmitSet(CodeGen g, Operand value, bool allowExplicitConversion)
			{
		        OperandExtensions.SetLeakedState(this, false); 
				CheckScope(g);

				if (_t == null)
					_t = value.GetReturnType(g.TypeMapper);

				if (_var == null)
					_var = g.IL.DeclareLocal(_t);

			    Type nullableUnderlyingType = Helpers.GetNullableUnderlyingType(_t);
			    if (ReferenceEquals(value, null))
			    {
			        if (nullableUnderlyingType != null)
			        {
			            g.InitObj(this);
			            return;
			        }
			    }
                else if (nullableUnderlyingType == value.GetReturnType(g.TypeMapper))
                {
                    EmitAddressOf(g);
                    g.EmitGetHelper(value, nullableUnderlyingType, false);
                    ConstructorInfo ctor = _t.GetConstructor(new [] { nullableUnderlyingType});
                    g.IL.Emit(OpCodes.Call, ctor);
                    return;
                }
                    g.EmitGetHelper(value, _t, allowExplicitConversion);

			    EmitSetFromStack(g);
			}
			internal override void EmitSet(CodeGen g, Operand value, bool allowExplicitConversion)
			{
				CheckScope(g);

				if (t == null)
					t = value.Type;

				if (var == null)
					var = g.il.DeclareLocal(t);

				g.EmitGetHelper(value, t, allowExplicitConversion);
				g.il.Emit(OpCodes.Stloc, var);
			}
			internal override void EmitSet(CodeGen g, Operand value, bool allowExplicitConversion)
			{
				if (IsReference)
				{
					g.EmitLdargHelper(index);
					g.EmitStindHelper(Type, value, allowExplicitConversion);
				}
				else
				{
					g.EmitGetHelper(value, Type, allowExplicitConversion);
					g.EmitStargHelper(index);
				}
			}
예제 #21
0
		protected internal override void EmitSet(CodeGen g, Operand value, bool allowExplicitConversion)
		{
		    OperandExtensions.SetLeakedState(this, false);  
			if (_setter == null)
				base.EmitSet(g, value, allowExplicitConversion);

			if (_indexParameters.Count != 0)
				throw new InvalidOperationException(Properties.Messages.ErrMissingPropertyIndex);

			if (!IsStatic && (g.Context.IsStatic || g.Context.OwnerType != _owner.TypeBuilder))
				throw new InvalidOperationException(Properties.Messages.ErrInvalidPropertyContext);

			g.IL.Emit(OpCodes.Ldarg_0);
			g.EmitGetHelper(value, GetReturnType(TypeMapper), allowExplicitConversion);
			g.EmitCallHelper(_setter.GetMethodBuilder(), null);
		}