[gjs: 14/18] jsapi-util: Change CallArgs parameter to const reference




commit c176057a208bf11b9efc9e2e5dac55101290a560
Author: Philip Chimento <philip chimento gmail com>
Date:   Sun Nov 29 21:53:51 2020 -0800

    jsapi-util: Change CallArgs parameter to const reference
    
    gjs_throw_abstract_constructor_error() takes a JS::CallArgs& parameter,
    change it to const JS::CallArgs& (because it doesn't need to modify the
    CallArgs, and the constness is needed for a future refactor.

 gjs/jsapi-util.cpp | 6 ++----
 gjs/jsapi-util.h   | 4 ++--
 2 files changed, 4 insertions(+), 6 deletions(-)
---
diff --git a/gjs/jsapi-util.cpp b/gjs/jsapi-util.cpp
index 1bcfed44..945c9fb6 100644
--- a/gjs/jsapi-util.cpp
+++ b/gjs/jsapi-util.cpp
@@ -186,10 +186,8 @@ gjs_throw_constructor_error(JSContext *context)
               "Constructor called as normal method. Use 'new SomeObject()' not 'SomeObject()'");
 }
 
-void
-gjs_throw_abstract_constructor_error(JSContext    *context,
-                                     JS::CallArgs& args)
-{
+void gjs_throw_abstract_constructor_error(JSContext* context,
+                                          const JS::CallArgs& args) {
     const JSClass *proto_class;
     const char *name = "anonymous";
 
diff --git a/gjs/jsapi-util.h b/gjs/jsapi-util.h
index f43c294d..2d2aac87 100644
--- a/gjs/jsapi-util.h
+++ b/gjs/jsapi-util.h
@@ -389,8 +389,8 @@ struct GCPolicy<GjsAutoParam> : public IgnoreGCPolicy<GjsAutoParam> {};
 
 void gjs_throw_constructor_error             (JSContext       *context);
 
-void gjs_throw_abstract_constructor_error(JSContext    *context,
-                                          JS::CallArgs& args);
+void gjs_throw_abstract_constructor_error(JSContext* cx,
+                                          const JS::CallArgs& args);
 
 GJS_JSAPI_RETURN_CONVENTION
 JSObject* gjs_build_string_array(JSContext* cx,


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