[registrar] BindAs uses Nullable types so allow them to be registered as NSObjects

BindAsAttribute allows to bind NSValue and NSNumber into more
accurate C# types lyke bool?, int? etc. so we must teach registrar
about this.
This commit is contained in:
Alex Soto 2017-06-14 14:42:07 -05:00
Родитель 9accdb3888
Коммит 911eab97b7
1 изменённых файлов: 7 добавлений и 1 удалений

Просмотреть файл

@ -2130,7 +2130,9 @@ namespace XamCore.Registrar {
{
bool isNativeEnum;
switch (GetTypeFullName (type)) {
var typeFullName = GetTypeFullName (type);
switch (typeFullName) {
case "System.IntPtr": return "^v";
case "System.SByte": return "c";
case "System.Byte": return "C";
@ -2163,6 +2165,10 @@ namespace XamCore.Registrar {
throw CreateException (4102, member, "The registrar found an invalid type `{0}` in signature for method `{2}`. Use `{1}` instead.", "System.DateTime", IsDualBuild ? "Foundation.NSDate" : CompatNamespace + ".Foundation.NSDate", member.FullName);
}
// We use BindAsAttribute to wrap NSNumber/NSValue into more accurate Nullable<T> types
if (typeFullName != null && typeFullName.Contains ("Nullable"))
return "@";
if (Is (type, ObjCRuntime, "Selector"))
return ":";