[gjs/wip/imports-cleanup: 6/13] importer: Remove finish_import



commit 97ede49120e2bf0edf6f1e70ca1692a10babfc16
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Fri Sep 27 16:57:06 2013 -0400

    importer: Remove finish_import
    
    We already check for pending exceptions at the import_file level,
    so we don't need to do it again. Also, the log message mentions
    native modules, which can be confusing.

 gjs/importer.c |   27 +++++++--------------------
 1 files changed, 7 insertions(+), 20 deletions(-)
---
diff --git a/gjs/importer.c b/gjs/importer.c
index 647d331..d02b3eb 100644
--- a/gjs/importer.c
+++ b/gjs/importer.c
@@ -128,22 +128,6 @@ import_directory(JSContext   *context,
 }
 
 static JSBool
-finish_import(JSContext  *context,
-              const char *name)
-{
-    if (JS_IsExceptionPending(context)) {
-        /* I am not sure whether this can happen, but if it does we want to trap it.
-         */
-        gjs_debug(GJS_DEBUG_IMPORTER,
-                  "Module '%s' reported an exception but gjs_import_native_module() returned TRUE",
-                  name);
-        return JS_FALSE;
-    }
-
-    return JS_TRUE;
-}
-
-static JSBool
 define_import(JSContext  *context,
               JSObject   *obj,
               JSObject   *module_obj,
@@ -257,8 +241,14 @@ import_native_file(JSContext  *context,
     if (!gjs_import_native_module(context, module_obj, name))
         goto out;
 
-    if (!finish_import(context, name))
+    if (JS_IsExceptionPending(context)) {
+        /* I am not sure whether this can happen, but if it does we want to trap it.
+         */
+        gjs_debug(GJS_DEBUG_IMPORTER,
+                  "Module '%s' reported an exception but gjs_import_native_module() returned TRUE",
+                  name);
         goto out;
+    }
 
     if (!seal_import(context, obj, name))
         goto out;
@@ -486,9 +476,6 @@ import_file_on_module(JSContext  *context,
     if (!define_meta_properties(context, module_obj, full_path, name, obj))
         goto out;
 
-    if (!finish_import(context, name))
-        goto out;
-
     if (!seal_import(context, obj, name))
         goto out;
 


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