From ea0d92c20597bb75bdb2fec8377b4be00a40b134 Mon Sep 17 00:00:00 2001 From: blagoev Date: Thu, 17 Aug 2017 12:37:29 +0300 Subject: [PATCH] fix property type checking --- src/js_types.hpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/js_types.hpp b/src/js_types.hpp index 2983768f..fa659cb5 100644 --- a/src/js_types.hpp +++ b/src/js_types.hpp @@ -396,6 +396,15 @@ inline bool Value::is_valid_for_property(ContextType context, const ValueType inline std::string js_type_name_for_property_type(PropertyType type) { + if (realm::is_array(type)) { + if (type == PropertyType::LinkingObjects) { + throw std::runtime_error("LinkingObjects' type is not supported"); + } + else if (type == PropertyType::Array) { + return "array"; + } + } + switch (type) { case PropertyType::Int: case PropertyType::Float: @@ -411,13 +420,8 @@ inline std::string js_type_name_for_property_type(PropertyType type) return "binary"; case PropertyType::Object: return "object"; - case PropertyType::Array: - return "array"; - case PropertyType::Any: throw std::runtime_error("'Any' type is not supported"); - case PropertyType::LinkingObjects: - throw std::runtime_error("LinkingObjects' type is not supported"); } REALM_UNREACHABLE();