当前位置: 首页>>代码示例>>C#>>正文


C# Operand.GetReturnType方法代码示例

本文整理汇总了C#中TriAxis.RunSharp.Operand.GetReturnType方法的典型用法代码示例。如果您正苦于以下问题:C# Operand.GetReturnType方法的具体用法?C# Operand.GetReturnType怎么用?C# Operand.GetReturnType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TriAxis.RunSharp.Operand的用法示例。


在下文中一共展示了Operand.GetReturnType方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetType

        protected internal static Type GetType(Operand op, ITypeMapper typeMapper)
		{
			if ((object)op == null)
				return null;

			return op.GetReturnType(typeMapper);
		}
开发者ID:AqlaSolutions,项目名称:runsharp,代码行数:7,代码来源:Operand.cs

示例2: EmitSet

			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);
			}
开发者ID:AqlaSolutions,项目名称:runsharp,代码行数:32,代码来源:CodeGen.cs

示例3: EmitGetHelper_Conversion

        void EmitGetHelper_Conversion(Operand op, Type desiredType, Conversion conv, Type from = null)
        {
            if (conv.RequiresAddress)
            {
                if (ReferenceEquals(op, null))
                    throw new ArgumentException("Conversion from nullref to " + desiredType.Name + " is impossible; for nullables variable it's required to load address.");

                op.EmitAddressOf(this);
            }
            else if (ReferenceEquals(op, null))
                IL.Emit(OpCodes.Ldnull);
            else
                op.EmitGet(this);
            if (from == null)
                from = (object)op == null ? null : op.GetReturnType(TypeMapper);
            conv.Emit(this, from, desiredType);
        }
开发者ID:AqlaSolutions,项目名称:runsharp,代码行数:17,代码来源:CodeGen.Helpers.cs

示例4: EmitCallHelper

        protected internal void EmitCallHelper(MethodBase mth, Operand target)
        {
            MethodInfo mi = mth as MethodInfo;
            if (mi != null)
            {
                bool suppressVirtual = ((object)target != null && target.SuppressVirtual) || mi.IsStatic || (((object)target != null) 
                    && (target.GetReturnType(TypeMapper).IsValueType|| target.GetReturnType(TypeMapper).IsArray) && !mi.IsVirtual);
                
                if (!suppressVirtual && (object)target != null && target.GetReturnType(TypeMapper).IsValueType && mi.IsVirtual)
                {
                    IL.Emit(OpCodes.Constrained, target.GetReturnType(TypeMapper));
                }
                //Console.WriteLine("Emitting " + mth + ", using " + (suppressVirtual ? "call" : "callvirt"));
                IL.Emit(suppressVirtual ? OpCodes.Call : OpCodes.Callvirt, mi);
                return;
            }

            ConstructorInfo ci = mth as ConstructorInfo;
            if (ci != null)
            {
                IL.Emit(OpCodes.Call, ci);
                return;
            }

            throw new ArgumentException(Properties.Messages.ErrInvalidMethodBase, nameof(mth));
        }
开发者ID:AqlaSolutions,项目名称:runsharp,代码行数:26,代码来源:CodeGen.Helpers.cs

示例5: EmitGetHelper_Ref

        void EmitGetHelper_Ref(Operand op, Type desiredType)
        {
            if (ReferenceEquals(op, null))
                throw new ArgumentException("Ref argument can't be null, expected " + desiredType.Name);
            if (op.GetReturnType(TypeMapper) != desiredType.GetElementType())
                throw new InvalidOperationException(Properties.Messages.ErrByRefTypeMismatch);

            op.EmitAddressOf(this);
        }
开发者ID:AqlaSolutions,项目名称:runsharp,代码行数:9,代码来源:CodeGen.Helpers.cs


注:本文中的TriAxis.RunSharp.Operand.GetReturnType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。