address code review for property type checks
This commit is contained in:
parent
736cbd3ef3
commit
5e6f576e31
|
@ -356,8 +356,23 @@ inline bool Value<T>::is_valid_for_property(ContextType context, const ValueType
|
|||
return true;
|
||||
}
|
||||
|
||||
if (realm::is_array(prop.type)) {
|
||||
if (prop.type == PropertyType::Object) {
|
||||
auto object = to_object(context, value);
|
||||
return Object<T>::template is_instance<ResultsClass<T>>(context, object)
|
||||
|| Object<T>::template is_instance<ListClass<T>>(context, object);
|
||||
} else if (prop.type == PropertyType::LinkingObjects) {
|
||||
return false;
|
||||
}
|
||||
else if (prop.type == PropertyType::Array) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
using PropertyType = realm::PropertyType;
|
||||
switch (prop.type) {
|
||||
switch (prop.type & ~PropertyType::Flags) {
|
||||
case PropertyType::Int:
|
||||
case PropertyType::Float:
|
||||
case PropertyType::Double:
|
||||
|
@ -372,22 +387,7 @@ inline bool Value<T>::is_valid_for_property(ContextType context, const ValueType
|
|||
return is_date(context, value);
|
||||
case PropertyType::Object:
|
||||
return true;
|
||||
case PropertyType::Array:
|
||||
// FIXME: Do we need to validate the types of the contained objects?
|
||||
if (is_array(context, value)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (is_object(context, value)) {
|
||||
auto object = to_object(context, value);
|
||||
return Object<T>::template is_instance<ResultsClass<T>>(context, object)
|
||||
|| Object<T>::template is_instance<ListClass<T>>(context, object);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
case PropertyType::Any:
|
||||
case PropertyType::LinkingObjects:
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 238c3ea3c63bbfac58360681e73886f3b5dd1d2b
|
||||
Subproject commit 7574b3a9bcaa6259b25853e31cd4fd8dccf93b50
|
Loading…
Reference in New Issue