See this code in LuaExportMetaData.m:
- (void)setProperty:(const char*)propertyName toValue:(id)value onInstance:(id)instance {
NSString *name = [NSString stringWithUTF8String:propertyName];
LuaExportPropertyMetaData *metaData = exportedProperties[name];
if( ! metaData || ! metaData->setter || metaData->readonly )
return;
#if DEBUG
if( value && metaData->type == _C_ID ) {
Class valueClass = [value class];
if( valueClass != metaData->objCType && ! [valueClass isSubclassOfClass:metaData->objCType] )
[NSException raise:NSInvalidArgumentException format:@"object of type %@ can not be safely assigned to object of type %@", NSStringFromClass(valueClass), NSStringFromClass(metaData->objCType)];
}
#endif
setArgumentAt(metaData->setter, 0, metaData->propertySize, value, 2);
[metaData->setter invokeWithTarget:instance];
}
The issue mentioned in #8 runs into the #if DEBUG section, where it then raises an exception - which is good because it's a user error that needs to be flagged as such.
However, if DEBUG is not set, then there'll be no exception raised, and the assignment goes through undetected, which is probably not good (and it'll trigger an assertion error "setting string to number succeeded" during unit testing).
See this code in
LuaExportMetaData.m:The issue mentioned in #8 runs into the
#if DEBUGsection, where it then raises an exception - which is good because it's a user error that needs to be flagged as such.However, if DEBUG is not set, then there'll be no exception raised, and the assignment goes through undetected, which is probably not good (and it'll trigger an assertion error "setting string to number succeeded" during unit testing).