Improve usage of js::PropertyAttributes

This commit is contained in:
Scott Kyle 2016-05-09 16:08:04 -07:00
parent f66dcf943f
commit 651449108e
3 changed files with 7 additions and 3 deletions

View File

@ -237,7 +237,7 @@ inline typename T::Function Realm<T>::create_constructor(ContextType ctx) {
FunctionType results_constructor = ObjectWrap<T, ResultsClass<T>>::create_constructor(ctx);
FunctionType realm_object_constructor = ObjectWrap<T, RealmObjectClass<T>>::create_constructor(ctx);
PropertyAttributes attributes = PropertyAttributes(ReadOnly | DontEnum | DontDelete);
PropertyAttributes attributes = ReadOnly | DontEnum | DontDelete;
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);

View File

@ -35,13 +35,17 @@
namespace realm {
namespace js {
enum PropertyAttributes {
enum PropertyAttributes : unsigned {
None = 0,
ReadOnly = 1 << 0,
DontEnum = 1 << 1,
DontDelete = 1 << 2
};
inline PropertyAttributes operator|(PropertyAttributes a, PropertyAttributes b) {
return PropertyAttributes(static_cast<unsigned>(a) | static_cast<unsigned>(b));
}
template<typename T>
struct String {
using StringType = typename T::String;

View File

@ -37,7 +37,7 @@ void RJSInitializeInContext(JSContextRef ctx) {
JSObjectRef global_object = JSContextGetGlobalObject(ctx);
JSObjectRef realm_constructor = RJSConstructorCreate(ctx);
jsc::Object::set_property(ctx, global_object, realm_string, realm_constructor, js::PropertyAttributes(js::ReadOnly | js::DontEnum | js::DontDelete));
jsc::Object::set_property(ctx, global_object, realm_string, realm_constructor, js::ReadOnly | js::DontEnum | js::DontDelete);
}
} // extern "C"