private static void EmitDefaultValue(CodeGen cg, object value, Type type)
 {
     if (value is Missing) {
         EmitMissingValue(cg, type);
     } else {
         cg.EmitRawConstant(value);
         if (type.IsValueType) {
             if (value == null) EmitException(cg, "Cannot cast None to {0}", type);
             else if (value.GetType() != type) EmitException(cg, "Cannot cast {0} to {1}", value, type);
         } else {
             // null is any reference type
             if (value != null) {
                 Type from = value.GetType();
                 if (!type.IsAssignableFrom(from)) {
                     EmitException(cg, "Cannot cast {0} to {1}", value, type);
                 } else {
                     if (from.IsValueType) {
                         cg.Emit(OpCodes.Box, from);
                     }
                 }
             }
         }
     }
 }
 public override void Generate(CodeGen cg, Slot contextSlot, Slot[] argSlots)
 {
     cg.EmitRawConstant(null);
 }