コード例 #1
0
 private static void EmitCompareNull(TracingILGenerator il, LocalBuilder value, Label targetIfNotNull)
 {
     if (value.LocalType == typeof(MessagePackObject))
     {
         il.EmitAnyLdloca(value);
         il.EmitGetProperty(_MessagePackObject.IsNil);
         il.EmitBrfalse_S(targetIfNotNull);
     }
     else if (value.LocalType.GetIsValueType())
     {
         Contract.Assert(Nullable.GetUnderlyingType(value.LocalType) != null, value.LocalType.FullName);
         il.EmitAnyLdloca(value);
         il.EmitGetProperty(value.LocalType.GetProperty("HasValue"));
         il.EmitBrtrue_S(targetIfNotNull);
     }
     else
     {
         il.EmitAnyLdloc(value);
         il.EmitLdnull();
         il.EmitBne_Un_S(targetIfNotNull);
     }
 }