Improve usage of js::PropertyAttributes
This commit is contained in:
parent
f66dcf943f
commit
651449108e
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue