瀏覽代碼

amberc.js: add js globals support

Manfred Kroehnert 11 年之前
父節點
當前提交
a944c0c784
共有 1 個文件被更改,包括 6 次插入0 次删除
  1. 6 0
      bin/amberc.js

+ 6 - 0
bin/amberc.js

@@ -106,6 +106,7 @@ var createDefaults = function(amber_dir, finished_callback){
 		'mainfile': undefined,
 		'stFiles': [],
 		'jsFiles': [],
+		'jsGlobals': [],
 		'closure': false,
 		'closure_parts': false,
 		'closure_full': false,
@@ -422,6 +423,11 @@ AmberC.prototype.create_compiler = function(compilerFilesArray) {
 		console.log('Compiler loaded');
 		self.defaults.smalltalk.ErrorHandler._setCurrent_(self.defaults.smalltalk.RethrowErrorHandler._new());
 
+		if(0 != self.defaults.jsGlobals.length) {
+			var jsGlobalVariables = self.defaults.smalltalk.globalJsVariables;
+			jsGlobalVariables.push.apply(jsGlobalVariables, self.defaults.jsGlobals);
+		}
+
 		self.compile();
 	});