Bläddra i källkod

amberc.js: add js globals support

Manfred Kroehnert 11 år sedan
förälder
incheckning
a944c0c784
1 ändrade filer med 6 tillägg och 0 borttagningar
  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();
 	});