[gjs/wip/imports-cleanup: 12/13] importer: Remove separate define/seal step for importing modules



commit 910ea15d9da027a994add18cedce81fa3742a66d
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Fri Sep 27 19:28:09 2013 -0400

    importer: Remove separate define/seal step for importing modules
    
    If we simply set the module in the importer as the last step, this
    can't possibly fail.

 gjs/importer.c |   10 +++-------
 1 files changed, 3 insertions(+), 7 deletions(-)
---
diff --git a/gjs/importer.c b/gjs/importer.c
index 5a0bc7b..4d3c208 100644
--- a/gjs/importer.c
+++ b/gjs/importer.c
@@ -361,21 +361,17 @@ import_file_on_module(JSContext  *context,
     if (!gjs_import_file (context, name, file, &module_obj))
         goto out;
 
-    if (!define_import(context, obj, module_obj, name))
-        goto out;
-
     if (!define_meta_properties(context, module_obj, full_path, name, obj))
         goto out;
 
-    if (!seal_import(context, obj, name))
+    if (!JS_DefineProperty(context, obj,
+                           name, OBJECT_TO_JSVAL(module_obj),
+                           NULL, NULL, GJS_MODULE_PROP_FLAGS))
         goto out;
 
     retval = JS_TRUE;
 
  out:
-    if (!retval)
-        cancel_import(context, obj, name);
-
     g_free (full_path);
 
     return retval;


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