[gjs] jsapi-dynamic-class: Use JS_LinkConstructorAndPrototype()



commit bd36b0b06cf1c889de2316d17b839997e8758ef0
Author: Philip Chimento <philip chimento gmail com>
Date:   Mon Apr 10 21:17:43 2017 -0700

    jsapi-dynamic-class: Use JS_LinkConstructorAndPrototype()
    
    Small cleanup; there is a function in the JSAPI that does exactly this,
    automatically with the right flags.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=614413

 gjs/jsapi-dynamic-class.cpp |    7 +------
 1 files changed, 1 insertions(+), 6 deletions(-)
---
diff --git a/gjs/jsapi-dynamic-class.cpp b/gjs/jsapi-dynamic-class.cpp
index a645f14..1205a65 100644
--- a/gjs/jsapi-dynamic-class.cpp
+++ b/gjs/jsapi-dynamic-class.cpp
@@ -110,12 +110,7 @@ gjs_init_class_dynamic(JSContext              *context,
     if (static_fs && !JS_DefineFunctions(context, constructor, static_fs))
         goto out;
 
-    if (!JS_DefineProperty(context, constructor, "prototype", prototype,
-                           JSPROP_PERMANENT | JSPROP_READONLY,
-                           JS_STUBGETTER, JS_STUBSETTER))
-        goto out;
-    if (!JS_DefineProperty(context, prototype, "constructor", constructor,
-                           0, JS_STUBGETTER, JS_STUBSETTER))
+    if (!JS_LinkConstructorAndPrototype(context, constructor, prototype))
         goto out;
 
     /* The constructor defined by JS_InitClass has no property attributes, but this


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]