本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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));
}
示例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);
}