소스 검색

boot.js: globals localized in boot.js

Herbert Vojčík 10 년 전
부모
커밋
c85d2a46d4
1개의 변경된 파일18개의 추가작업 그리고 11개의 파일을 삭제
  1. 18 11
      js/boot.js

+ 18 - 11
js/boot.js

@@ -101,6 +101,12 @@ inherits(SmalltalkPackageOrganizer, SmalltalkOrganizer);
 inherits(SmalltalkClassOrganizer, SmalltalkOrganizer);
 
 
+/* Global Smalltalk objects. */
+var smalltalk, nil, _st;
+
+nil = new SmalltalkNil();
+(function (nil) {
+
 function Smalltalk() {
 
 	var st = this;
@@ -196,7 +202,7 @@ function Smalltalk() {
 	}
 
 	/* Smalltalk class creation. A class is an instance of an automatically
-		created metaclass object. Newly created classes (not their metaclass) 
+		created metaclass object. Newly created classes (not their metaclass)
 		should be added to the smalltalk object, see smalltalk.addClass().
 		Superclass linking is *not* handled here, see smalltalk.init()  */
 
@@ -785,6 +791,10 @@ function Smalltalk() {
 
 inherits(Smalltalk, SmalltalkObject);
 
+if(this.jQuery) {
+    this.jQuery.allowJavaScriptCalls = true;
+}
+
 function SmalltalkMethodContext(home, setup) {
 	this.homeContext = home;
 	this.setup       = setup || function() {};
@@ -799,6 +809,9 @@ SmalltalkMethodContext.prototype.lookupClass = null;
 
 inherits(SmalltalkMethodContext, SmalltalkObject);
 
+smalltalk = new Smalltalk();
+(function (smalltalk) {
+
 SmalltalkMethodContext.prototype.fill = function(receiver, selector, locals, lookupClass) {
 	this.receiver    = receiver;
 	this.selector    = selector;
@@ -830,21 +843,12 @@ SmalltalkMethodContext.prototype.method = function() {
 	return method;
 };
 
-/* Global Smalltalk objects. */
-
-var nil = new SmalltalkNil();
-var smalltalk = new Smalltalk();
-
-if(this.jQuery) {
-	this.jQuery.allowJavaScriptCalls = true;
-}
-
 /*
  * Answer the smalltalk representation of o.
  * Used in message sends
  */
 
-var _st = function(o) {
+_st = function(o) {
 	if(o == null) {return nil;}
 	if(o.klass) {return o;}
 	return smalltalk.JSObjectProxy._on_(o);
@@ -890,3 +894,6 @@ smalltalk.wrapClassName("MethodContext", "Kernel-Methods", SmalltalkMethodContex
 
 smalltalk.alias(smalltalk.Array, "OrderedCollection");
 smalltalk.alias(smalltalk.Date, "Time");
+
+})(smalltalk);
+})(nil);