Bug 819702 - apply de-macroization and de-constification form JS2C to selfhosted.js. r=shu DONTBUILD
authorTill Schneidereit <tschneidereit@gmail.com>
Thu, 13 Dec 2012 02:10:34 +0100
changeset 121447 1630310cc83dc721de2fb1b5b5b14484f5b91c5a
parent 121446 4777ad9776ec145b6cf0f1fb4d262af7158246ca
child 121448 6445a79d979566e4920272abf517005b25c7c01c
push idunknown
push userunknown
push dateunknown
reviewersshu
bugs819702
milestone20.0a1
Bug 819702 - apply de-macroization and de-constification form JS2C to selfhosted.js. r=shu DONTBUILD
js/src/builtin/embedjs.py
js/src/builtin/js2c.py
--- a/js/src/builtin/embedjs.py
+++ b/js/src/builtin/embedjs.py
@@ -40,12 +40,14 @@ def main():
     if debug:
         sys.argv.pop(1)
     output_file = sys.argv[1]
     messages_file = sys.argv[2]
     macros_file = sys.argv[3]
     source_files = sys.argv[4:]
     combined_file = 'selfhosted.js'
     replaceErrorMsgs(source_files, messages_file, combined_file)
-    js2c.JS2C([combined_file, macros_file], [output_file], { 'TYPE': 'CORE', 'COMPRESSION': 'off', 'DEBUG':debug })
+    combined_sources = js2c.JS2C([combined_file, macros_file], [output_file], { 'TYPE': 'CORE', 'COMPRESSION': 'off', 'DEBUG':debug })
+    with open(combined_file, 'w') as output:
+        output.write(combined_sources)
 
 if __name__ == "__main__":
     main()
--- a/js/src/builtin/js2c.py
+++ b/js/src/builtin/js2c.py
@@ -332,16 +332,17 @@ def JS2C(source, target, env):
     'raw_total_length': raw_total_length,
     'total_length': total_length,
     'get_index_cases': "".join(get_index_cases),
     'get_raw_script_source_cases': "".join(get_raw_script_source_cases),
     'get_script_name_cases': "".join(get_script_name_cases),
     'type': env['TYPE']
   })
   output.close()
+  return "".join(all_sources)
 
 def main():
   natives = sys.argv[1]
   type = sys.argv[2]
   compression = sys.argv[3]
   source_files = sys.argv[4:]
   JS2C(source_files, [natives], { 'TYPE': type, 'COMPRESSION': compression })