本文整理汇总了C#中TypeSymbol.IsVerifierReference方法的典型用法代码示例。如果您正苦于以下问题:C# TypeSymbol.IsVerifierReference方法的具体用法?C# TypeSymbol.IsVerifierReference怎么用?C# TypeSymbol.IsVerifierReference使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TypeSymbol
的用法示例。
在下文中一共展示了TypeSymbol.IsVerifierReference方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EmitStaticCast
private void EmitStaticCast(TypeSymbol to, SyntaxNode syntax)
{
Debug.Assert(to.IsVerifierReference());
// From ILGENREC::GenQMark
// See VSWhidbey Bugs #49619 and 108643. If the destination type is an interface we need
// to force a static cast to be generated for any cast result expressions. The static cast
// should be done before the unifying jump so the code is verifiable and to allow the JIT to
// optimize it away. NOTE: Since there is no staticcast instruction, we implement static cast
// with a stloc / ldloc to a temporary.
// Bug: VSWhidbey/49619
// Bug: VSWhidbey/108643
// Bug: Devdiv/42645
var temp = AllocateTemp(to, syntax);
_builder.EmitLocalStore(temp);
_builder.EmitLocalLoad(temp);
FreeTemp(temp);
}
示例2: EmitIndirectStore
private void EmitIndirectStore(TypeSymbol type, SyntaxNode syntaxNode)
{
if (type.IsEnumType())
{
//underlying primitives do not need type tokens.
type = ((NamedTypeSymbol)type).EnumUnderlyingType;
}
switch (type.PrimitiveTypeCode)
{
case Microsoft.Cci.PrimitiveTypeCode.Boolean:
case Microsoft.Cci.PrimitiveTypeCode.Int8:
case Microsoft.Cci.PrimitiveTypeCode.UInt8:
_builder.EmitOpCode(ILOpCode.Stind_i1);
break;
case Microsoft.Cci.PrimitiveTypeCode.Char:
case Microsoft.Cci.PrimitiveTypeCode.Int16:
case Microsoft.Cci.PrimitiveTypeCode.UInt16:
_builder.EmitOpCode(ILOpCode.Stind_i2);
break;
case Microsoft.Cci.PrimitiveTypeCode.Int32:
case Microsoft.Cci.PrimitiveTypeCode.UInt32:
_builder.EmitOpCode(ILOpCode.Stind_i4);
break;
case Microsoft.Cci.PrimitiveTypeCode.Int64:
case Microsoft.Cci.PrimitiveTypeCode.UInt64:
_builder.EmitOpCode(ILOpCode.Stind_i8);
break;
case Microsoft.Cci.PrimitiveTypeCode.IntPtr:
case Microsoft.Cci.PrimitiveTypeCode.UIntPtr:
case Microsoft.Cci.PrimitiveTypeCode.Pointer:
_builder.EmitOpCode(ILOpCode.Stind_i);
break;
case Microsoft.Cci.PrimitiveTypeCode.Float32:
_builder.EmitOpCode(ILOpCode.Stind_r4);
break;
case Microsoft.Cci.PrimitiveTypeCode.Float64:
_builder.EmitOpCode(ILOpCode.Stind_r8);
break;
default:
if (type.IsVerifierReference())
{
_builder.EmitOpCode(ILOpCode.Stind_ref);
}
else
{
_builder.EmitOpCode(ILOpCode.Stobj);
EmitSymbolToken(type, syntaxNode);
}
break;
}
}