Fix mozilla-ast after module loading changes
authorMihai Bazon <mihai.bazon@gmail.com>
Thu, 24 Sep 2015 15:12:06 +0000 (18:12 +0300)
committerMihai Bazon <mihai.bazon@gmail.com>
Thu, 24 Sep 2015 15:13:21 +0000 (18:13 +0300)
Need to explicitly qualify stuff now, since it's not evaluated in some
global scope.

Ref #636

lib/mozilla-ast.js
test/mozilla-ast.js
tools/exports.js

index 1deb18e..ac53ca2 100644 (file)
 
     function map(moztype, mytype, propmap) {
         var moz_to_me = "function From_Moz_" + moztype + "(M){\n";
-        moz_to_me += "return new " + mytype.name + "({\n" +
+        moz_to_me += "return new U2." + mytype.name + "({\n" +
             "start: my_start_token(M),\n" +
             "end: my_end_token(M)";
 
         //me_to_moz = parse(me_to_moz).print_to_string({ beautify: true });
         //console.log(moz_to_me);
 
-        moz_to_me = new Function("my_start_token", "my_end_token", "from_moz", "return(" + moz_to_me + ")")(
-            my_start_token, my_end_token, from_moz
+        moz_to_me = new Function("U2", "my_start_token", "my_end_token", "from_moz", "return(" + moz_to_me + ")")(
+            exports, my_start_token, my_end_token, from_moz
         );
         me_to_moz = new Function("to_moz", "to_moz_block", "return(" + me_to_moz + ")")(
             to_moz, to_moz_block
index 0262867..b5c6c6e 100644 (file)
@@ -100,4 +100,4 @@ module.exports = function(options) {
     }
 
     process.stdout.write(prefix + "Probability of error is less than " + (100 / options.iterations) + "%, stopping.\n");
-};
\ No newline at end of file
+};
index a27cef9..5007e03 100644 (file)
@@ -14,3 +14,4 @@ exports["merge"] = merge;
 exports["parse"] = parse;
 exports["push_uniq"] = push_uniq;
 exports["string_template"] = string_template;
+exports["is_identifier"] = is_identifier;