소스 검색

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 {