Skip to content

Commit 6c17350

Browse files
committed
Fix js override for registerClass signature with a single argument
1 parent 5415728 commit 6c17350

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

src/overrides.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,23 @@ export function overrides() {
3030
// https://gitlab.gnome.org/GNOME/glib/-/issues/2336
3131
// https://gitlab.gnome.org/GNOME/glib/-/issues/667
3232
GObject.registerClass = function registerWorkbenchClass(...args) {
33-
const klass = args[0];
34-
const GTypeName = klass.GTypeName || args[1]?.name;
33+
let attrs;
34+
let klass;
35+
36+
if (args.length === 1) {
37+
attrs = {};
38+
klass = args[0];
39+
} else {
40+
attrs = args[0];
41+
klass = args[1];
42+
}
43+
44+
const GTypeName = attrs.GTypeName || klass.name;
3545
if (GTypeName) {
3646
types[GTypeName] = increment(GTypeName);
37-
klass.GTypeName = GTypeName + types[GTypeName];
47+
attrs.GTypeName = GTypeName + types[GTypeName];
3848
}
39-
return registerClass(...args);
49+
return registerClass(attrs, klass);
4050
};
4151
// This is used to tweak `workbench.template` in order to set the
4252
// <template class="?"/> to something that will work next time

0 commit comments

Comments
 (0)