Преглед на файлове

Add better debugging message for FLEXProperty and FLEXIvar

matrush преди 6 години
родител
ревизия
e72c6aa349
променени са 2 файла, в които са добавени 5 реда и са изтрити 3 реда
  1. 2 1
      Classes/Utility/Runtime/Objc/Reflection/FLEXIvar.m
  2. 3 2
      Classes/Utility/Runtime/Objc/Reflection/FLEXProperty.m

+ 2 - 1
Classes/Utility/Runtime/Objc/Reflection/FLEXIvar.m

@@ -37,7 +37,8 @@
 }
 
 + (instancetype)named:(NSString *)name onClass:(Class)cls {
-    Ivar ivar = class_getInstanceVariable(cls, name.UTF8String);
+    Ivar _Nullable ivar = class_getInstanceVariable(cls, name.UTF8String);
+    NSAssert(ivar, @"Cannot find ivar with name %@ on class %@", name, cls);
     return [self ivar:ivar];
 }
 

+ 3 - 2
Classes/Utility/Runtime/Objc/Reflection/FLEXProperty.m

@@ -45,8 +45,9 @@
 }
 
 + (instancetype)named:(NSString *)name onClass:(Class)cls {
-    NSParameterAssert(class_getProperty(cls, name.UTF8String));
-    return [self property:class_getProperty(cls, name.UTF8String) onClass:cls];
+    objc_property_t _Nullable property = class_getProperty(cls, name.UTF8String);
+    NSAssert(property, @"Cannot find property with name %@ on class %@", name, cls);
+    return [self property:property onClass:cls];
 }
 
 + (instancetype)propertyWithName:(NSString *)name attributes:(FLEXPropertyAttributes *)attributes {