summaryrefslogtreecommitdiff
path: root/gi
diff options
context:
space:
mode:
authorEvan Welsh <contact@evanwelsh.com>2022-07-22 10:35:17 -0700
committerPhilip Chimento <philip.chimento@gmail.com>2022-08-07 16:42:03 -0700
commita0ed043a9f2e75af44d9ccb7db2117cbdf0b828d (patch)
treed6d8426d4c292661dfd140d056ba3376266c63e2 /gi
parent1c723714bad2de9e0853a1d1b69f0b8912206d72 (diff)
downloadgjs-a0ed043a9f2e75af44d9ccb7db2117cbdf0b828d.tar.gz
js: Adapt to new JS::PropertyKey API
See: https://bugzilla.mozilla.org/show_bug.cgi?id=1754405
Diffstat (limited to 'gi')
-rw-r--r--gi/boxed.cpp6
-rw-r--r--gi/object.cpp6
-rw-r--r--gi/object.h2
3 files changed, 7 insertions, 7 deletions
diff --git a/gi/boxed.cpp b/gi/boxed.cpp
index 549f0d8f..b3d23f4a 100644
--- a/gi/boxed.cpp
+++ b/gi/boxed.cpp
@@ -930,7 +930,7 @@ BoxedPrototype::BoxedPrototype(GIStructInfo* info, GType gtype)
: GIWrapperPrototype(info, gtype),
m_zero_args_constructor(-1),
m_default_constructor(-1),
- m_default_constructor_name(JSID_VOID),
+ m_default_constructor_name(JS::PropertyKey::Void()),
m_can_allocate_directly(struct_is_simple(info)) {
if (!m_can_allocate_directly) {
m_can_allocate_directly_without_pointers = false;
@@ -945,8 +945,8 @@ BoxedPrototype::BoxedPrototype(GIStructInfo* info, GType gtype)
bool BoxedPrototype::init(JSContext* context) {
int i, n_methods;
int first_constructor = -1;
- jsid first_constructor_name = JSID_VOID;
- jsid zero_args_constructor_name = JSID_VOID;
+ jsid first_constructor_name = JS::PropertyKey::Void();
+ jsid zero_args_constructor_name = JS::PropertyKey::Void();
if (m_gtype != G_TYPE_NONE) {
/* If the structure is registered as a boxed, we can create a new instance by
diff --git a/gi/object.cpp b/gi/object.cpp
index 7bceffa0..c69e4272 100644
--- a/gi/object.cpp
+++ b/gi/object.cpp
@@ -679,7 +679,7 @@ static bool interface_getter(JSContext* cx, unsigned argc, JS::Value* vp) {
g_assert(v_override_symbol.isSymbol() &&
"override symbol must be a symbol");
JS::RootedSymbol override_symbol(cx, v_override_symbol.toSymbol());
- JS::RootedId override_id(cx, SYMBOL_TO_JSID(override_symbol));
+ JS::RootedId override_id(cx, JS::PropertyKey::Symbol(override_symbol));
JS::RootedObject this_obj(cx);
if (!args.computeThis(cx, &this_obj))
@@ -699,7 +699,7 @@ static bool interface_getter(JSContext* cx, unsigned argc, JS::Value* vp) {
g_assert(v_prototype.isObject() && "prototype must be an object");
JS::RootedObject prototype(cx, &v_prototype.toObject());
- JS::RootedId id(cx, JS::PropertyKey::fromNonIntAtom(JS_GetFunctionId(
+ JS::RootedId id(cx, JS::PropertyKey::NonIntAtom(JS_GetFunctionId(
JS_GetObjectFunction(&args.callee()))));
return JS_GetPropertyById(cx, prototype, id, args.rval());
}
@@ -723,7 +723,7 @@ static bool interface_setter(JSContext* cx, unsigned argc, JS::Value* vp) {
JS::RootedObject this_obj(cx);
if (!args.computeThis(cx, &this_obj))
return false;
- JS::RootedId override_id(cx, SYMBOL_TO_JSID(symbol));
+ JS::RootedId override_id(cx, JS::PropertyKey::Symbol(symbol));
return JS_SetPropertyById(cx, this_obj, override_id, args[0]);
}
diff --git a/gi/object.h b/gi/object.h
index 0985845e..c2fd4e5d 100644
--- a/gi/object.h
+++ b/gi/object.h
@@ -170,7 +170,7 @@ struct IdHasher {
return js::DefaultHasher<JSString*>::hash(id.toString());
if (id.isSymbol())
return js::DefaultHasher<JS::Symbol*>::hash(id.toSymbol());
- return mozilla::HashGeneric(JSID_BITS(id));
+ return mozilla::HashGeneric(id.asRawBits());
}
static bool match(jsid id1, jsid id2) { return id1 == id2; }
};