Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/ObjCRuntime/Class.cs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ unsafe static IntPtr FindClass (Type type, out bool is_custom_type)
type = type.GetGenericTypeDefinition ();

// Look for the type in the type map.
var asm_name = type.Assembly.GetName ().Name;
var asm_name = type.Assembly.GetName ().Name!;
var mod_token = type.Module.MetadataToken;
var type_token = type.MetadataToken & ~0x02000000;
for (int i = 0; i < map->map_count; i++) {
Expand Down Expand Up @@ -284,7 +284,7 @@ unsafe static IntPtr FindClass (Type type, out bool is_custom_type)
return IntPtr.Zero;
}

unsafe static bool CompareTokenReference (string? asm_name, int mod_token, int type_token, uint token_reference)
unsafe static bool CompareTokenReference (string asm_name, int mod_token, int type_token, uint token_reference)
{
var map = Runtime.options->RegistrationMap;
IntPtr assembly_name;
Expand Down Expand Up @@ -369,7 +369,7 @@ static unsafe int FindMapIndex (Runtime.MTClassMap *array, int lo, int hi, IntPt
type = ResolveTypeTokenReference (type_reference);

#if LOG_TYPELOAD
Console.WriteLine ($"FindType (0x{@class:X} = {Marshal.PtrToStringAuto (class_getName (@class))}) => {type.FullName}; is custom: {is_custom_type} (token reference: 0x{type_reference:X}).");
Console.WriteLine ($"FindType (0x{@class:X} = {Marshal.PtrToStringAuto (class_getName (@class))}) => {type?.FullName}; is custom: {is_custom_type} (token reference: 0x{type_reference:X}).");
#endif

class_to_type [mapIndex] = type;
Expand Down Expand Up @@ -451,7 +451,7 @@ static unsafe int FindMapIndex (Runtime.MTClassMap *array, int lo, int hi, IntPt
case 0x06000000: // Method
var method = module.ResolveMethod ((int) token);
#if LOG_TYPELOAD
Console.WriteLine ($"ResolveToken (0x{token:X}) => Method: {method.DeclaringType.FullName}.{method.Name}");
Console.WriteLine ($"ResolveToken (0x{token:X}) => Method: {method?.DeclaringType?.FullName}.{method.Name}");
#endif
return method;
default:
Expand Down Expand Up @@ -495,7 +495,7 @@ internal unsafe static uint GetTokenReference (Type type, bool throw_exception =
if (type.IsGenericType)
type = type.GetGenericTypeDefinition ();

var asm_name = type.Module.Assembly.GetName ().Name;
var asm_name = type.Module.Assembly.GetName ().Name!;

// First check if there's a full token reference to this type
var token = GetFullTokenReference (asm_name, type.Module.MetadataToken, type.MetadataToken);
Expand Down Expand Up @@ -538,7 +538,7 @@ internal unsafe static uint GetTokenReference (Type type, bool throw_exception =
}

// Look for the specified metadata token in the table of full token references.
static unsafe uint GetFullTokenReference (string? assembly_name, int module_token, int metadata_token)
static unsafe uint GetFullTokenReference (string assembly_name, int module_token, int metadata_token)
{
var map = Runtime.options->RegistrationMap;
for (int i = 0; i < map->full_token_reference_count; i++) {
Expand Down