This commit is contained in:
Ari Lazier 2016-04-26 16:59:03 -07:00
parent 591dce8051
commit 27d973151f
6 changed files with 8 additions and 14 deletions

View File

@ -237,7 +237,7 @@ inline typename T::Function Realm<T>::create_constructor(ContextType ctx) {
Object::set_property(ctx, realm_constructor, "Collection", collection_constructor, attributes);
Object::set_property(ctx, realm_constructor, "List", list_constructor, attributes);
Object::set_property(ctx, realm_constructor, "Results", results_constructor, attributes);
Object::set_property(ctx, realm_constructor, "RealmObject", realm_object_constructor, attributes);
Object::set_property(ctx, realm_constructor, "Object", realm_object_constructor, attributes);
return realm_constructor;
}

View File

@ -52,6 +52,10 @@ class RealmObject {
template<typename T>
struct RealmObjectClass : ClassDefinition<T, realm::Object> {
using ContextType = typename T::Context;
using ObjectType = typename T::Object;
using ValueType = typename T::Value;
using ReturnValue = js::ReturnValue<T>;
using RealmObject = js::RealmObject<T>;
const std::string name = "RealmObject";
@ -61,12 +65,6 @@ struct RealmObjectClass : ClassDefinition<T, realm::Object> {
wrap<RealmObject::set_property>,
wrap<RealmObject::get_property_names>,
};
using ContextType = typename T::Context;
using ObjectType = typename T::Object;
using ValueType = typename T::Value;
using ReturnValue = js::ReturnValue<T>;
MethodMap<T> const methods = {
{"isValid", wrap<RealmObject::is_valid>},

View File

@ -23,8 +23,6 @@
#include "js_class.hpp"
#include "js_util.hpp"
#include "results.hpp"
namespace realm {
namespace jsc {

View File

@ -23,8 +23,6 @@
#include "js_class.hpp"
#include "js_util.hpp"
#include "results.hpp"
namespace realm {
namespace node {

View File

@ -47,7 +47,7 @@ namespace realm {
SharedRealm realm() { return m_realm; }
const ObjectSchema &get_object_schema() { return *m_object_schema; }
Row row() { return m_row; }
bool is_valid() const { return m_row.is_attached(); }
private:
@ -147,7 +147,7 @@ namespace realm {
//
template <typename ValueType, typename ContextType>
inline void Object::set_property_value(ContextType ctx, std::string prop_name, ValueType value, bool try_update)
{
{
const Property *prop = m_object_schema->property_for_name(prop_name);
if (!prop) {
throw InvalidPropertyException(m_object_schema->name, prop_name,

View File

@ -437,7 +437,7 @@ module.exports = BaseTest.extend({
var realm = new Realm({schema: [schemas.TestObject]});
realm.write(function() {
var obj = realm.create('TestObject', {doubleCol: 1});
TestCase.assertTrue(obj instanceof Realm.RealmObject);
TestCase.assertTrue(obj instanceof Realm.Object);
});
},