From c817ac7eacefc30ca0ba91c9f4977c3f83aeb0b9 Mon Sep 17 00:00:00 2001 From: Ari Lazier Date: Thu, 14 Apr 2016 11:19:01 -0700 Subject: [PATCH] create -> create_instance --- src/js_list.hpp | 14 +++++++------- src/js_object.hpp | 4 ++-- src/js_object_accessor.hpp | 4 ++-- src/js_realm.hpp | 4 ++-- src/js_results.hpp | 24 ++++++++++++------------ src/js_types.hpp | 4 ++-- src/jsc/jsc_class.hpp | 4 ++-- src/jsc/jsc_types.hpp | 4 ++-- src/node/node_class.hpp | 2 +- src/node/node_types.hpp | 4 ++-- 10 files changed, 34 insertions(+), 34 deletions(-) diff --git a/src/js_list.hpp b/src/js_list.hpp index ed5f17d7..167521c5 100644 --- a/src/js_list.hpp +++ b/src/js_list.hpp @@ -41,7 +41,7 @@ struct List { using Value = Value; using ReturnValue = ReturnValue; - static TObject create(TContext, realm::List &); + static TObject create_instance(TContext, realm::List &); static void GetLength(TContext, TObject, ReturnValue &); static void GetIndex(TContext, TObject, uint32_t, ReturnValue &); @@ -82,7 +82,7 @@ struct ObjectClass : BaseObjectClass { }; template -typename T::Object List::create(TContext ctx, realm::List &list) { +typename T::Object List::create_instance(TContext ctx, realm::List &list) { return create_object(ctx, new realm::List(list)); } @@ -97,7 +97,7 @@ void List::GetIndex(TContext ctx, TObject object, uint32_t index, ReturnValue auto list = get_internal(object); auto realm_object = realm::Object(list->get_realm(), list->get_object_schema(), list->get(index)); - return_value.set(RealmObject::create(ctx, realm_object)); + return_value.set(RealmObject::create_instance(ctx, realm_object)); } template @@ -133,7 +133,7 @@ void List::Pop(TContext ctx, TObject this_object, size_t argc, const TValue a size_t index = size - 1; auto realm_object = realm::Object(list->get_realm(), list->get_object_schema(), list->get(index)); - return_value.set(RealmObject::create(ctx, realm_object)); + return_value.set(RealmObject::create_instance(ctx, realm_object)); list->remove(index); } } @@ -162,7 +162,7 @@ void List::Shift(TContext ctx, TObject this_object, size_t argc, const TValue else { auto realm_object = realm::Object(list->get_realm(), list->get_object_schema(), list->get(0)); - return_value.set(RealmObject::create(ctx, realm_object)); + return_value.set(RealmObject::create_instance(ctx, realm_object)); list->remove(0); } } @@ -193,7 +193,7 @@ void List::Splice(TContext ctx, TObject this_object, size_t argc, const TValu for (size_t i = 0; i < remove; i++) { auto realm_object = realm::Object(list->get_realm(), list->get_object_schema(), list->get(index)); - removed_objects.push_back(RealmObject::create(ctx, realm_object)); + removed_objects.push_back(RealmObject::create_instance(ctx, realm_object)); list->remove(index); } for (size_t i = 2; i < argc; i++) { @@ -208,7 +208,7 @@ void List::StaticResults(TContext ctx, TObject this_object, size_t argc, cons validate_argument_count(argc, 0); auto list = get_internal(this_object); - return_value.set(Results::create(ctx, *list, false)); + return_value.set(Results::create_instance(ctx, *list, false)); } template diff --git a/src/js_object.hpp b/src/js_object.hpp index 7e1316e6..1e3eced5 100644 --- a/src/js_object.hpp +++ b/src/js_object.hpp @@ -40,7 +40,7 @@ struct RealmObject { using Function = Function; using ReturnValue = ReturnValue; - static TObject create(TContext, realm::Object &); + static TObject create_instance(TContext, realm::Object &); static void GetProperty(TContext, TObject, const String &, ReturnValue &); static bool SetProperty(TContext, TObject, const String &, TValue); @@ -61,7 +61,7 @@ struct ObjectClass : BaseObjectClass { }; template -typename T::Object RealmObject::create(TContext ctx, realm::Object &realm_object) { +typename T::Object RealmObject::create_instance(TContext ctx, realm::Object &realm_object) { static String s_prototype = "prototype"; auto delegate = get_delegate(realm_object.realm().get()); diff --git a/src/js_object_accessor.hpp b/src/js_object_accessor.hpp index 6a28f42e..1c950526 100644 --- a/src/js_object_accessor.hpp +++ b/src/js_object_accessor.hpp @@ -122,7 +122,7 @@ struct NativeAccessor { throw std::runtime_error("object is not a Realm Object"); } static TValue from_object(TContext ctx, realm::Object realm_object) { - return RealmObject::create(ctx, realm_object); + return RealmObject::create_instance(ctx, realm_object); } static size_t list_size(TContext ctx, TValue &value) { @@ -132,7 +132,7 @@ struct NativeAccessor { return Object::validated_get_object(ctx, Value::validated_to_object(ctx, value), (uint32_t)index); } static TValue from_list(TContext ctx, realm::List list) { - return List::create(ctx, list); + return List::create_instance(ctx, list); } static Mixed to_mixed(TContext ctx, TValue &val) { diff --git a/src/js_realm.hpp b/src/js_realm.hpp index e4784ea3..12e9b154 100644 --- a/src/js_realm.hpp +++ b/src/js_realm.hpp @@ -347,7 +347,7 @@ void Realm::Objects(TContext ctx, TObject this_object, size_t argc, const TVa SharedRealm realm = *get_internal(this_object); std::string type = validated_object_type_for_value(realm, ctx, arguments[0]); - return_value.set(Results::create(ctx, realm, type)); + return_value.set(Results::create_instance(ctx, realm, type)); } template @@ -374,7 +374,7 @@ void Realm::Create(TContext ctx, TObject this_object, size_t argc, const TVal } auto realm_object = realm::Object::create(ctx, sharedRealm, *object_schema, object, update); - return_value.set(RealmObject::create(ctx, realm_object)); + return_value.set(RealmObject::create_instance(ctx, realm_object)); } template diff --git a/src/js_results.hpp b/src/js_results.hpp index b8e7822f..ac2b4c15 100644 --- a/src/js_results.hpp +++ b/src/js_results.hpp @@ -38,10 +38,10 @@ struct Results { using Value = Value; using ReturnValue = ReturnValue; - static TObject create(TContext, const realm::Results &, bool live = true); - static TObject create(TContext, const realm::List &, bool live = true); - static TObject create(TContext, SharedRealm, const std::string &type, bool live = true); - static TObject create(TContext, SharedRealm, const ObjectSchema &, Query, bool live = true); + static TObject create_instance(TContext, const realm::Results &, bool live = true); + static TObject create_instance(TContext, const realm::List &, bool live = true); + static TObject create_instance(TContext, SharedRealm, const std::string &type, bool live = true); + static TObject create_instance(TContext, SharedRealm, const ObjectSchema &, Query, bool live = true); template static TObject create_filtered(TContext, const U &, size_t, const TValue[]); @@ -77,7 +77,7 @@ struct ObjectClass : BaseObjectClass { }; template -typename T::Object Results::create(TContext ctx, const realm::Results &results, bool live) { +typename T::Object Results::create_instance(TContext ctx, const realm::Results &results, bool live) { auto new_results = new realm::Results(results); new_results->set_live(live); @@ -85,12 +85,12 @@ typename T::Object Results::create(TContext ctx, const realm::Results &result } template -typename T::Object Results::create(TContext ctx, const realm::List &list, bool live) { - return create(ctx, list.get_realm(), list.get_object_schema(), list.get_query(), live); +typename T::Object Results::create_instance(TContext ctx, const realm::List &list, bool live) { + return create_instance(ctx, list.get_realm(), list.get_object_schema(), list.get_query(), live); } template -typename T::Object Results::create(TContext ctx, SharedRealm realm, const std::string &type, bool live) { +typename T::Object Results::create_instance(TContext ctx, SharedRealm realm, const std::string &type, bool live) { auto table = ObjectStore::table_for_object_type(realm->read_group(), type); auto &schema = realm->config().schema; auto object_schema = schema->find(type); @@ -106,7 +106,7 @@ typename T::Object Results::create(TContext ctx, SharedRealm realm, const std } template -typename T::Object Results::create(TContext ctx, SharedRealm realm, const ObjectSchema &object_schema, Query query, bool live) { +typename T::Object Results::create_instance(TContext ctx, SharedRealm realm, const ObjectSchema &object_schema, Query query, bool live) { auto results = new realm::Results(realm, object_schema, std::move(query)); results->set_live(live); @@ -132,7 +132,7 @@ typename T::Object Results::create_filtered(TContext ctx, const U &collection query_builder::ArgumentConverter converter(ctx, args); query_builder::apply_predicate(query, predicate, converter, *realm->config().schema, object_schema.name); - return create(ctx, realm, object_schema, std::move(query)); + return create_instance(ctx, realm, object_schema, std::move(query)); } template @@ -211,7 +211,7 @@ void Results::GetIndex(TContext ctx, TObject object, uint32_t index, ReturnVa } auto realm_object = realm::Object(results->get_realm(), results->get_object_schema(), results->get(index)); - return_value.set(RealmObject::create(ctx, realm_object)); + return_value.set(RealmObject::create_instance(ctx, realm_object)); } template @@ -219,7 +219,7 @@ void Results::StaticResults(TContext ctx, TObject this_object, size_t argc, c validate_argument_count(argc, 0); auto results = get_internal(this_object); - return_value.set(Results::create(ctx, *results, false)); + return_value.set(Results::create_instance(ctx, *results, false)); } template diff --git a/src/js_types.hpp b/src/js_types.hpp index cb591612..e53da2ca 100644 --- a/src/js_types.hpp +++ b/src/js_types.hpp @@ -220,7 +220,7 @@ struct Object { static TObject create_date(TContext, double); template - static TObject create(TContext, U*); + static TObject create_instance(TContext, U*); template static bool is_instance(TContext, const TObject &); @@ -282,7 +282,7 @@ struct ReturnValue { template REALM_JS_INLINE typename T::Object create_object(typename T::Context ctx, U* internal = nullptr) { - return Object::template create(ctx, internal); + return Object::template create_instance(ctx, internal); } template diff --git a/src/jsc/jsc_class.hpp b/src/jsc/jsc_class.hpp index 7d6982c3..811a0473 100644 --- a/src/jsc/jsc_class.hpp +++ b/src/jsc/jsc_class.hpp @@ -51,7 +51,7 @@ class ObjectWrap { return nullptr; } - JSObjectRef this_object = ObjectWrap::create(ctx); + JSObjectRef this_object = ObjectWrap::create_instance(ctx); try { s_class.constructor(ctx, this_object, argc, arguments); } @@ -265,7 +265,7 @@ class ObjectWrap { return js_class; } - static JSObjectRef create(JSContextRef ctx, T* internal = nullptr) { + static JSObjectRef create_instance(JSContextRef ctx, T* internal = nullptr) { return JSObjectMake(ctx, get_class(), new ObjectWrap(internal)); } diff --git a/src/jsc/jsc_types.hpp b/src/jsc/jsc_types.hpp index 470aed2b..04dd1867 100644 --- a/src/jsc/jsc_types.hpp +++ b/src/jsc/jsc_types.hpp @@ -482,8 +482,8 @@ inline JSObjectRef jsc::Object::create_date(JSContextRef ctx, double time) { template<> template -inline JSObjectRef jsc::Object::create(JSContextRef ctx, U* internal) { - return jsc::ObjectWrap::create(ctx, internal); +inline JSObjectRef jsc::Object::create_instance(JSContextRef ctx, U* internal) { + return jsc::ObjectWrap::create_instance(ctx, internal); } template<> diff --git a/src/node/node_class.hpp b/src/node/node_class.hpp index 6f3aeff4..ef672022 100644 --- a/src/node/node_class.hpp +++ b/src/node/node_class.hpp @@ -88,7 +88,7 @@ class ObjectWrap : public Nan::ObjectWrap { return *this; } - static v8::Local create(v8::Isolate* isolate, T* internal = nullptr) { + static v8::Local create_instance(v8::Isolate* isolate, T* internal = nullptr) { Nan::EscapableHandleScope scope; // TODO: Figure out why this template ends up being empty here. diff --git a/src/node/node_types.hpp b/src/node/node_types.hpp index b00b4d87..95643197 100644 --- a/src/node/node_types.hpp +++ b/src/node/node_types.hpp @@ -441,8 +441,8 @@ inline v8::Local node::Object::create_date(v8::Isolate* isolate, dou template<> template -inline v8::Local node::Object::create(v8::Isolate* isolate, U* internal) { - return node::ObjectWrap::create(isolate, internal); +inline v8::Local node::Object::create_instance(v8::Isolate* isolate, U* internal) { + return node::ObjectWrap::create_instance(isolate, internal); } template<>