@@ -3349,7 +3349,7 @@ char PropPrefix (PropertyType propType)
3349
3349
void ImplementProxyConstructorAndFields ( CSClass cl , CSUsingPackages use , bool hasVtable , CSInterface iface , bool hasAssociatedTypes )
3350
3350
{
3351
3351
if ( hasVtable || hasAssociatedTypes )
3352
- cl . Fields . Add ( CSFieldDeclaration . FieldLine ( iface . ToCSType ( ) , kInterfaceImpl ) ) ;
3352
+ cl . Fields . Add ( CSFieldDeclaration . FieldLine ( iface . ToCSType ( ) , kInterfaceImpl , new CSIdentifier ( "null!" ) ) ) ;
3353
3353
if ( ! hasAssociatedTypes ) {
3354
3354
cl . Fields . Add ( CSFieldDeclaration . FieldLine ( new CSSimpleType ( typeof ( SwiftExistentialContainer1 ) ) , kContainer ) ) ;
3355
3355
var prop = CSProperty . PublicGetBacking ( new CSSimpleType ( typeof ( ISwiftExistentialContainer ) ) , new CSIdentifier ( "ProxyExistentialContainer" ) , kContainer , false , CSMethodKind . Override ) ;
@@ -3862,9 +3862,9 @@ CSMethod MakePublicFactory (TypeDeclaration classDecl, string className, CSUsing
3862
3862
// public static object XamarinFactory(IntPtr p, Type[] genericTypes)
3863
3863
// {
3864
3864
// Type t = typeof(className<,,,>).MakeGenericType(genericTypes);
3865
- // ConstructorInfo ci = t.GetConstructor(BindingFlags.Instance | BindingFlags.NonPublic,
3865
+ // ConstructorInfo? ci = t.GetConstructor(BindingFlags.Instance | BindingFlags.NonPublic,
3866
3866
// null, new Type[] { typeof(IntPtr), typeof(SwiftObjectRegistry), null);
3867
- // return ci.Invoke(new object[] { p, SwiftObjectRegistry.Registry }, null);
3867
+ // return ci! .Invoke(new object[] { p, SwiftObjectRegistry.Registry }, null);
3868
3868
// }
3869
3869
3870
3870
var extraFactoryParam = classDecl . IsObjCOrInheritsObjC ( TypeMapper ) ? null :
@@ -3885,15 +3885,15 @@ CSMethod MakePublicFactory (TypeDeclaration classDecl, string className, CSUsing
3885
3885
new CSFunctionCall ( String . Format ( "typeof({0}).MakeGenericType" , sb . ToString ( ) ) ,
3886
3886
false , parms [ 1 ] . Name ) ) ;
3887
3887
use . AddIfNotPresent ( typeof ( ConstructorInfo ) ) ;
3888
- var ciLine = CSVariableDeclaration . VarLine ( new CSSimpleType ( typeof ( ConstructorInfo ) ) , "ci" ,
3888
+ var ciLine = CSVariableDeclaration . VarLine ( new CSSimpleType ( typeof ( ConstructorInfo ) ) . Nullable , "ci" ,
3889
3889
new CSFunctionCall ( "t.GetConstructor" , false ,
3890
3890
new CSIdentifier ( "BindingFlags.Instance" ) | new CSIdentifier ( "BindingFlags.NonPublic" ) ,
3891
3891
CSConstant . Null ,
3892
3892
new CSArray1DInitialized ( new CSSimpleType ( typeof ( Type ) ) ,
3893
3893
new CSSimpleType ( typeof ( IntPtr ) ) . Typeof ( ) ,
3894
3894
new CSSimpleType ( typeof ( SwiftObjectRegistry ) ) . Typeof ( ) ) ,
3895
3895
CSConstant . Null ) ) ;
3896
- var retLine = CSReturn . ReturnLine ( new CSFunctionCall ( "ci.Invoke" , false ,
3896
+ var retLine = CSReturn . ReturnLine ( new CSFunctionCall ( "ci! .Invoke" , false ,
3897
3897
new CSArray1DInitialized ( CSSimpleType . Object , parms [ 0 ] . Name , extraFactoryParam ) ) ) ;
3898
3898
var meth = new CSMethod ( CSVisibility . Public , CSMethodKind . Static , CSSimpleType . Object ,
3899
3899
new CSIdentifier ( SwiftObjectRegistry . kXamarinFactoryMethodName ) , new CSParameterList ( parms ) , new CSCodeBlock ( )
@@ -4170,7 +4170,7 @@ public static CSBaseExpression SafeMarshalClassFromIntPtr (CSBaseExpression expr
4170
4170
throw ErrorHelper . CreateError ( ReflectorError . kCompilerReferenceBase + 66 , $ "Unable to find entity for type { fullClassName } while marshaling from swift.") ;
4171
4171
}
4172
4172
if ( isObjCProtocol ) {
4173
- return new CSFunctionCall ( $ "ObjCRuntime.Runtime.GetINativeObject<{ expectedType . ToString ( ) } >", false , expr , CSConstant . Val ( false ) ) ;
4173
+ return CSUnaryExpression . PostBang ( new CSFunctionCall ( $ "ObjCRuntime.Runtime.GetINativeObject<{ expectedType . ToString ( ) } >", false , expr , CSConstant . Val ( false ) ) ) ;
4174
4174
} else {
4175
4175
var call = entity . Type . IsObjCOrInheritsObjC ( typeMapper ) ? "ObjCRuntime.Runtime.GetNSObject<{0}>" : "SwiftObjectRegistry.Registry.CSObjectForSwiftObject <{0}>" ;
4176
4176
return CSUnaryExpression . PostBang ( new CSFunctionCall ( String . Format ( call , expectedType . ToString ( ) ) , false , expr ) ) ;
0 commit comments