Browse Source

Merge pull request #804 from herby/smalltalk-is-global-not-a-class

`Smalltalk` is global variable, not a class
Nicolas Petton 11 years ago
parent
commit
5cca0463c9
59 changed files with 631 additions and 617 deletions
  1. 1 1
      cli/st/AmberCli.st
  2. 3 3
      js/Compiler-AST.js
  3. 37 37
      js/Compiler-Core.js
  4. 1 25
      js/Compiler-IR.js
  5. 7 6
      js/Compiler-Interpreter.js
  6. 6 6
      js/Compiler-Semantic.js
  7. 51 51
      js/Compiler-Tests.js
  8. 22 14
      js/Helios-Core.js
  9. 16 19
      js/Helios-Workspace.js
  10. 32 34
      js/IDE.js
  11. 5 5
      js/Kernel-Announcements.js
  12. 24 48
      js/Kernel-Classes.js
  13. 23 23
      js/Kernel-ImportExport.js
  14. 189 133
      js/Kernel-Infrastructure.js
  15. 3 3
      js/Kernel-Methods.js
  16. 36 46
      js/Kernel-Tests.js
  17. 1 1
      st/Benchfib.st
  18. 1 1
      st/Canvas.st
  19. 2 2
      st/Compiler-AST.st
  20. 13 11
      st/Compiler-Core.st
  21. 1 1
      st/Compiler-Exceptions.st
  22. 1 9
      st/Compiler-IR.st
  23. 1 1
      st/Compiler-Inlining.st
  24. 3 3
      st/Compiler-Interpreter.st
  25. 3 3
      st/Compiler-Semantic.st
  26. 18 18
      st/Compiler-Tests.st
  27. 1 1
      st/Examples.st
  28. 1 1
      st/Helios-Announcements.st
  29. 1 1
      st/Helios-Browser.st
  30. 1 1
      st/Helios-Commands-Browser.st
  31. 1 1
      st/Helios-Commands-Core.st
  32. 1 1
      st/Helios-Commands-Tools.st
  33. 6 5
      st/Helios-Core.st
  34. 1 1
      st/Helios-Debugger.st
  35. 1 1
      st/Helios-Exceptions.st
  36. 1 1
      st/Helios-Helpers.st
  37. 1 1
      st/Helios-Inspector.st
  38. 1 1
      st/Helios-KeyBindings.st
  39. 1 1
      st/Helios-Layout.st
  40. 1 1
      st/Helios-References.st
  41. 1 1
      st/Helios-Transcript.st
  42. 1 1
      st/Helios-Workspace-Tests.st
  43. 4 4
      st/Helios-Workspace.st
  44. 12 12
      st/IDE.st
  45. 3 3
      st/Kernel-Announcements.st
  46. 4 9
      st/Kernel-Classes.st
  47. 1 1
      st/Kernel-Collections.st
  48. 1 1
      st/Kernel-Exceptions.st
  49. 9 9
      st/Kernel-ImportExport.st
  50. 54 32
      st/Kernel-Infrastructure.st
  51. 2 2
      st/Kernel-Methods.st
  52. 1 1
      st/Kernel-Objects.st
  53. 13 13
      st/Kernel-Tests.st
  54. 1 1
      st/Kernel-Transcript.st
  55. 1 1
      st/SUnit-Tests.st
  56. 1 1
      st/SUnit.st
  57. 1 1
      st/Spaces.st
  58. 1 1
      support/boot.js
  59. 1 1
      test/Test.st

+ 1 - 1
cli/st/AmberCli.st

@@ -1,4 +1,4 @@
-Smalltalk current createPackage: 'AmberCli'!
+Smalltalk createPackage: 'AmberCli'!
 Object subclass: #AmberCli
 	instanceVariableNames: ''
 	package: 'AmberCli'!

+ 3 - 3
js/Compiler-AST.js

@@ -2432,12 +2432,12 @@ _st($1)._ifEmpty_((function(){
 return smalltalk.withContext(function($ctx2) {
 return self._error_("Method source is empty");
 }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
-$2=_st(_st($Smalltalk())._current())._parse_(self._source());
+$2=_st($Smalltalk())._parse_(self._source());
 return $2;
 }, function($ctx1) {$ctx1.fill(self,"ast",{},smalltalk.CompiledMethod)})},
 args: [],
-source: "ast\x0a\x09self source ifEmpty: [ self error: 'Method source is empty' ].\x0a\x09\x0a\x09^ Smalltalk current parse: self source",
-messageSends: ["ifEmpty:", "source", "error:", "parse:", "current"],
+source: "ast\x0a\x09self source ifEmpty: [ self error: 'Method source is empty' ].\x0a\x09\x0a\x09^ Smalltalk parse: self source",
+messageSends: ["ifEmpty:", "source", "error:", "parse:"],
 referencedClasses: ["Smalltalk"]
 }),
 smalltalk.CompiledMethod);

+ 37 - 37
js/Compiler-Core.js

@@ -1,4 +1,4 @@
-define("amber_core/Compiler-Core", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_core/Kernel-Objects"], function(smalltalk,nil,_st){
+define("amber_core/Compiler-Core", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_core/Kernel-Objects", "amber_core/Kernel-Collections"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Compiler-Core');
 smalltalk.packages["Compiler-Core"].transport = {"type":"amd","amdNamespace":"amber_core"};
 
@@ -93,36 +93,12 @@ var self=this;
 function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
 return smalltalk.withContext(function($ctx1) { 
 var $1;
-$1=_st(_st($Smalltalk())._current())._pseudoVariableNames();
+$1=_st($Smalltalk())._pseudoVariableNames();
 return $1;
 }, function($ctx1) {$ctx1.fill(self,"pseudoVariables",{},smalltalk.AbstractCodeGenerator)})},
 args: [],
-source: "pseudoVariables\x0a\x09^ Smalltalk current pseudoVariableNames",
-messageSends: ["pseudoVariableNames", "current"],
-referencedClasses: ["Smalltalk"]
-}),
-smalltalk.AbstractCodeGenerator);
-
-smalltalk.addMethod(
-smalltalk.method({
-selector: "safeVariableNameFor:",
-protocol: 'accessing',
-fn: function (aString){
-var self=this;
-function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
-return smalltalk.withContext(function($ctx1) { 
-var $2,$1;
-$2=_st(_st(_st($Smalltalk())._current())._reservedWords())._includes_(aString);
-if(smalltalk.assert($2)){
-$1=_st(aString).__comma("_");
-} else {
-$1=aString;
-};
-return $1;
-}, function($ctx1) {$ctx1.fill(self,"safeVariableNameFor:",{aString:aString},smalltalk.AbstractCodeGenerator)})},
-args: ["aString"],
-source: "safeVariableNameFor: aString\x0a\x09^ (Smalltalk current reservedWords includes: aString)\x0a\x09\x09ifTrue: [ aString, '_' ]\x0a\x09\x09ifFalse: [ aString ]",
-messageSends: ["ifTrue:ifFalse:", "includes:", "reservedWords", "current", ","],
+source: "pseudoVariables\x0a\x09^ Smalltalk pseudoVariableNames",
+messageSends: ["pseudoVariableNames"],
 referencedClasses: ["Smalltalk"]
 }),
 smalltalk.AbstractCodeGenerator);
@@ -533,12 +509,12 @@ var self=this;
 function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
 return smalltalk.withContext(function($ctx1) { 
 var $1;
-$1=_st(_st($Smalltalk())._current())._parse_(aString);
+$1=_st($Smalltalk())._parse_(aString);
 return $1;
 }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},smalltalk.Compiler)})},
 args: ["aString"],
-source: "parse: aString\x0a\x09^ Smalltalk current parse: aString",
-messageSends: ["parse:", "current"],
+source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
+messageSends: ["parse:"],
 referencedClasses: ["Smalltalk"]
 }),
 smalltalk.Compiler);
@@ -595,14 +571,14 @@ fn: function (){
 var self=this;
 function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
 return smalltalk.withContext(function($ctx1) { 
-_st(_st(_st($Smalltalk())._current())._classes())._do_displayingProgress_((function(each){
+_st(_st($Smalltalk())._classes())._do_displayingProgress_((function(each){
 return smalltalk.withContext(function($ctx2) {
 return self._recompile_(each);
 }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),"Compiling all classes...");
 return self}, function($ctx1) {$ctx1.fill(self,"recompileAll",{},smalltalk.Compiler)})},
 args: [],
-source: "recompileAll\x0a\x09Smalltalk current classes \x0a\x09\x09do: [ :each | self recompile: each ]\x0a\x09\x09displayingProgress: 'Compiling all classes...'",
-messageSends: ["do:displayingProgress:", "classes", "current", "recompile:"],
+source: "recompileAll\x0a\x09Smalltalk classes \x0a\x09\x09do: [ :each | self recompile: each ]\x0a\x09\x09displayingProgress: 'Compiling all classes...'",
+messageSends: ["do:displayingProgress:", "classes", "recompile:"],
 referencedClasses: ["Smalltalk"]
 }),
 smalltalk.Compiler);
@@ -705,14 +681,14 @@ fn: function (){
 var self=this;
 function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
 return smalltalk.withContext(function($ctx1) { 
-_st(_st(_st($Smalltalk())._current())._classes())._do_((function(each){
+_st(_st($Smalltalk())._classes())._do_((function(each){
 return smalltalk.withContext(function($ctx2) {
 return self._recompile_(each);
 }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
 return self}, function($ctx1) {$ctx1.fill(self,"recompileAll",{},smalltalk.Compiler.klass)})},
 args: [],
-source: "recompileAll\x0a\x09Smalltalk current classes do: [ :each |\x0a\x09\x09self recompile: each ]",
-messageSends: ["do:", "classes", "current", "recompile:"],
+source: "recompileAll\x0a\x09Smalltalk classes do: [ :each |\x0a\x09\x09self recompile: each ]",
+messageSends: ["do:", "classes", "recompile:"],
 referencedClasses: ["Smalltalk"]
 }),
 smalltalk.Compiler.klass);
@@ -1016,4 +992,28 @@ referencedClasses: []
 smalltalk.NodeVisitor);
 
 
+smalltalk.addMethod(
+smalltalk.method({
+selector: "asVariableName",
+protocol: '*Compiler-Core',
+fn: function (){
+var self=this;
+function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$2=_st(_st($Smalltalk())._reservedWords())._includes_(self);
+if(smalltalk.assert($2)){
+$1=self.__comma("_");
+} else {
+$1=self;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"asVariableName",{},smalltalk.String)})},
+args: [],
+source: "asVariableName\x0a\x09^ (Smalltalk reservedWords includes: self)\x0a\x09\x09ifTrue: [ self, '_' ]\x0a\x09\x09ifFalse: [ self ]",
+messageSends: ["ifTrue:ifFalse:", "includes:", "reservedWords", ","],
+referencedClasses: ["Smalltalk"]
+}),
+smalltalk.String);
+
 });

+ 1 - 25
js/Compiler-IR.js

@@ -1,4 +1,4 @@
-define("amber_core/Compiler-IR", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_core/Compiler-Core", "amber_core/Kernel-Objects", "amber_core/Kernel-Methods", "amber_core/Kernel-Collections"], function(smalltalk,nil,_st){
+define("amber_core/Compiler-IR", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_core/Compiler-Core", "amber_core/Kernel-Objects", "amber_core/Kernel-Methods"], function(smalltalk,nil,_st){
 smalltalk.addPackage('Compiler-IR');
 smalltalk.packages["Compiler-IR"].transport = {"type":"amd","amdNamespace":"amber_core"};
 
@@ -4098,28 +4098,4 @@ referencedClasses: []
 }),
 smalltalk.BlockClosure);
 
-smalltalk.addMethod(
-smalltalk.method({
-selector: "asVariableName",
-protocol: '*Compiler-IR',
-fn: function (){
-var self=this;
-function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
-return smalltalk.withContext(function($ctx1) { 
-var $2,$1;
-$2=_st(_st(_st($Smalltalk())._current())._reservedWords())._includes_(self);
-if(smalltalk.assert($2)){
-$1=self.__comma("_");
-} else {
-$1=self;
-};
-return $1;
-}, function($ctx1) {$ctx1.fill(self,"asVariableName",{},smalltalk.String)})},
-args: [],
-source: "asVariableName\x0a\x09^ (Smalltalk current reservedWords includes: self)\x0a\x09\x09ifTrue: [ self, '_' ]\x0a\x09\x09ifFalse: [ self ]",
-messageSends: ["ifTrue:ifFalse:", "includes:", "reservedWords", "current", ","],
-referencedClasses: ["Smalltalk"]
-}),
-smalltalk.String);
-
 });

+ 7 - 6
js/Compiler-Interpreter.js

@@ -948,14 +948,14 @@ function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"
 function $SemanticAnalyzer(){return smalltalk.SemanticAnalyzer||(typeof SemanticAnalyzer=="undefined"?nil:SemanticAnalyzer)}
 return smalltalk.withContext(function($ctx1) { 
 var $1;
-ast=_st(_st($Smalltalk())._current())._parse_(_st(self._method())._source());
+ast=_st($Smalltalk())._parse_(_st(self._method())._source());
 _st(_st($SemanticAnalyzer())._on_(_st(_st(self._context())._receiver())._class()))._visit_(ast);
 $1=ast;
 return $1;
 }, function($ctx1) {$ctx1.fill(self,"buildAST",{ast:ast},smalltalk.ASTDebugger)})},
 args: [],
-source: "buildAST\x0a\x09\x22Build the AST tree from the method source code.\x0a\x09The AST is annotated with a SemanticAnalyzer,\x0a\x09to know the semantics and bindings of each node needed for later debugging\x22\x0a\x09\x0a\x09| ast |\x0a\x09\x0a\x09ast := Smalltalk current parse: self method source.\x0a\x09(SemanticAnalyzer on: self context receiver class)\x0a\x09\x09visit: ast.\x0a\x09\x0a\x09^ ast",
-messageSends: ["parse:", "current", "source", "method", "visit:", "on:", "class", "receiver", "context"],
+source: "buildAST\x0a\x09\x22Build the AST tree from the method source code.\x0a\x09The AST is annotated with a SemanticAnalyzer,\x0a\x09to know the semantics and bindings of each node needed for later debugging\x22\x0a\x09\x0a\x09| ast |\x0a\x09\x0a\x09ast := Smalltalk parse: self method source.\x0a\x09(SemanticAnalyzer on: self context receiver class)\x0a\x09\x09visit: ast.\x0a\x09\x0a\x09^ ast",
+messageSends: ["parse:", "source", "method", "visit:", "on:", "class", "receiver", "context"],
 referencedClasses: ["Smalltalk", "SemanticAnalyzer"]
 }),
 smalltalk.ASTDebugger);
@@ -2084,7 +2084,8 @@ $15=_st(aNode)._value();
 $ctx2.sendIdx["value"]=4;
 $14=_st($15)._isCapitalized();
 if(smalltalk.assert($14)){
-$16=_st($Smalltalk())._current();
+$16=_st($Smalltalk())._globals();
+$ctx2.sendIdx["globals"]=2;
 $17=_st(aNode)._value();
 $ctx2.sendIdx["value"]=5;
 return _st($16)._at_ifAbsent_($17,(function(){
@@ -2097,8 +2098,8 @@ return _st(_st($PlatformInterface())._globals())._at_(_st(aNode)._value());
 self._push_($7);
 return self}, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},smalltalk.ASTInterpreter)})},
 args: ["aNode"],
-source: "visitVariableNode: aNode\x0a\x09aNode binding isUnknownVar ifTrue: [\x0a\x09\x09^ self push: (PlatformInterface globals at: aNode value ifAbsent: [ self error: 'Unknown variable' ]) ].\x0a\x09\x09\x0a\x09self push: (aNode binding isInstanceVar\x0a\x09\x09ifTrue: [ self context receiver instVarAt: aNode value ]\x0a\x09\x09ifFalse: [ self context \x0a\x09\x09\x09localAt: aNode value\x0a\x09\x09\x09ifAbsent: [\x0a\x09\x09\x09\x09aNode value isCapitalized\x0a\x09\x09\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09\x09\x09Smalltalk current \x0a\x09\x09\x09\x09\x09\x09\x09at: aNode value \x0a\x09\x09\x09\x09\x09\x09\x09ifAbsent: [ PlatformInterface globals at: aNode value ] ] ] ])",
-messageSends: ["ifTrue:", "isUnknownVar", "binding", "push:", "at:ifAbsent:", "globals", "value", "error:", "ifTrue:ifFalse:", "isInstanceVar", "instVarAt:", "receiver", "context", "localAt:ifAbsent:", "isCapitalized", "current", "at:"],
+source: "visitVariableNode: aNode\x0a\x09aNode binding isUnknownVar ifTrue: [\x0a\x09\x09^ self push: (PlatformInterface globals at: aNode value ifAbsent: [ self error: 'Unknown variable' ]) ].\x0a\x09\x09\x0a\x09self push: (aNode binding isInstanceVar\x0a\x09\x09ifTrue: [ self context receiver instVarAt: aNode value ]\x0a\x09\x09ifFalse: [ self context \x0a\x09\x09\x09localAt: aNode value\x0a\x09\x09\x09ifAbsent: [\x0a\x09\x09\x09\x09aNode value isCapitalized\x0a\x09\x09\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09\x09\x09Smalltalk globals \x0a\x09\x09\x09\x09\x09\x09\x09at: aNode value \x0a\x09\x09\x09\x09\x09\x09\x09ifAbsent: [ PlatformInterface globals at: aNode value ] ] ] ])",
+messageSends: ["ifTrue:", "isUnknownVar", "binding", "push:", "at:ifAbsent:", "globals", "value", "error:", "ifTrue:ifFalse:", "isInstanceVar", "instVarAt:", "receiver", "context", "localAt:ifAbsent:", "isCapitalized", "at:"],
 referencedClasses: ["PlatformInterface", "Smalltalk"]
 }),
 smalltalk.ASTInterpreter);

+ 6 - 6
js/Compiler-Semantic.js

@@ -770,7 +770,7 @@ $1=self["@pseudoVars"];
 if(($receiver = $1) == nil || $receiver == null){
 self["@pseudoVars"]=_st($Dictionary())._new();
 self["@pseudoVars"];
-_st(_st(_st($Smalltalk())._current())._pseudoVariableNames())._do_((function(each){
+_st(_st($Smalltalk())._pseudoVariableNames())._do_((function(each){
 return smalltalk.withContext(function($ctx2) {
 $2=_st($PseudoVar())._on_(each);
 _st($2)._scope_(self._methodScope());
@@ -784,8 +784,8 @@ $4=self["@pseudoVars"];
 return $4;
 }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},smalltalk.MethodLexicalScope)})},
 args: [],
-source: "pseudoVars\x0a\x09pseudoVars ifNil: [\x0a\x09\x09pseudoVars := Dictionary new.\x0a\x09\x09Smalltalk current pseudoVariableNames do: [ :each |\x0a\x09\x09\x09pseudoVars at: each put: ((PseudoVar on: each)\x0a\x09\x09\x09\x09scope: self methodScope;\x0a\x09\x09\x09\x09yourself) ]].\x0a\x09^ pseudoVars",
-messageSends: ["ifNil:", "new", "do:", "pseudoVariableNames", "current", "at:put:", "scope:", "on:", "methodScope", "yourself"],
+source: "pseudoVars\x0a\x09pseudoVars ifNil: [\x0a\x09\x09pseudoVars := Dictionary new.\x0a\x09\x09Smalltalk pseudoVariableNames do: [ :each |\x0a\x09\x09\x09pseudoVars at: each put: ((PseudoVar on: each)\x0a\x09\x09\x09\x09scope: self methodScope;\x0a\x09\x09\x09\x09yourself) ]].\x0a\x09^ pseudoVars",
+messageSends: ["ifNil:", "new", "do:", "pseudoVariableNames", "at:put:", "scope:", "on:", "methodScope", "yourself"],
 referencedClasses: ["Dictionary", "Smalltalk", "PseudoVar"]
 }),
 smalltalk.MethodLexicalScope);
@@ -1407,7 +1407,7 @@ return smalltalk.withContext(function($ctx1) {
 var $1,$2,$3,$4,$5;
 identifier=_st(aNode)._value();
 $ctx1.sendIdx["value"]=1;
-$1=_st(_st(_st(_st(_st($Smalltalk())._current())._globalJsVariables())._includes_(identifier))._not())._and_((function(){
+$1=_st(_st(_st(_st($Smalltalk())._globalJsVariables())._includes_(identifier))._not())._and_((function(){
 return smalltalk.withContext(function($ctx2) {
 return self._isVariableGloballyUndefined_(identifier);
 }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
@@ -1424,8 +1424,8 @@ _st(_st(_st(self["@currentScope"])._methodScope())._unknownVariables())._add_(_s
 };
 return self}, function($ctx1) {$ctx1.fill(self,"errorUnknownVariable:",{aNode:aNode,identifier:identifier},smalltalk.SemanticAnalyzer)})},
 args: ["aNode"],
-source: "errorUnknownVariable: aNode\x0a\x09\x22Throw an error if the variable is undeclared in the global JS scope (i.e. window).\x0a\x09We allow all variables listed by Smalltalk>>#globalJsVariables.\x0a\x09This list includes: `jQuery`, `window`, `document`,  `process` and `global`\x0a\x09for nodejs and browser environments.\x0a\x09\x0a\x09This is only to make sure compilation works on both browser-based and nodejs environments.\x0a\x09The ideal solution would be to use a pragma instead\x22\x0a\x0a\x09| identifier |\x0a\x09identifier := aNode value.\x0a\x09\x0a\x09((Smalltalk current globalJsVariables includes: identifier) not\x0a\x09\x09and: [ self isVariableGloballyUndefined: identifier ])\x0a\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09UnknownVariableError new\x0a\x09\x09\x09\x09\x09variableName: aNode value;\x0a\x09\x09\x09\x09\x09signal ]\x0a\x09\x09\x09ifFalse: [\x0a\x09\x09\x09\x09currentScope methodScope unknownVariables add: aNode value ]",
-messageSends: ["value", "ifTrue:ifFalse:", "and:", "not", "includes:", "globalJsVariables", "current", "isVariableGloballyUndefined:", "variableName:", "new", "signal", "add:", "unknownVariables", "methodScope"],
+source: "errorUnknownVariable: aNode\x0a\x09\x22Throw an error if the variable is undeclared in the global JS scope (i.e. window).\x0a\x09We allow all variables listed by Smalltalk>>#globalJsVariables.\x0a\x09This list includes: `jQuery`, `window`, `document`,  `process` and `global`\x0a\x09for nodejs and browser environments.\x0a\x09\x0a\x09This is only to make sure compilation works on both browser-based and nodejs environments.\x0a\x09The ideal solution would be to use a pragma instead\x22\x0a\x0a\x09| identifier |\x0a\x09identifier := aNode value.\x0a\x09\x0a\x09((Smalltalk globalJsVariables includes: identifier) not\x0a\x09\x09and: [ self isVariableGloballyUndefined: identifier ])\x0a\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09UnknownVariableError new\x0a\x09\x09\x09\x09\x09variableName: aNode value;\x0a\x09\x09\x09\x09\x09signal ]\x0a\x09\x09\x09ifFalse: [\x0a\x09\x09\x09\x09currentScope methodScope unknownVariables add: aNode value ]",
+messageSends: ["value", "ifTrue:ifFalse:", "and:", "not", "includes:", "globalJsVariables", "isVariableGloballyUndefined:", "variableName:", "new", "signal", "add:", "unknownVariables", "methodScope"],
 referencedClasses: ["Smalltalk", "UnknownVariableError"]
 }),
 smalltalk.SemanticAnalyzer);

+ 51 - 51
js/Compiler-Tests.js

@@ -30,12 +30,12 @@ var self=this;
 function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
 return smalltalk.withContext(function($ctx1) { 
 var $1;
-$1=_st(_st($Smalltalk())._current())._parse_(aString);
+$1=_st($Smalltalk())._parse_(aString);
 return $1;
 }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},smalltalk.ASTParsingTest)})},
 args: ["aString"],
-source: "parse: aString\x0a\x09^ Smalltalk current parse: aString",
-messageSends: ["parse:", "current"],
+source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
+messageSends: ["parse:"],
 referencedClasses: ["Smalltalk"]
 }),
 smalltalk.ASTParsingTest);
@@ -787,13 +787,13 @@ fn: function (){
 var self=this;
 function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
 return smalltalk.withContext(function($ctx1) { 
-self._should_return_("foo ^Object",_st(_st($Smalltalk())._current())._at_("Object"));
+self._should_return_("foo ^Object",_st(_st($Smalltalk())._globals())._at_("Object"));
 $ctx1.sendIdx["should:return:"]=1;
 self._should_return_("foo ^NonExistent",nil);
 return self}, function($ctx1) {$ctx1.fill(self,"testPascalCaseGlobal",{},smalltalk.CodeGeneratorTest)})},
 args: [],
-source: "testPascalCaseGlobal\x0a\x09self should: 'foo ^Object' return: (Smalltalk current at: 'Object').\x0a\x09self should: 'foo ^NonExistent' return: nil",
-messageSends: ["should:return:", "at:", "current"],
+source: "testPascalCaseGlobal\x0a\x09self should: 'foo ^Object' return: (Smalltalk globals at: 'Object').\x0a\x09self should: 'foo ^NonExistent' return: nil",
+messageSends: ["should:return:", "at:", "globals"],
 referencedClasses: ["Smalltalk"]
 }),
 smalltalk.CodeGeneratorTest);
@@ -1142,12 +1142,12 @@ var self=this;
 function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
 return smalltalk.withContext(function($ctx1) { 
 var $1;
-$1=_st(_st($Smalltalk())._current())._parse_(aString);
+$1=_st($Smalltalk())._parse_(aString);
 return $1;
 }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},smalltalk.InterpreterTest)})},
 args: ["aString"],
-source: "parse: aString\x0a\x09^ Smalltalk current parse: aString",
-messageSends: ["parse:", "current"],
+source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
+messageSends: ["parse:"],
 referencedClasses: ["Smalltalk"]
 }),
 smalltalk.InterpreterTest);
@@ -1381,15 +1381,15 @@ function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"
 function $InvalidAssignmentError(){return smalltalk.InvalidAssignmentError||(typeof InvalidAssignmentError=="undefined"?nil:InvalidAssignmentError)}
 return smalltalk.withContext(function($ctx1) { 
 src="foo self := 1";
-ast=_st(_st($Smalltalk())._current())._parse_(src);
+ast=_st($Smalltalk())._parse_(src);
 self._should_raise_((function(){
 return smalltalk.withContext(function($ctx2) {
 return _st(self["@analyzer"])._visit_(ast);
 }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$InvalidAssignmentError());
 return self}, function($ctx1) {$ctx1.fill(self,"testAssignment",{src:src,ast:ast},smalltalk.SemanticAnalyzerTest)})},
 args: [],
-source: "testAssignment\x0a\x09| src ast |\x0a\x0a\x09src := 'foo self := 1'.\x0a\x09ast := Smalltalk current parse: src.\x0a\x09self should: [analyzer visit: ast] raise: InvalidAssignmentError",
-messageSends: ["parse:", "current", "should:raise:", "visit:"],
+source: "testAssignment\x0a\x09| src ast |\x0a\x0a\x09src := 'foo self := 1'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09self should: [analyzer visit: ast] raise: InvalidAssignmentError",
+messageSends: ["parse:", "should:raise:", "visit:"],
 referencedClasses: ["Smalltalk", "InvalidAssignmentError"]
 }),
 smalltalk.SemanticAnalyzerTest);
@@ -1404,13 +1404,13 @@ var src,ast;
 function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
 return smalltalk.withContext(function($ctx1) { 
 src="foo | a | a + 1. ^ a";
-ast=_st(_st($Smalltalk())._current())._parse_(src);
+ast=_st($Smalltalk())._parse_(src);
 _st(self["@analyzer"])._visit_(ast);
 self._deny_(_st(_st(ast)._scope())._hasNonLocalReturn());
 return self}, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{src:src,ast:ast},smalltalk.SemanticAnalyzerTest)})},
 args: [],
-source: "testNonLocalReturn\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. ^ a'.\x0a\x09ast := Smalltalk current parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self deny: ast scope hasNonLocalReturn",
-messageSends: ["parse:", "current", "visit:", "deny:", "hasNonLocalReturn", "scope"],
+source: "testNonLocalReturn\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. ^ a'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self deny: ast scope hasNonLocalReturn",
+messageSends: ["parse:", "visit:", "deny:", "hasNonLocalReturn", "scope"],
 referencedClasses: ["Smalltalk"]
 }),
 smalltalk.SemanticAnalyzerTest);
@@ -1425,13 +1425,13 @@ var src,ast;
 function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
 return smalltalk.withContext(function($ctx1) { 
 src="foo | a | a + 1. [ [ ^ a] ]";
-ast=_st(_st($Smalltalk())._current())._parse_(src);
+ast=_st($Smalltalk())._parse_(src);
 _st(self["@analyzer"])._visit_(ast);
 self._assert_(_st(_st(ast)._scope())._hasNonLocalReturn());
 return self}, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn2",{src:src,ast:ast},smalltalk.SemanticAnalyzerTest)})},
 args: [],
-source: "testNonLocalReturn2\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ [ ^ a] ]'.\x0a\x09ast := Smalltalk current parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self assert: ast scope hasNonLocalReturn",
-messageSends: ["parse:", "current", "visit:", "assert:", "hasNonLocalReturn", "scope"],
+source: "testNonLocalReturn2\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ [ ^ a] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self assert: ast scope hasNonLocalReturn",
+messageSends: ["parse:", "visit:", "assert:", "hasNonLocalReturn", "scope"],
 referencedClasses: ["Smalltalk"]
 }),
 smalltalk.SemanticAnalyzerTest);
@@ -1447,7 +1447,7 @@ function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"
 return smalltalk.withContext(function($ctx1) { 
 var $4,$3,$2,$1;
 src="foo | a | a + 1. [ | b | b := a ]";
-ast=_st(_st($Smalltalk())._current())._parse_(src);
+ast=_st($Smalltalk())._parse_(src);
 _st(self["@analyzer"])._visit_(ast);
 $4=_st(_st(_st(ast)._nodes())._first())._nodes();
 $ctx1.sendIdx["nodes"]=1;
@@ -1458,8 +1458,8 @@ $1=_st($2).__eq_eq(_st(ast)._scope());
 self._deny_($1);
 return self}, function($ctx1) {$ctx1.fill(self,"testScope",{src:src,ast:ast},smalltalk.SemanticAnalyzerTest)})},
 args: [],
-source: "testScope\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ | b | b := a ]'.\x0a\x09ast := Smalltalk current parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self deny: ast nodes first nodes last scope == ast scope.",
-messageSends: ["parse:", "current", "visit:", "deny:", "==", "scope", "last", "nodes", "first"],
+source: "testScope\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ | b | b := a ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self deny: ast nodes first nodes last scope == ast scope.",
+messageSends: ["parse:", "visit:", "deny:", "==", "scope", "last", "nodes", "first"],
 referencedClasses: ["Smalltalk"]
 }),
 smalltalk.SemanticAnalyzerTest);
@@ -1475,7 +1475,7 @@ function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"
 return smalltalk.withContext(function($ctx1) { 
 var $8,$7,$6,$5,$4,$3,$2,$1;
 src="foo | a | a + 1. [ [ | b | b := a ] ]";
-ast=_st(_st($Smalltalk())._current())._parse_(src);
+ast=_st($Smalltalk())._parse_(src);
 _st(self["@analyzer"])._visit_(ast);
 $8=_st(_st(_st(ast)._nodes())._first())._nodes();
 $ctx1.sendIdx["nodes"]=3;
@@ -1494,8 +1494,8 @@ $1=_st($2).__eq_eq(_st(ast)._scope());
 self._deny_($1);
 return self}, function($ctx1) {$ctx1.fill(self,"testScope2",{src:src,ast:ast},smalltalk.SemanticAnalyzerTest)})},
 args: [],
-source: "testScope2\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ [ | b | b := a ] ]'.\x0a\x09ast := Smalltalk current parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self deny: ast nodes first nodes last nodes first nodes first scope == ast scope.",
-messageSends: ["parse:", "current", "visit:", "deny:", "==", "scope", "first", "nodes", "last"],
+source: "testScope2\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ [ | b | b := a ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self deny: ast nodes first nodes last nodes first nodes first scope == ast scope.",
+messageSends: ["parse:", "visit:", "deny:", "==", "scope", "first", "nodes", "last"],
 referencedClasses: ["Smalltalk"]
 }),
 smalltalk.SemanticAnalyzerTest);
@@ -1511,7 +1511,7 @@ function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"
 return smalltalk.withContext(function($ctx1) { 
 var $2,$1,$10,$9,$8,$7,$6,$5,$4,$3;
 src="foo | a | a + 1. [ [ | b | b := a ] ]";
-ast=_st(_st($Smalltalk())._current())._parse_(src);
+ast=_st($Smalltalk())._parse_(src);
 _st(self["@analyzer"])._visit_(ast);
 $2=_st(ast)._scope();
 $ctx1.sendIdx["scope"]=1;
@@ -1535,8 +1535,8 @@ $3=_st($4)._scopeLevel();
 self._assert_equals_($3,(3));
 return self}, function($ctx1) {$ctx1.fill(self,"testScopeLevel",{src:src,ast:ast},smalltalk.SemanticAnalyzerTest)})},
 args: [],
-source: "testScopeLevel\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ [ | b | b := a ] ]'.\x0a\x09ast := Smalltalk current parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self assert: ast scope scopeLevel equals: 1.\x0a\x09self assert: ast nodes first nodes last nodes first nodes first scope scopeLevel equals: 3",
-messageSends: ["parse:", "current", "visit:", "assert:equals:", "scopeLevel", "scope", "first", "nodes", "last"],
+source: "testScopeLevel\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ [ | b | b := a ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09self assert: ast scope scopeLevel equals: 1.\x0a\x09self assert: ast nodes first nodes last nodes first nodes first scope scopeLevel equals: 3",
+messageSends: ["parse:", "visit:", "assert:equals:", "scopeLevel", "scope", "first", "nodes", "last"],
 referencedClasses: ["Smalltalk"]
 }),
 smalltalk.SemanticAnalyzerTest);
@@ -1552,15 +1552,15 @@ function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"
 function $UnknownVariableError(){return smalltalk.UnknownVariableError||(typeof UnknownVariableError=="undefined"?nil:UnknownVariableError)}
 return smalltalk.withContext(function($ctx1) { 
 src="foo | a | b + a";
-ast=_st(_st($Smalltalk())._current())._parse_(src);
+ast=_st($Smalltalk())._parse_(src);
 self._should_raise_((function(){
 return smalltalk.withContext(function($ctx2) {
 return _st(self["@analyzer"])._visit_(ast);
 }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$UnknownVariableError());
 return self}, function($ctx1) {$ctx1.fill(self,"testUnknownVariables",{src:src,ast:ast},smalltalk.SemanticAnalyzerTest)})},
 args: [],
-source: "testUnknownVariables\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | b + a'.\x0a\x09ast := Smalltalk current parse: src.\x0a\x0a\x09self should: [ analyzer visit: ast ] raise: UnknownVariableError",
-messageSends: ["parse:", "current", "should:raise:", "visit:"],
+source: "testUnknownVariables\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | b + a'.\x0a\x09ast := Smalltalk parse: src.\x0a\x0a\x09self should: [ analyzer visit: ast ] raise: UnknownVariableError",
+messageSends: ["parse:", "should:raise:", "visit:"],
 referencedClasses: ["Smalltalk", "UnknownVariableError"]
 }),
 smalltalk.SemanticAnalyzerTest);
@@ -1576,15 +1576,15 @@ function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"
 function $UnknownVariableError(){return smalltalk.UnknownVariableError||(typeof UnknownVariableError=="undefined"?nil:UnknownVariableError)}
 return smalltalk.withContext(function($ctx1) { 
 src="foo | a b | [ c + 1. [ a + 1. d + 1 ]]";
-ast=_st(_st($Smalltalk())._current())._parse_(src);
+ast=_st($Smalltalk())._parse_(src);
 self._should_raise_((function(){
 return smalltalk.withContext(function($ctx2) {
 return _st(self["@analyzer"])._visit_(ast);
 }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$UnknownVariableError());
 return self}, function($ctx1) {$ctx1.fill(self,"testUnknownVariablesWithScope",{src:src,ast:ast},smalltalk.SemanticAnalyzerTest)})},
 args: [],
-source: "testUnknownVariablesWithScope\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a b | [ c + 1. [ a + 1. d + 1 ]]'.\x0a\x09ast := Smalltalk current parse: src.\x0a\x09\x0a\x09self should: [ analyzer visit: ast ] raise: UnknownVariableError",
-messageSends: ["parse:", "current", "should:raise:", "visit:"],
+source: "testUnknownVariablesWithScope\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a b | [ c + 1. [ a + 1. d + 1 ]]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09\x0a\x09self should: [ analyzer visit: ast ] raise: UnknownVariableError",
+messageSends: ["parse:", "should:raise:", "visit:"],
 referencedClasses: ["Smalltalk", "UnknownVariableError"]
 }),
 smalltalk.SemanticAnalyzerTest);
@@ -1599,12 +1599,12 @@ var src,ast;
 function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
 return smalltalk.withContext(function($ctx1) { 
 src="foo | a | a + 1";
-ast=_st(_st($Smalltalk())._current())._parse_(src);
+ast=_st($Smalltalk())._parse_(src);
 _st(self["@analyzer"])._visit_(ast);
 return self}, function($ctx1) {$ctx1.fill(self,"testVariableShadowing",{src:src,ast:ast},smalltalk.SemanticAnalyzerTest)})},
 args: [],
-source: "testVariableShadowing\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1'.\x0a\x09ast := Smalltalk current parse: src.\x0a\x09analyzer visit: ast",
-messageSends: ["parse:", "current", "visit:"],
+source: "testVariableShadowing\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
+messageSends: ["parse:", "visit:"],
 referencedClasses: ["Smalltalk"]
 }),
 smalltalk.SemanticAnalyzerTest);
@@ -1620,15 +1620,15 @@ function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"
 function $ShadowingVariableError(){return smalltalk.ShadowingVariableError||(typeof ShadowingVariableError=="undefined"?nil:ShadowingVariableError)}
 return smalltalk.withContext(function($ctx1) { 
 src="foo | a | a + 1. [ | a | a := 2 ]";
-ast=_st(_st($Smalltalk())._current())._parse_(src);
+ast=_st($Smalltalk())._parse_(src);
 self._should_raise_((function(){
 return smalltalk.withContext(function($ctx2) {
 return _st(self["@analyzer"])._visit_(ast);
 }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$ShadowingVariableError());
 return self}, function($ctx1) {$ctx1.fill(self,"testVariableShadowing2",{src:src,ast:ast},smalltalk.SemanticAnalyzerTest)})},
 args: [],
-source: "testVariableShadowing2\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ | a | a := 2 ]'.\x0a\x09ast := Smalltalk current parse: src.\x0a\x09self should: [analyzer visit: ast] raise: ShadowingVariableError",
-messageSends: ["parse:", "current", "should:raise:", "visit:"],
+source: "testVariableShadowing2\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ | a | a := 2 ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09self should: [analyzer visit: ast] raise: ShadowingVariableError",
+messageSends: ["parse:", "should:raise:", "visit:"],
 referencedClasses: ["Smalltalk", "ShadowingVariableError"]
 }),
 smalltalk.SemanticAnalyzerTest);
@@ -1643,12 +1643,12 @@ var src,ast;
 function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
 return smalltalk.withContext(function($ctx1) { 
 src="foo | a | a + 1. [ | b | b := 2 ]";
-ast=_st(_st($Smalltalk())._current())._parse_(src);
+ast=_st($Smalltalk())._parse_(src);
 _st(self["@analyzer"])._visit_(ast);
 return self}, function($ctx1) {$ctx1.fill(self,"testVariableShadowing3",{src:src,ast:ast},smalltalk.SemanticAnalyzerTest)})},
 args: [],
-source: "testVariableShadowing3\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ | b | b := 2 ]'.\x0a\x09ast := Smalltalk current parse: src.\x0a\x09analyzer visit: ast",
-messageSends: ["parse:", "current", "visit:"],
+source: "testVariableShadowing3\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ | b | b := 2 ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
+messageSends: ["parse:", "visit:"],
 referencedClasses: ["Smalltalk"]
 }),
 smalltalk.SemanticAnalyzerTest);
@@ -1663,12 +1663,12 @@ var src,ast;
 function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
 return smalltalk.withContext(function($ctx1) { 
 src="foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]";
-ast=_st(_st($Smalltalk())._current())._parse_(src);
+ast=_st($Smalltalk())._parse_(src);
 _st(self["@analyzer"])._visit_(ast);
 return self}, function($ctx1) {$ctx1.fill(self,"testVariableShadowing4",{src:src,ast:ast},smalltalk.SemanticAnalyzerTest)})},
 args: [],
-source: "testVariableShadowing4\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]'.\x0a\x09ast := Smalltalk current parse: src.\x0a\x09analyzer visit: ast",
-messageSends: ["parse:", "current", "visit:"],
+source: "testVariableShadowing4\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
+messageSends: ["parse:", "visit:"],
 referencedClasses: ["Smalltalk"]
 }),
 smalltalk.SemanticAnalyzerTest);
@@ -1684,15 +1684,15 @@ function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"
 function $ShadowingVariableError(){return smalltalk.ShadowingVariableError||(typeof ShadowingVariableError=="undefined"?nil:ShadowingVariableError)}
 return smalltalk.withContext(function($ctx1) { 
 src="foo | a | a + 1. [ [ [ | a | a := 2 ] ] ]";
-ast=_st(_st($Smalltalk())._current())._parse_(src);
+ast=_st($Smalltalk())._parse_(src);
 self._should_raise_((function(){
 return smalltalk.withContext(function($ctx2) {
 return _st(self["@analyzer"])._visit_(ast);
 }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$ShadowingVariableError());
 return self}, function($ctx1) {$ctx1.fill(self,"testVariableShadowing5",{src:src,ast:ast},smalltalk.SemanticAnalyzerTest)})},
 args: [],
-source: "testVariableShadowing5\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ [ [ | a | a := 2 ] ] ]'.\x0a\x09ast := Smalltalk current parse: src.\x0a\x09self should: [analyzer visit: ast] raise: ShadowingVariableError",
-messageSends: ["parse:", "current", "should:raise:", "visit:"],
+source: "testVariableShadowing5\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ [ [ | a | a := 2 ] ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09self should: [analyzer visit: ast] raise: ShadowingVariableError",
+messageSends: ["parse:", "should:raise:", "visit:"],
 referencedClasses: ["Smalltalk", "ShadowingVariableError"]
 }),
 smalltalk.SemanticAnalyzerTest);
@@ -1708,7 +1708,7 @@ function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"
 return smalltalk.withContext(function($ctx1) { 
 var $7,$6,$5,$4,$3,$2,$1,$15,$14,$13,$12,$11,$10,$9,$16,$8,$27,$26,$25,$24,$23,$22,$21,$20,$19,$18,$17,$39,$38,$37,$36,$35,$34,$33,$32,$31,$30,$29,$42,$41,$40,$28;
 src="foo | a | a + 1. [ | b | b := a ]";
-ast=_st(_st($Smalltalk())._current())._parse_(src);
+ast=_st($Smalltalk())._parse_(src);
 _st(self["@analyzer"])._visit_(ast);
 $7=_st(ast)._nodes();
 $ctx1.sendIdx["nodes"]=2;
@@ -1796,8 +1796,8 @@ $28=_st($29).__eq_eq($40);
 self._assert_($28);
 return self}, function($ctx1) {$ctx1.fill(self,"testVariablesLookup",{src:src,ast:ast},smalltalk.SemanticAnalyzerTest)})},
 args: [],
-source: "testVariablesLookup\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ | b | b := a ]'.\x0a\x09ast := Smalltalk current parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09\x22Binding for `a` in the message send\x22\x0a\x09self assert: ast nodes first nodes first receiver binding isTempVar.\x0a\x09self assert: ast nodes first nodes first receiver binding scope == ast scope.\x0a\x0a\x09\x22Binding for `b`\x22\x0a\x09self assert: ast nodes first nodes last nodes first nodes first left binding isTempVar.\x0a\x09self assert: ast nodes first nodes last nodes first nodes first left binding scope == ast nodes first nodes last scope.",
-messageSends: ["parse:", "current", "visit:", "assert:", "isTempVar", "binding", "receiver", "first", "nodes", "==", "scope", "left", "last"],
+source: "testVariablesLookup\x0a\x09| src ast |\x0a\x0a\x09src := 'foo | a | a + 1. [ | b | b := a ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast.\x0a\x0a\x09\x22Binding for `a` in the message send\x22\x0a\x09self assert: ast nodes first nodes first receiver binding isTempVar.\x0a\x09self assert: ast nodes first nodes first receiver binding scope == ast scope.\x0a\x0a\x09\x22Binding for `b`\x22\x0a\x09self assert: ast nodes first nodes last nodes first nodes first left binding isTempVar.\x0a\x09self assert: ast nodes first nodes last nodes first nodes first left binding scope == ast nodes first nodes last scope.",
+messageSends: ["parse:", "visit:", "assert:", "isTempVar", "binding", "receiver", "first", "nodes", "==", "scope", "left", "last"],
 referencedClasses: ["Smalltalk"]
 }),
 smalltalk.SemanticAnalyzerTest);

+ 22 - 14
js/Helios-Core.js

@@ -3432,10 +3432,10 @@ selector: "defaultEnvironment",
 protocol: 'defaults',
 fn: function (){
 var self=this;
-var parent,parentSmalltalk;
+var parent,parentSmalltalkGlobals;
 function $Environment(){return smalltalk.Environment||(typeof Environment=="undefined"?nil:Environment)}
 return smalltalk.withContext(function($ctx1) { 
-var $1,$2,$3,$4,$5,$6,$7;
+var $1,$2,$3,$5,$4,$6,$7,$8;
 $1=_st(window)._opener();
 if(($receiver = $1) == nil || $receiver == null){
 parent=_st(window)._parent();
@@ -3450,23 +3450,31 @@ return $3;
 } else {
 $2;
 };
-$4=_st(parent)._at_("requirejs");
+$5=_st(parent)._at_("requirejs");
 $ctx1.sendIdx["at:"]=1;
-parentSmalltalk=_st($4)._value_("amber_vm/smalltalk");
-$5=parentSmalltalk;
-if(($receiver = $5) == nil || $receiver == null){
-$6=_st($Environment())._new();
-$ctx1.sendIdx["new"]=2;
-return $6;
+$4=_st($5)._value_("amber_vm/boot");
+if(($receiver = $4) == nil || $receiver == null){
+parentSmalltalkGlobals=$4;
 } else {
-$5;
+var boot;
+boot=$receiver;
+parentSmalltalkGlobals=_st(boot)._at_("globals");
+$ctx1.sendIdx["at:"]=2;
 };
-$7=_st(_st(parentSmalltalk)._at_("Environment"))._new();
+$6=parentSmalltalkGlobals;
+if(($receiver = $6) == nil || $receiver == null){
+$7=_st($Environment())._new();
+$ctx1.sendIdx["new"]=2;
 return $7;
-}, function($ctx1) {$ctx1.fill(self,"defaultEnvironment",{parent:parent,parentSmalltalk:parentSmalltalk},smalltalk.HLManager)})},
+} else {
+$6;
+};
+$8=_st(_st(parentSmalltalkGlobals)._at_("Environment"))._new();
+return $8;
+}, function($ctx1) {$ctx1.fill(self,"defaultEnvironment",{parent:parent,parentSmalltalkGlobals:parentSmalltalkGlobals},smalltalk.HLManager)})},
 args: [],
-source: "defaultEnvironment\x0a\x09\x22If helios is loaded from within a frame, answer the parent window environment\x22\x0a\x09\x0a\x09| parent parentSmalltalk |\x0a\x09\x0a\x09parent := window opener ifNil: [ window parent ].\x0a\x09parent ifNil: [ ^ Environment new ].\x0a\x09\x0a\x09parentSmalltalk := (parent at: 'requirejs') value: 'amber_vm/smalltalk'.\x0a\x09parentSmalltalk ifNil: [ ^ Environment new ].\x0a\x09\x0a\x09^ (parentSmalltalk at: 'Environment') new",
-messageSends: ["ifNil:", "opener", "parent", "new", "value:", "at:"],
+source: "defaultEnvironment\x0a\x09\x22If helios is loaded from within a frame, answer the parent window environment\x22\x0a\x09\x0a\x09| parent parentSmalltalkGlobals |\x0a\x09\x0a\x09parent := window opener ifNil: [ window parent ].\x0a\x09parent ifNil: [ ^ Environment new ].\x0a\x09\x0a\x09parentSmalltalkGlobals := ((parent at: 'requirejs') value: 'amber_vm/boot')\x0a\x09\x09ifNotNil: [ :boot | boot at: 'globals' ].\x0a\x09parentSmalltalkGlobals ifNil: [ ^ Environment new ].\x0a\x09\x0a\x09^ (parentSmalltalkGlobals at: 'Environment') new",
+messageSends: ["ifNil:", "opener", "parent", "new", "ifNotNil:", "value:", "at:"],
 referencedClasses: ["Environment"]
 }),
 smalltalk.HLManager);

+ 16 - 19
js/Helios-Workspace.js

@@ -506,7 +506,7 @@ var self=this;
 function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
 return smalltalk.withContext(function($ctx1) { 
 var $2,$1;
-$1=_st(_st(_st(_st(_st(_st($Smalltalk())._current())._at_("allSelectors"))._value())._asArray())._select_((function(each){
+$1=_st(_st(_st(_st(_st($Smalltalk())._vm())._allSelectors())._asArray())._select_((function(each){
 return smalltalk.withContext(function($ctx2) {
 $2=_st(aToken)._string();
 $ctx2.sendIdx["string"]=1;
@@ -518,8 +518,8 @@ return _st(each).__eq(_st(aToken)._string());
 return $1;
 }, function($ctx1) {$ctx1.fill(self,"messageHintFor:token:",{anEditor:anEditor,aToken:aToken},smalltalk.HLCodeWidget)})},
 args: ["anEditor", "aToken"],
-source: "messageHintFor: anEditor token: aToken\x0a\x09^ ((Smalltalk current at: 'allSelectors') value asArray \x0a\x09\x09select: [ :each | each includesSubString: aToken string ])\x0a\x09\x09reject: [ :each | each = aToken string ]",
-messageSends: ["reject:", "select:", "asArray", "value", "at:", "current", "includesSubString:", "string", "="],
+source: "messageHintFor: anEditor token: aToken\x0a\x09^ (Smalltalk vm allSelectors asArray \x0a\x09\x09select: [ :each | each includesSubString: aToken string ])\x0a\x09\x09reject: [ :each | each = aToken string ]",
+messageSends: ["reject:", "select:", "asArray", "allSelectors", "vm", "includesSubString:", "string", "="],
 referencedClasses: ["Smalltalk"]
 }),
 smalltalk.HLCodeWidget);
@@ -995,7 +995,7 @@ var self=this;
 var variables,classNames,pseudoVariables;
 function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
 return smalltalk.withContext(function($ctx1) { 
-var $3,$2,$1,$5,$4,$10,$9,$8,$11,$7,$6;
+var $3,$2,$1,$8,$7,$6,$9,$5,$4;
 $3=_st(_st(_st(anEditor)._display())._wrapper())._asJQuery();
 $ctx1.sendIdx["asJQuery"]=1;
 $2=_st($3)._find_("span.cm-variable");
@@ -1005,33 +1005,30 @@ return smalltalk.withContext(function($ctx2) {
 return _st(_st(each)._asJQuery())._html();
 }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
 $ctx1.sendIdx["collect:"]=1;
-$5=_st($Smalltalk())._current();
-$ctx1.sendIdx["current"]=1;
-$4=_st($5)._classes();
-classNames=_st($4)._collect_((function(each){
+classNames=_st(_st($Smalltalk())._classes())._collect_((function(each){
 return smalltalk.withContext(function($ctx2) {
 return _st(each)._name();
 }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
-pseudoVariables=_st(_st($Smalltalk())._current())._pseudoVariableNames();
-$10=_st(_st(variables).__comma(classNames)).__comma(pseudoVariables);
+pseudoVariables=_st($Smalltalk())._pseudoVariableNames();
+$8=_st(_st(variables).__comma(classNames)).__comma(pseudoVariables);
 $ctx1.sendIdx[","]=1;
-$9=_st($10)._asSet();
-$8=_st($9)._asArray();
-$7=_st($8)._select_((function(each){
+$7=_st($8)._asSet();
+$6=_st($7)._asArray();
+$5=_st($6)._select_((function(each){
 return smalltalk.withContext(function($ctx2) {
-$11=_st(aToken)._string();
+$9=_st(aToken)._string();
 $ctx2.sendIdx["string"]=1;
-return _st(each)._includesSubString_($11);
+return _st(each)._includesSubString_($9);
 }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
-$6=_st($7)._reject_((function(each){
+$4=_st($5)._reject_((function(each){
 return smalltalk.withContext(function($ctx2) {
 return _st(each).__eq(_st(aToken)._string());
 }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)})}));
-return $6;
+return $4;
 }, function($ctx1) {$ctx1.fill(self,"variableHintFor:token:",{anEditor:anEditor,aToken:aToken,variables:variables,classNames:classNames,pseudoVariables:pseudoVariables},smalltalk.HLCodeWidget)})},
 args: ["anEditor", "aToken"],
-source: "variableHintFor: anEditor token: aToken\x0a\x09| variables classNames pseudoVariables |\x0a\x09\x0a\x09variables := (anEditor display wrapper asJQuery find: 'span.cm-variable') get\x0a\x09\x09collect: [ :each | each asJQuery html ].\x0a\x09\x0a\x09classNames := Smalltalk current classes collect: [ :each | each name ].\x0a\x09pseudoVariables := Smalltalk current pseudoVariableNames.\x0a\x09\x0a\x09^ ((variables, classNames, pseudoVariables) asSet asArray \x0a\x09\x09select: [ :each | each includesSubString: aToken string ])\x0a\x09\x09reject: [ :each | each = aToken string ]",
-messageSends: ["collect:", "get", "find:", "asJQuery", "wrapper", "display", "html", "classes", "current", "name", "pseudoVariableNames", "reject:", "select:", "asArray", "asSet", ",", "includesSubString:", "string", "="],
+source: "variableHintFor: anEditor token: aToken\x0a\x09| variables classNames pseudoVariables |\x0a\x09\x0a\x09variables := (anEditor display wrapper asJQuery find: 'span.cm-variable') get\x0a\x09\x09collect: [ :each | each asJQuery html ].\x0a\x09\x0a\x09classNames := Smalltalk classes collect: [ :each | each name ].\x0a\x09pseudoVariables := Smalltalk pseudoVariableNames.\x0a\x09\x0a\x09^ ((variables, classNames, pseudoVariables) asSet asArray \x0a\x09\x09select: [ :each | each includesSubString: aToken string ])\x0a\x09\x09reject: [ :each | each = aToken string ]",
+messageSends: ["collect:", "get", "find:", "asJQuery", "wrapper", "display", "html", "classes", "name", "pseudoVariableNames", "reject:", "select:", "asArray", "asSet", ",", "includesSubString:", "string", "="],
 referencedClasses: ["Smalltalk"]
 }),
 smalltalk.HLCodeWidget);

+ 32 - 34
js/IDE.js

@@ -1518,7 +1518,7 @@ function $Browser(){return smalltalk.Browser||(typeof Browser=="undefined"?nil:B
 function $ReferencesBrowser(){return smalltalk.ReferencesBrowser||(typeof ReferencesBrowser=="undefined"?nil:ReferencesBrowser)}
 return smalltalk.withContext(function($ctx1) { 
 var $1;
-searchedClass=_st(_st($Smalltalk())._current())._at_(aString);
+searchedClass=_st(_st($Smalltalk())._globals())._at_(aString);
 $1=_st(searchedClass)._isClass();
 if(smalltalk.assert($1)){
 _st($Browser())._openOn_(searchedClass);
@@ -1527,8 +1527,8 @@ _st($ReferencesBrowser())._search_(aString);
 };
 return self}, function($ctx1) {$ctx1.fill(self,"search:",{aString:aString,searchedClass:searchedClass},smalltalk.TabManager)})},
 args: ["aString"],
-source: "search: aString\x0a\x09| searchedClass |\x0a\x09searchedClass := Smalltalk current at: aString.\x0a\x09\x09searchedClass isClass\x0a\x09\x09\x09ifTrue: [ Browser openOn: searchedClass ]\x0a\x09\x09\x09ifFalse: [ ReferencesBrowser search: aString ]",
-messageSends: ["at:", "current", "ifTrue:ifFalse:", "isClass", "openOn:", "search:"],
+source: "search: aString\x0a\x09| searchedClass |\x0a\x09searchedClass := Smalltalk globals at: aString.\x0a\x09\x09searchedClass isClass\x0a\x09\x09\x09ifTrue: [ Browser openOn: searchedClass ]\x0a\x09\x09\x09ifFalse: [ ReferencesBrowser search: aString ]",
+messageSends: ["at:", "globals", "ifTrue:ifFalse:", "isClass", "openOn:", "search:"],
 referencedClasses: ["Smalltalk", "Browser", "ReferencesBrowser"]
 }),
 smalltalk.TabManager);
@@ -2016,12 +2016,12 @@ _st($Object())._subclass_instanceVariableNames_package_(className,"",self._selec
 self._resetClassesList();
 $2=self._updateClassesList();
 $2;
-self._selectClass_(_st(_st($Smalltalk())._current())._at_(className));
+self._selectClass_(_st(_st($Smalltalk())._globals())._at_(className));
 };
 return self}, function($ctx1) {$ctx1.fill(self,"addNewClass",{className:className},smalltalk.Browser)})},
 args: [],
-source: "addNewClass\x0a\x09| className |\x0a\x09className := self prompt: 'New class'.\x0a\x09(className notNil and: [ className notEmpty ]) ifTrue: [\x0a\x09\x09Object subclass: className instanceVariableNames: '' package: self selectedPackage.\x0a\x09\x09\x09self\x0a\x09\x09\x09resetClassesList;\x0a\x09\x09\x09updateClassesList.\x0a\x09\x09self selectClass: (Smalltalk current at: className) ]",
-messageSends: ["prompt:", "ifTrue:", "and:", "notNil", "notEmpty", "subclass:instanceVariableNames:package:", "selectedPackage", "resetClassesList", "updateClassesList", "selectClass:", "at:", "current"],
+source: "addNewClass\x0a\x09| className |\x0a\x09className := self prompt: 'New class'.\x0a\x09(className notNil and: [ className notEmpty ]) ifTrue: [\x0a\x09\x09Object subclass: className instanceVariableNames: '' package: self selectedPackage.\x0a\x09\x09\x09self\x0a\x09\x09\x09resetClassesList;\x0a\x09\x09\x09updateClassesList.\x0a\x09\x09self selectClass: (Smalltalk globals at: className) ]",
+messageSends: ["prompt:", "ifTrue:", "and:", "notNil", "notEmpty", "subclass:instanceVariableNames:package:", "selectedPackage", "resetClassesList", "updateClassesList", "selectClass:", "at:", "globals"],
 referencedClasses: ["Object", "Smalltalk"]
 }),
 smalltalk.Browser);
@@ -2203,7 +2203,7 @@ var self=this;
 function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
 return smalltalk.withContext(function($ctx1) { 
 var $2,$1;
-$1=_st(_st(_st(_st(_st($Smalltalk())._current())._classes())._select_((function(each){
+$1=_st(_st(_st(_st($Smalltalk())._classes())._select_((function(each){
 return smalltalk.withContext(function($ctx2) {
 return _st(_st(each)._category()).__eq(self["@selectedPackage"]);
 }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})))._sort_((function(a,b){
@@ -2215,8 +2215,8 @@ return _st($2).__lt(_st(b)._name());
 return $1;
 }, function($ctx1) {$ctx1.fill(self,"classes",{},smalltalk.Browser)})},
 args: [],
-source: "classes\x0a\x09^ ((Smalltalk current classes\x0a\x09select: [ :each | each category = selectedPackage ])\x0a\x09sort: [ :a :b | a name < b name ]) asSet",
-messageSends: ["asSet", "sort:", "select:", "classes", "current", "=", "category", "<", "name"],
+source: "classes\x0a\x09^ ((Smalltalk classes\x0a\x09select: [ :each | each category = selectedPackage ])\x0a\x09sort: [ :a :b | a name < b name ]) asSet",
+messageSends: ["asSet", "sort:", "select:", "classes", "=", "category", "<", "name"],
 referencedClasses: ["Smalltalk"]
 }),
 smalltalk.Browser);
@@ -2436,12 +2436,12 @@ _st(_st($ClassBuilder())._new())._copyClass_named_(self._selectedClass(),classNa
 self._resetClassesList();
 $2=self._updateClassesList();
 $2;
-self._selectClass_(_st(_st($Smalltalk())._current())._at_(className));
+self._selectClass_(_st(_st($Smalltalk())._globals())._at_(className));
 };
 return self}, function($ctx1) {$ctx1.fill(self,"copyClass",{className:className},smalltalk.Browser)})},
 args: [],
-source: "copyClass\x0a\x09| className |\x0a\x09className := self prompt: 'Copy class'.\x0a\x09(className notNil and: [ className notEmpty ]) ifTrue: [\x0a\x09\x09ClassBuilder new copyClass: self selectedClass named: className.\x0a\x09\x09\x09self\x0a\x09\x09\x09resetClassesList;\x0a\x09\x09\x09updateClassesList.\x0a\x09\x09self selectClass: (Smalltalk current at: className) ]",
-messageSends: ["prompt:", "ifTrue:", "and:", "notNil", "notEmpty", "copyClass:named:", "new", "selectedClass", "resetClassesList", "updateClassesList", "selectClass:", "at:", "current"],
+source: "copyClass\x0a\x09| className |\x0a\x09className := self prompt: 'Copy class'.\x0a\x09(className notNil and: [ className notEmpty ]) ifTrue: [\x0a\x09\x09ClassBuilder new copyClass: self selectedClass named: className.\x0a\x09\x09\x09self\x0a\x09\x09\x09resetClassesList;\x0a\x09\x09\x09updateClassesList.\x0a\x09\x09self selectClass: (Smalltalk globals at: className) ]",
+messageSends: ["prompt:", "ifTrue:", "and:", "notNil", "notEmpty", "copyClass:named:", "new", "selectedClass", "resetClassesList", "updateClassesList", "selectClass:", "at:", "globals"],
 referencedClasses: ["ClassBuilder", "Smalltalk"]
 }),
 smalltalk.Browser);
@@ -2736,7 +2736,7 @@ function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"
 return smalltalk.withContext(function($ctx1) { 
 var $2,$3,$1,$4;
 packages=_st($Array())._new();
-_st(_st(_st($Smalltalk())._current())._classes())._do_((function(each){
+_st(_st($Smalltalk())._classes())._do_((function(each){
 return smalltalk.withContext(function($ctx2) {
 $2=packages;
 $3=_st(each)._category();
@@ -2750,8 +2750,8 @@ $4=_st(packages)._sort();
 return $4;
 }, function($ctx1) {$ctx1.fill(self,"packages",{packages:packages},smalltalk.Browser)})},
 args: [],
-source: "packages\x0a\x09| packages |\x0a\x09packages := Array new.\x0a\x09Smalltalk current classes do: [ :each |\x0a\x09(packages includes: each category) ifFalse: [\x0a\x09\x09packages add: each category ]].\x0a\x09^ packages sort",
-messageSends: ["new", "do:", "classes", "current", "ifFalse:", "includes:", "category", "add:", "sort"],
+source: "packages\x0a\x09| packages |\x0a\x09packages := Array new.\x0a\x09Smalltalk classes do: [ :each |\x0a\x09(packages includes: each category) ifFalse: [\x0a\x09\x09packages add: each category ]].\x0a\x09^ packages sort",
+messageSends: ["new", "do:", "classes", "ifFalse:", "includes:", "category", "add:", "sort"],
 referencedClasses: ["Array", "Smalltalk"]
 }),
 smalltalk.Browser);
@@ -2814,14 +2814,14 @@ $2=_st("Do you really want to remove ".__comma(_st(self["@selectedClass"])._name
 $ctx1.sendIdx[","]=1;
 $1=self._confirm_($2);
 if(smalltalk.assert($1)){
-_st(_st($Smalltalk())._current())._removeClass_(self["@selectedClass"]);
+_st($Smalltalk())._removeClass_(self["@selectedClass"]);
 self._resetClassesList();
 self._selectClass_(nil);
 };
 return self}, function($ctx1) {$ctx1.fill(self,"removeClass",{},smalltalk.Browser)})},
 args: [],
-source: "removeClass\x0a\x09(self confirm: 'Do you really want to remove ', selectedClass name, '?')\x0a\x09ifTrue: [\x0a\x09\x09Smalltalk current removeClass: selectedClass.\x0a\x09\x09self resetClassesList.\x0a\x09\x09self selectClass: nil ]",
-messageSends: ["ifTrue:", "confirm:", ",", "name", "removeClass:", "current", "resetClassesList", "selectClass:"],
+source: "removeClass\x0a\x09(self confirm: 'Do you really want to remove ', selectedClass name, '?')\x0a\x09ifTrue: [\x0a\x09\x09Smalltalk removeClass: selectedClass.\x0a\x09\x09self resetClassesList.\x0a\x09\x09self selectClass: nil ]",
+messageSends: ["ifTrue:", "confirm:", ",", "name", "removeClass:", "resetClassesList", "selectClass:"],
 referencedClasses: ["Smalltalk"]
 }),
 smalltalk.Browser);
@@ -2871,13 +2871,13 @@ $2=_st("Do you really want to remove the whole package ".__comma(self["@selected
 $ctx1.sendIdx[","]=1;
 $1=self._confirm_($2);
 if(smalltalk.assert($1)){
-_st(_st($Smalltalk())._current())._removePackage_(self["@selectedPackage"]);
+_st($Smalltalk())._removePackage_(self["@selectedPackage"]);
 self._updateCategoriesList();
 };
 return self}, function($ctx1) {$ctx1.fill(self,"removePackage",{},smalltalk.Browser)})},
 args: [],
-source: "removePackage\x0a\x0a\x09(self confirm: 'Do you really want to remove the whole package ', selectedPackage, ' with all its classes?')\x0a\x09ifTrue: [\x0a\x09\x09Smalltalk current removePackage: selectedPackage.\x0a\x09\x09self updateCategoriesList ]",
-messageSends: ["ifTrue:", "confirm:", ",", "removePackage:", "current", "updateCategoriesList"],
+source: "removePackage\x0a\x0a\x09(self confirm: 'Do you really want to remove the whole package ', selectedPackage, ' with all its classes?')\x0a\x09ifTrue: [\x0a\x09\x09Smalltalk removePackage: selectedPackage.\x0a\x09\x09self updateCategoriesList ]",
+messageSends: ["ifTrue:", "confirm:", ",", "removePackage:", "updateCategoriesList"],
 referencedClasses: ["Smalltalk"]
 }),
 smalltalk.Browser);
@@ -2927,14 +2927,14 @@ $1;
 } else {
 $2=_st(newName)._notEmpty();
 if(smalltalk.assert($2)){
-_st(_st($Smalltalk())._current())._renamePackage_to_(self["@selectedPackage"],newName);
+_st($Smalltalk())._renamePackage_to_(self["@selectedPackage"],newName);
 self._updateCategoriesList();
 };
 };
 return self}, function($ctx1) {$ctx1.fill(self,"renamePackage",{newName:newName},smalltalk.Browser)})},
 args: [],
-source: "renamePackage\x0a\x0a\x09| newName |\x0a\x09newName := self prompt: 'Rename package ', selectedPackage.\x0a\x09newName ifNotNil: [\x0a\x09newName notEmpty ifTrue: [\x0a\x09Smalltalk current renamePackage: selectedPackage to: newName.\x0a\x09self updateCategoriesList ]]",
-messageSends: ["prompt:", ",", "ifNotNil:", "ifTrue:", "notEmpty", "renamePackage:to:", "current", "updateCategoriesList"],
+source: "renamePackage\x0a\x0a\x09| newName |\x0a\x09newName := self prompt: 'Rename package ', selectedPackage.\x0a\x09newName ifNotNil: [\x0a\x09newName notEmpty ifTrue: [\x0a\x09Smalltalk renamePackage: selectedPackage to: newName.\x0a\x09self updateCategoriesList ]]",
+messageSends: ["prompt:", ",", "ifNotNil:", "ifTrue:", "notEmpty", "renamePackage:to:", "updateCategoriesList"],
 referencedClasses: ["Smalltalk"]
 }),
 smalltalk.Browser);
@@ -3187,7 +3187,7 @@ var $1,$2;
 $1=self._cancelChanges();
 if(smalltalk.assert($1)){
 var searchedClass;
-searchedClass=_st(_st($Smalltalk())._current())._at_(aString);
+searchedClass=_st(_st($Smalltalk())._globals())._at_(aString);
 searchedClass;
 $2=_st(searchedClass)._isClass();
 if(smalltalk.assert($2)){
@@ -3198,8 +3198,8 @@ self._searchReferencesOf_(aString);
 };
 return self}, function($ctx1) {$ctx1.fill(self,"search:",{aString:aString},smalltalk.Browser)})},
 args: ["aString"],
-source: "search: aString\x0a\x09self cancelChanges ifTrue: [ | searchedClass |\x0a\x09\x09searchedClass := Smalltalk current at: aString.\x0a\x09\x09searchedClass isClass\x0a\x09\x09\x09ifTrue: [ self class openOn: searchedClass ]\x0a\x09\x09\x09ifFalse: [ self searchReferencesOf: aString ]]",
-messageSends: ["ifTrue:", "cancelChanges", "at:", "current", "ifTrue:ifFalse:", "isClass", "openOn:", "class", "searchReferencesOf:"],
+source: "search: aString\x0a\x09self cancelChanges ifTrue: [ | searchedClass |\x0a\x09\x09searchedClass := Smalltalk globals at: aString.\x0a\x09\x09searchedClass isClass\x0a\x09\x09\x09ifTrue: [ self class openOn: searchedClass ]\x0a\x09\x09\x09ifFalse: [ self searchReferencesOf: aString ]]",
+messageSends: ["ifTrue:", "cancelChanges", "at:", "globals", "ifTrue:ifFalse:", "isClass", "openOn:", "class", "searchReferencesOf:"],
 referencedClasses: ["Smalltalk"]
 }),
 smalltalk.Browser);
@@ -5557,20 +5557,18 @@ fn: function (){
 var self=this;
 function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
 return smalltalk.withContext(function($ctx1) { 
-var $3,$2,$1;
-$3=_st($Smalltalk())._current();
-$ctx1.sendIdx["current"]=1;
-$2=_st($3)._classes();
+var $2,$1;
+$2=_st($Smalltalk())._classes();
 $ctx1.sendIdx["classes"]=1;
-$1=_st($2).__comma(_st(_st(_st($Smalltalk())._current())._classes())._collect_((function(each){
+$1=_st($2).__comma(_st(_st($Smalltalk())._classes())._collect_((function(each){
 return smalltalk.withContext(function($ctx2) {
 return _st(each)._class();
 }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})));
 return $1;
 }, function($ctx1) {$ctx1.fill(self,"classesAndMetaclasses",{},smalltalk.ReferencesBrowser)})},
 args: [],
-source: "classesAndMetaclasses\x0a\x09^ Smalltalk current classes, (Smalltalk current classes collect: [ :each | each class ])",
-messageSends: [",", "classes", "current", "collect:", "class"],
+source: "classesAndMetaclasses\x0a\x09^ Smalltalk classes, (Smalltalk classes collect: [ :each | each class ])",
+messageSends: [",", "classes", "collect:", "class"],
 referencedClasses: ["Smalltalk"]
 }),
 smalltalk.ReferencesBrowser);

+ 5 - 5
js/Kernel-Announcements.js

@@ -103,8 +103,8 @@ var self=this;
 function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
 return smalltalk.withContext(function($ctx1) { 
 var $3,$4,$2,$1;
-$3=_st($Smalltalk())._current();
-$ctx1.sendIdx["current"]=1;
+$3=_st($Smalltalk())._globals();
+$ctx1.sendIdx["globals"]=1;
 $4=_st(self._announcementClass())._name();
 $ctx1.sendIdx["name"]=1;
 $2=_st($3)._at_($4);
@@ -114,13 +114,13 @@ return false;
 } else {
 var class_;
 class_=$receiver;
-$1=_st(_st(_st($Smalltalk())._current())._at_(_st(_st(_st(anAnnouncement)._class())._theNonMetaClass())._name()))._includesBehavior_(class_);
+$1=_st(_st(_st($Smalltalk())._globals())._at_(_st(_st(_st(anAnnouncement)._class())._theNonMetaClass())._name()))._includesBehavior_(class_);
 };
 return $1;
 }, function($ctx1) {$ctx1.fill(self,"handlesAnnouncement:",{anAnnouncement:anAnnouncement},smalltalk.AnnouncementSubscription)})},
 args: ["anAnnouncement"],
-source: "handlesAnnouncement: anAnnouncement\x0a\x09\x22anAnnouncement might be announced from within another Amber environment\x22\x0a\x09\x0a\x09^ (Smalltalk current at: self announcementClass name)\x0a\x09\x09ifNil: [ ^ false ]\x0a\x09\x09ifNotNil: [ :class |\x0a\x09\x09(Smalltalk current at: anAnnouncement class theNonMetaClass name) includesBehavior: class ]",
-messageSends: ["ifNil:ifNotNil:", "at:", "current", "name", "announcementClass", "includesBehavior:", "theNonMetaClass", "class"],
+source: "handlesAnnouncement: anAnnouncement\x0a\x09\x22anAnnouncement might be announced from within another Amber environment\x22\x0a\x09\x0a\x09^ (Smalltalk globals at: self announcementClass name)\x0a\x09\x09ifNil: [ ^ false ]\x0a\x09\x09ifNotNil: [ :class |\x0a\x09\x09(Smalltalk globals at: anAnnouncement class theNonMetaClass name) includesBehavior: class ]",
+messageSends: ["ifNil:ifNotNil:", "at:", "globals", "name", "announcementClass", "includesBehavior:", "theNonMetaClass", "class"],
 referencedClasses: ["Smalltalk"]
 }),
 smalltalk.AnnouncementSubscription);

+ 24 - 48
js/Kernel-Classes.js

@@ -1548,10 +1548,11 @@ fn: function (aClass,className,aCollection,packageName){
 var self=this;
 var theClass,thePackage;
 function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
+function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
 return smalltalk.withContext(function($ctx1) { 
 var $1,$2,$3,$4;
-theClass=_st(_st($Smalltalk())._current())._at_(className);
-thePackage=self._createPackageNamed_(packageName);
+theClass=_st(_st($Smalltalk())._globals())._at_(className);
+thePackage=_st($Package())._named_(packageName);
 $1=theClass;
 if(($receiver = $1) == nil || $receiver == null){
 $1;
@@ -1567,9 +1568,9 @@ $4=self._basicAddSubclassOf_named_instanceVariableNames_package_(aClass,classNam
 return $4;
 }, function($ctx1) {$ctx1.fill(self,"addSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,className:className,aCollection:aCollection,packageName:packageName,theClass:theClass,thePackage:thePackage},smalltalk.ClassBuilder)})},
 args: ["aClass", "className", "aCollection", "packageName"],
-source: "addSubclassOf: aClass named: className instanceVariableNames: aCollection package: packageName\x0a\x09| theClass thePackage |\x0a\x09\x0a\x09theClass := Smalltalk current at: className.\x0a\x09thePackage := self createPackageNamed: packageName.\x0a\x09\x0a\x09theClass ifNotNil: [\x0a\x09\x09theClass package: thePackage.\x0a\x09\x09theClass superclass == aClass ifFalse: [\x0a\x09\x09\x09^ self\x0a\x09\x09\x09\x09migrateClassNamed: className\x0a\x09\x09\x09\x09superclass: aClass\x0a\x09\x09\x09\x09instanceVariableNames: aCollection\x0a\x09\x09\x09\x09package: packageName ] ].\x0a\x09\x09\x0a\x09^ self\x0a\x09\x09basicAddSubclassOf: aClass\x0a\x09\x09named: className\x0a\x09\x09instanceVariableNames: aCollection\x0a\x09\x09package: packageName",
-messageSends: ["at:", "current", "createPackageNamed:", "ifNotNil:", "package:", "ifFalse:", "==", "superclass", "migrateClassNamed:superclass:instanceVariableNames:package:", "basicAddSubclassOf:named:instanceVariableNames:package:"],
-referencedClasses: ["Smalltalk"]
+source: "addSubclassOf: aClass named: className instanceVariableNames: aCollection package: packageName\x0a\x09| theClass thePackage |\x0a\x09\x0a\x09theClass := Smalltalk globals at: className.\x0a\x09thePackage := Package named: packageName.\x0a\x09\x0a\x09theClass ifNotNil: [\x0a\x09\x09theClass package: thePackage.\x0a\x09\x09theClass superclass == aClass ifFalse: [\x0a\x09\x09\x09^ self\x0a\x09\x09\x09\x09migrateClassNamed: className\x0a\x09\x09\x09\x09superclass: aClass\x0a\x09\x09\x09\x09instanceVariableNames: aCollection\x0a\x09\x09\x09\x09package: packageName ] ].\x0a\x09\x09\x0a\x09^ self\x0a\x09\x09basicAddSubclassOf: aClass\x0a\x09\x09named: className\x0a\x09\x09instanceVariableNames: aCollection\x0a\x09\x09package: packageName",
+messageSends: ["at:", "globals", "named:", "ifNotNil:", "package:", "ifFalse:", "==", "superclass", "migrateClassNamed:superclass:instanceVariableNames:package:", "basicAddSubclassOf:named:instanceVariableNames:package:"],
+referencedClasses: ["Smalltalk", "Package"]
 }),
 smalltalk.ClassBuilder);
 
@@ -1782,29 +1783,6 @@ referencedClasses: ["Compiler"]
 }),
 smalltalk.ClassBuilder);
 
-smalltalk.addMethod(
-smalltalk.method({
-selector: "createPackageNamed:",
-protocol: 'private',
-fn: function (aString){
-var self=this;
-function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
-function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
-return smalltalk.withContext(function($ctx1) { 
-var $1;
-$1=_st($Package())._named_ifAbsent_(aString,(function(){
-return smalltalk.withContext(function($ctx2) {
-return _st(_st($Smalltalk())._current())._createPackage_(aString);
-}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
-return $1;
-}, function($ctx1) {$ctx1.fill(self,"createPackageNamed:",{aString:aString},smalltalk.ClassBuilder)})},
-args: ["aString"],
-source: "createPackageNamed: aString\x0a\x09^ Package named: aString ifAbsent: [\x0a\x09\x09Smalltalk current createPackage: aString ]",
-messageSends: ["named:ifAbsent:", "createPackage:", "current"],
-referencedClasses: ["Package", "Smalltalk"]
-}),
-smalltalk.ClassBuilder);
-
 smalltalk.addMethod(
 smalltalk.method({
 selector: "installMethod:forClass:protocol:",
@@ -1877,12 +1855,10 @@ function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
 function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
 function $ClassMigrated(){return smalltalk.ClassMigrated||(typeof ClassMigrated=="undefined"?nil:ClassMigrated)}
 return smalltalk.withContext(function($ctx1) { 
-var $1,$2,$3,$4,$5,$6,$7,$8,$9;
+var $1,$2,$3,$4,$5,$6,$7,$8;
 tmp="new*".__comma(className);
 $ctx1.sendIdx[","]=1;
-$1=_st($Smalltalk())._current();
-$ctx1.sendIdx["current"]=1;
-oldClass=_st($1)._at_(className);
+oldClass=_st(_st($Smalltalk())._globals())._at_(className);
 newClass=self._addSubclassOf_named_instanceVariableNames_package_(aClass,tmp,aCollection,packageName);
 self._basicSwapClassNames_with_(oldClass,newClass);
 $ctx1.sendIdx["basicSwapClassNames:with:"]=1;
@@ -1892,34 +1868,34 @@ return self._copyClass_to_(oldClass,newClass);
 }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(exception){
 return smalltalk.withContext(function($ctx2) {
 self._basicSwapClassNames_with_(oldClass,newClass);
-$2=self._basicRemoveClass_(newClass);
+$1=self._basicRemoveClass_(newClass);
 $ctx2.sendIdx["basicRemoveClass:"]=1;
-$2;
+$1;
 return _st(exception)._signal();
 }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,2)})}));
 self._rawRenameClass_to_(oldClass,tmp);
 $ctx1.sendIdx["rawRenameClass:to:"]=1;
-$3=self._rawRenameClass_to_(newClass,className);
-$4=_st(oldClass)._subclasses();
-$5=(function(each){
+$2=self._rawRenameClass_to_(newClass,className);
+$3=_st(oldClass)._subclasses();
+$4=(function(each){
 return smalltalk.withContext(function($ctx2) {
 return self._migrateClass_superclass_(each,newClass);
 }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})});
-$6=_st("Recompiling ".__comma(_st(newClass)._name())).__comma("...");
+$5=_st("Recompiling ".__comma(_st(newClass)._name())).__comma("...");
 $ctx1.sendIdx[","]=2;
-_st($4)._do_displayingProgress_($5,$6);
+_st($3)._do_displayingProgress_($4,$5);
 self._basicRemoveClass_(oldClass);
-$7=_st($ClassMigrated())._new();
-_st($7)._theClass_(newClass);
-_st($7)._oldClass_(oldClass);
-$8=_st($7)._yourself();
-_st(_st($SystemAnnouncer())._current())._announce_($8);
-$9=newClass;
-return $9;
+$6=_st($ClassMigrated())._new();
+_st($6)._theClass_(newClass);
+_st($6)._oldClass_(oldClass);
+$7=_st($6)._yourself();
+_st(_st($SystemAnnouncer())._current())._announce_($7);
+$8=newClass;
+return $8;
 }, function($ctx1) {$ctx1.fill(self,"migrateClassNamed:superclass:instanceVariableNames:package:",{className:className,aClass:aClass,aCollection:aCollection,packageName:packageName,oldClass:oldClass,newClass:newClass,tmp:tmp},smalltalk.ClassBuilder)})},
 args: ["className", "aClass", "aCollection", "packageName"],
-source: "migrateClassNamed: className superclass: aClass instanceVariableNames: aCollection package: packageName\x0a\x09| oldClass newClass tmp |\x0a\x09\x0a\x09tmp := 'new*', className.\x0a\x09oldClass := Smalltalk current at: className.\x0a\x09\x0a\x09newClass := self\x0a\x09\x09addSubclassOf: aClass\x0a\x09\x09named: tmp\x0a\x09\x09instanceVariableNames: aCollection\x0a\x09\x09package: packageName.\x0a\x0a\x09self basicSwapClassNames: oldClass with: newClass.\x0a\x0a\x09[ self copyClass: oldClass to: newClass ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :exception |\x0a\x09\x09\x09self\x0a\x09\x09\x09\x09basicSwapClassNames: oldClass with: newClass;\x0a\x09\x09\x09\x09basicRemoveClass: newClass.\x0a\x09\x09\x09exception signal ].\x0a\x0a\x09self\x0a\x09\x09rawRenameClass: oldClass to: tmp;\x0a\x09\x09rawRenameClass: newClass to: className.\x0a\x0a\x09oldClass subclasses \x0a\x09\x09do: [ :each | self migrateClass: each superclass: newClass ]\x0a\x09\x09displayingProgress: 'Recompiling ', newClass name, '...'.\x0a\x0a\x09self basicRemoveClass: oldClass.\x0a\x09\x0a\x09SystemAnnouncer current announce: (ClassMigrated new\x0a\x09\x09theClass: newClass;\x0a\x09\x09oldClass: oldClass;\x0a\x09\x09yourself).\x0a\x09\x0a\x09^ newClass",
-messageSends: [",", "at:", "current", "addSubclassOf:named:instanceVariableNames:package:", "basicSwapClassNames:with:", "on:do:", "copyClass:to:", "basicRemoveClass:", "signal", "rawRenameClass:to:", "do:displayingProgress:", "subclasses", "migrateClass:superclass:", "name", "announce:", "theClass:", "new", "oldClass:", "yourself"],
+source: "migrateClassNamed: className superclass: aClass instanceVariableNames: aCollection package: packageName\x0a\x09| oldClass newClass tmp |\x0a\x09\x0a\x09tmp := 'new*', className.\x0a\x09oldClass := Smalltalk globals at: className.\x0a\x09\x0a\x09newClass := self\x0a\x09\x09addSubclassOf: aClass\x0a\x09\x09named: tmp\x0a\x09\x09instanceVariableNames: aCollection\x0a\x09\x09package: packageName.\x0a\x0a\x09self basicSwapClassNames: oldClass with: newClass.\x0a\x0a\x09[ self copyClass: oldClass to: newClass ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :exception |\x0a\x09\x09\x09self\x0a\x09\x09\x09\x09basicSwapClassNames: oldClass with: newClass;\x0a\x09\x09\x09\x09basicRemoveClass: newClass.\x0a\x09\x09\x09exception signal ].\x0a\x0a\x09self\x0a\x09\x09rawRenameClass: oldClass to: tmp;\x0a\x09\x09rawRenameClass: newClass to: className.\x0a\x0a\x09oldClass subclasses \x0a\x09\x09do: [ :each | self migrateClass: each superclass: newClass ]\x0a\x09\x09displayingProgress: 'Recompiling ', newClass name, '...'.\x0a\x0a\x09self basicRemoveClass: oldClass.\x0a\x09\x0a\x09SystemAnnouncer current announce: (ClassMigrated new\x0a\x09\x09theClass: newClass;\x0a\x09\x09oldClass: oldClass;\x0a\x09\x09yourself).\x0a\x09\x0a\x09^ newClass",
+messageSends: [",", "at:", "globals", "addSubclassOf:named:instanceVariableNames:package:", "basicSwapClassNames:with:", "on:do:", "copyClass:to:", "basicRemoveClass:", "signal", "rawRenameClass:to:", "do:displayingProgress:", "subclasses", "migrateClass:superclass:", "name", "announce:", "current", "theClass:", "new", "oldClass:", "yourself"],
 referencedClasses: ["Smalltalk", "Error", "SystemAnnouncer", "ClassMigrated"]
 }),
 smalltalk.ClassBuilder);

+ 23 - 23
js/Kernel-ImportExport.js

@@ -107,7 +107,7 @@ return smalltalk.withContext(function($ctx1) {
 var $1,$2;
 extensionName="*".__comma(_st(aPackage)._name());
 result=_st($OrderedCollection())._new();
-_st(_st(_st($Smalltalk())._current())._classes())._do_((function(each){
+_st(_st($Smalltalk())._classes())._do_((function(each){
 return smalltalk.withContext(function($ctx2) {
 return _st([each,_st(each)._class()])._do_((function(behavior){
 return smalltalk.withContext(function($ctx3) {
@@ -122,8 +122,8 @@ $2=result;
 return $2;
 }, function($ctx1) {$ctx1.fill(self,"extensionProtocolsOfPackage:",{aPackage:aPackage,extensionName:extensionName,result:result},smalltalk.AbstractExporter)})},
 args: ["aPackage"],
-source: "extensionProtocolsOfPackage: aPackage\x0a\x09| extensionName result |\x0a\x09\x0a\x09extensionName := '*', aPackage name.\x0a\x09result := OrderedCollection new.\x0a\x09\x0a\x09\x22The classes must be loaded since it is extensions only.\x0a\x09Therefore sorting (dependency resolution) does not matter here.\x0a\x09Not sorting improves the speed by a number of magnitude.\x22\x0a\x09\x0a\x09Smalltalk current classes do: [ :each |\x0a\x09\x09{each. each class} do: [ :behavior |\x0a\x09\x09\x09(behavior protocols includes: extensionName) ifTrue: [\x0a\x09\x09\x09\x09result add: (ExportMethodProtocol name: extensionName theClass: behavior) ] ] ].\x0a\x0a\x09^ result",
-messageSends: [",", "name", "new", "do:", "classes", "current", "class", "ifTrue:", "includes:", "protocols", "add:", "name:theClass:"],
+source: "extensionProtocolsOfPackage: aPackage\x0a\x09| extensionName result |\x0a\x09\x0a\x09extensionName := '*', aPackage name.\x0a\x09result := OrderedCollection new.\x0a\x09\x0a\x09\x22The classes must be loaded since it is extensions only.\x0a\x09Therefore sorting (dependency resolution) does not matter here.\x0a\x09Not sorting improves the speed by a number of magnitude.\x22\x0a\x09\x0a\x09Smalltalk classes do: [ :each |\x0a\x09\x09{each. each class} do: [ :behavior |\x0a\x09\x09\x09(behavior protocols includes: extensionName) ifTrue: [\x0a\x09\x09\x09\x09result add: (ExportMethodProtocol name: extensionName theClass: behavior) ] ] ].\x0a\x0a\x09^ result",
+messageSends: [",", "name", "new", "do:", "classes", "class", "ifTrue:", "includes:", "protocols", "add:", "name:theClass:"],
 referencedClasses: ["OrderedCollection", "Smalltalk", "ExportMethodProtocol"]
 }),
 smalltalk.AbstractExporter);
@@ -353,13 +353,13 @@ fn: function (aPackage,aStream){
 var self=this;
 return smalltalk.withContext(function($ctx1) { 
 var $1,$2;
-$1=_st("Smalltalk current createPackage: '".__comma(_st(aPackage)._name())).__comma("'!");
+$1=_st("Smalltalk createPackage: '".__comma(_st(aPackage)._name())).__comma("'!");
 $ctx1.sendIdx[","]=1;
 _st(aStream)._nextPutAll_($1);
 $2=_st(aStream)._lf();
 return self}, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},smalltalk.ChunkExporter)})},
 args: ["aPackage", "aStream"],
-source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'Smalltalk current createPackage: ''', aPackage name, '''!';\x0a\x09\x09lf",
+source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'Smalltalk createPackage: ''', aPackage name, '''!';\x0a\x09\x09lf",
 messageSends: ["nextPutAll:", ",", "name", "lf"],
 referencedClasses: []
 }),
@@ -465,7 +465,7 @@ var $1,$2;
 name=_st(aPackage)._name();
 result=_st($OrderedCollection())._new();
 $ctx1.sendIdx["new"]=1;
-_st(_st($Package())._sortedClasses_(_st(_st($Smalltalk())._current())._classes()))._do_((function(each){
+_st(_st($Package())._sortedClasses_(_st($Smalltalk())._classes()))._do_((function(each){
 return smalltalk.withContext(function($ctx2) {
 return _st([each,_st(each)._class()])._do_((function(aClass){
 return smalltalk.withContext(function($ctx3) {
@@ -492,8 +492,8 @@ $2=result;
 return $2;
 }, function($ctx1) {$ctx1.fill(self,"extensionCategoriesOfPackage:",{aPackage:aPackage,name:name,map:map,result:result},smalltalk.ChunkExporter)})},
 args: ["aPackage"],
-source: "extensionCategoriesOfPackage: aPackage\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09| name map result |\x0a\x09name := aPackage name.\x0a\x09result := OrderedCollection new.\x0a\x09(Package sortedClasses: Smalltalk current classes) do: [ :each |\x0a\x09\x09{each. each class} do: [ :aClass |\x0a\x09\x09\x09map := Dictionary new.\x0a\x09\x09\x09aClass protocolsDo: [ :category :methods |\x0a\x09\x09\x09\x09category = ('*', name) ifTrue: [ map at: category put: methods ] ].\x0a\x09\x09\x09result addAll: ((map keys sorted: [ :a :b | a <= b ]) collect: [ :category |\x0a\x09\x09\x09\x09MethodCategory name: category theClass: aClass methods: (map at: category) ]) ] ].\x0a\x09^ result",
-messageSends: ["name", "new", "do:", "sortedClasses:", "classes", "current", "class", "protocolsDo:", "ifTrue:", "=", ",", "at:put:", "addAll:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"],
+source: "extensionCategoriesOfPackage: aPackage\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09| name map result |\x0a\x09name := aPackage name.\x0a\x09result := OrderedCollection new.\x0a\x09(Package sortedClasses: Smalltalk classes) do: [ :each |\x0a\x09\x09{each. each class} do: [ :aClass |\x0a\x09\x09\x09map := Dictionary new.\x0a\x09\x09\x09aClass protocolsDo: [ :category :methods |\x0a\x09\x09\x09\x09category = ('*', name) ifTrue: [ map at: category put: methods ] ].\x0a\x09\x09\x09result addAll: ((map keys sorted: [ :a :b | a <= b ]) collect: [ :category |\x0a\x09\x09\x09\x09MethodCategory name: category theClass: aClass methods: (map at: category) ]) ] ].\x0a\x09^ result",
+messageSends: ["name", "new", "do:", "sortedClasses:", "classes", "class", "protocolsDo:", "ifTrue:", "=", ",", "at:put:", "addAll:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"],
 referencedClasses: ["OrderedCollection", "Package", "Smalltalk", "Dictionary", "MethodCategory"]
 }),
 smalltalk.ChunkExporter);
@@ -1756,7 +1756,7 @@ function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"
 function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
 return smalltalk.withContext(function($ctx1) { 
 var $1,$3,$2;
-$1=_st(_st($Smalltalk())._current())._amdRequire();
+$1=_st($Smalltalk())._amdRequire();
 if(($receiver = $1) == nil || $receiver == null){
 self._error_("AMD loader not present");
 } else {
@@ -1769,8 +1769,8 @@ _st(require)._value_($2);
 };
 return self}, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},smalltalk.AmdPackageHandler)})},
 args: ["aPackage"],
-source: "load: aPackage\x0a\x09Smalltalk current amdRequire\x0a\x09\x09ifNil: [ self error: 'AMD loader not present' ]\x0a\x09\x09ifNotNil: [ :require |\x0a\x09\x09\x09require value: (Array new: (self namespaceFor: aPackage), '/', aPackage name ) ]",
-messageSends: ["ifNil:ifNotNil:", "amdRequire", "current", "error:", "value:", "new:", ",", "namespaceFor:", "name"],
+source: "load: aPackage\x0a\x09Smalltalk amdRequire\x0a\x09\x09ifNil: [ self error: 'AMD loader not present' ]\x0a\x09\x09ifNotNil: [ :require |\x0a\x09\x09\x09require value: (Array new: (self namespaceFor: aPackage), '/', aPackage name ) ]",
+messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "value:", "new:", ",", "namespaceFor:", "name"],
 referencedClasses: ["Smalltalk", "Array"]
 }),
 smalltalk.AmdPackageHandler);
@@ -1802,7 +1802,7 @@ var self=this;
 function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
 return smalltalk.withContext(function($ctx1) { 
 var $2,$1;
-$2=_st(_st($Smalltalk())._current())._amdRequire();
+$2=_st($Smalltalk())._amdRequire();
 if(($receiver = $2) == nil || $receiver == null){
 $1=self._error_("AMD loader not present");
 } else {
@@ -1813,8 +1813,8 @@ $1=_st(_st(require)._basicAt_("toUrl"))._value_(aString);
 return $1;
 }, function($ctx1) {$ctx1.fill(self,"toUrl:",{aString:aString},smalltalk.AmdPackageHandler)})},
 args: ["aString"],
-source: "toUrl: aString\x0a\x09^ Smalltalk current amdRequire\x0a\x09\x09ifNil: [ self error: 'AMD loader not present' ]\x0a\x09\x09ifNotNil: [ :require | (require basicAt: 'toUrl') value: aString ]",
-messageSends: ["ifNil:ifNotNil:", "amdRequire", "current", "error:", "value:", "basicAt:"],
+source: "toUrl: aString\x0a\x09^ Smalltalk amdRequire\x0a\x09\x09ifNil: [ self error: 'AMD loader not present' ]\x0a\x09\x09ifNotNil: [ :require | (require basicAt: 'toUrl') value: aString ]",
+messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "value:", "basicAt:"],
 referencedClasses: ["Smalltalk"]
 }),
 smalltalk.AmdPackageHandler);
@@ -1829,12 +1829,12 @@ var self=this;
 function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
 return smalltalk.withContext(function($ctx1) { 
 var $1;
-$1=_st(_st($Smalltalk())._current())._defaultAmdNamespace();
+$1=_st($Smalltalk())._defaultAmdNamespace();
 return $1;
 }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},smalltalk.AmdPackageHandler.klass)})},
 args: [],
-source: "defaultNamespace\x0a\x09^ Smalltalk current defaultAmdNamespace",
-messageSends: ["defaultAmdNamespace", "current"],
+source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
+messageSends: ["defaultAmdNamespace"],
 referencedClasses: ["Smalltalk"]
 }),
 smalltalk.AmdPackageHandler.klass);
@@ -1847,11 +1847,11 @@ fn: function (aString){
 var self=this;
 function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
 return smalltalk.withContext(function($ctx1) { 
-_st(_st($Smalltalk())._current())._defaultAmdNamespace_(aString);
+_st($Smalltalk())._defaultAmdNamespace_(aString);
 return self}, function($ctx1) {$ctx1.fill(self,"defaultNamespace:",{aString:aString},smalltalk.AmdPackageHandler.klass)})},
 args: ["aString"],
-source: "defaultNamespace: aString\x0a\x09Smalltalk current defaultAmdNamespace: aString",
-messageSends: ["defaultAmdNamespace:", "current"],
+source: "defaultNamespace: aString\x0a\x09Smalltalk defaultAmdNamespace: aString",
+messageSends: ["defaultAmdNamespace:"],
 referencedClasses: ["Smalltalk"]
 }),
 smalltalk.AmdPackageHandler.klass);
@@ -2235,12 +2235,12 @@ var self=this;
 function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
 return smalltalk.withContext(function($ctx1) { 
 var $1;
-$1=_st(_st($Smalltalk())._current())._defaultAmdNamespace();
+$1=_st($Smalltalk())._defaultAmdNamespace();
 return $1;
 }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},smalltalk.AmdPackageTransport)})},
 args: [],
-source: "defaultNamespace\x0a\x09^ Smalltalk current defaultAmdNamespace",
-messageSends: ["defaultAmdNamespace", "current"],
+source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
+messageSends: ["defaultAmdNamespace"],
 referencedClasses: ["Smalltalk"]
 }),
 smalltalk.AmdPackageTransport);

+ 189 - 133
js/Kernel-Infrastructure.js

@@ -181,12 +181,12 @@ var self=this;
 function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
 return smalltalk.withContext(function($ctx1) { 
 var $1;
-$1=_st(_st(_st($Smalltalk())._current())._at_("allSelectors"))._value();
+$1=_st(_st($Smalltalk())._vm())._allSelectors();
 return $1;
 }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},smalltalk.Environment)})},
 args: [],
-source: "allSelectors\x0a\x09^ (Smalltalk current at: 'allSelectors') value",
-messageSends: ["value", "at:", "current"],
+source: "allSelectors\x0a\x09^ Smalltalk vm allSelectors",
+messageSends: ["allSelectors", "vm"],
 referencedClasses: ["Smalltalk"]
 }),
 smalltalk.Environment);
@@ -200,15 +200,15 @@ var self=this;
 function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
 return smalltalk.withContext(function($ctx1) { 
 var $1;
-$1=_st(_st(_st($Smalltalk())._current())._classes())._collect_((function(each){
+$1=_st(_st($Smalltalk())._classes())._collect_((function(each){
 return smalltalk.withContext(function($ctx2) {
 return _st(each)._name();
 }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
 return $1;
 }, function($ctx1) {$ctx1.fill(self,"availableClassNames",{},smalltalk.Environment)})},
 args: [],
-source: "availableClassNames\x0a\x09^ Smalltalk current classes \x0a\x09\x09collect: [ :each | each name ]",
-messageSends: ["collect:", "classes", "current", "name"],
+source: "availableClassNames\x0a\x09^ Smalltalk classes \x0a\x09\x09collect: [ :each | each name ]",
+messageSends: ["collect:", "classes", "name"],
 referencedClasses: ["Smalltalk"]
 }),
 smalltalk.Environment);
@@ -222,15 +222,15 @@ var self=this;
 function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
 return smalltalk.withContext(function($ctx1) { 
 var $1;
-$1=_st(_st(_st($Smalltalk())._current())._packages())._collect_((function(each){
+$1=_st(_st($Smalltalk())._packages())._collect_((function(each){
 return smalltalk.withContext(function($ctx2) {
 return _st(each)._name();
 }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
 return $1;
 }, function($ctx1) {$ctx1.fill(self,"availablePackageNames",{},smalltalk.Environment)})},
 args: [],
-source: "availablePackageNames\x0a\x09^ Smalltalk current packages \x0a\x09\x09collect: [ :each | each name ]",
-messageSends: ["collect:", "packages", "current", "name"],
+source: "availablePackageNames\x0a\x09^ Smalltalk packages \x0a\x09\x09collect: [ :each | each name ]",
+messageSends: ["collect:", "packages", "name"],
 referencedClasses: ["Smalltalk"]
 }),
 smalltalk.Environment);
@@ -290,7 +290,7 @@ var self=this;
 function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
 return smalltalk.withContext(function($ctx1) { 
 var $2,$1;
-$2=_st(_st($Smalltalk())._current())._at_(_st(aString)._asSymbol());
+$2=_st(_st($Smalltalk())._globals())._at_(_st(aString)._asSymbol());
 if(($receiver = $2) == nil || $receiver == null){
 $1=self._error_("Invalid class name");
 } else {
@@ -299,8 +299,8 @@ $1=$2;
 return $1;
 }, function($ctx1) {$ctx1.fill(self,"classNamed:",{aString:aString},smalltalk.Environment)})},
 args: ["aString"],
-source: "classNamed: aString\x0a\x09^ (Smalltalk current at: aString asSymbol)\x0a\x09\x09ifNil: [ self error: 'Invalid class name' ]",
-messageSends: ["ifNil:", "at:", "current", "asSymbol", "error:"],
+source: "classNamed: aString\x0a\x09^ (Smalltalk globals at: aString asSymbol)\x0a\x09\x09ifNil: [ self error: 'Invalid class name' ]",
+messageSends: ["ifNil:", "at:", "globals", "asSymbol", "error:"],
 referencedClasses: ["Smalltalk"]
 }),
 smalltalk.Environment);
@@ -314,12 +314,12 @@ var self=this;
 function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
 return smalltalk.withContext(function($ctx1) { 
 var $1;
-$1=_st(_st($Smalltalk())._current())._classes();
+$1=_st($Smalltalk())._classes();
 return $1;
 }, function($ctx1) {$ctx1.fill(self,"classes",{},smalltalk.Environment)})},
 args: [],
-source: "classes\x0a\x09^ Smalltalk current classes",
-messageSends: ["classes", "current"],
+source: "classes\x0a\x09^ Smalltalk classes",
+messageSends: ["classes"],
 referencedClasses: ["Smalltalk"]
 }),
 smalltalk.Environment);
@@ -408,7 +408,7 @@ function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"
 function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
 return smalltalk.withContext(function($ctx1) { 
 var $1,$2;
-$1=_st(_st($Smalltalk())._current())._at_(aClassName);
+$1=_st(_st($Smalltalk())._globals())._at_(aClassName);
 if(($receiver = $1) == nil || $receiver == null){
 $1;
 } else {
@@ -419,8 +419,8 @@ self._error_($2);
 _st(_st($ClassBuilder())._new())._copyClass_named_(aClass,aClassName);
 return self}, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,aClassName:aClassName},smalltalk.Environment)})},
 args: ["aClass", "aClassName"],
-source: "copyClass: aClass to: aClassName\x0a\x09(Smalltalk current at: aClassName)\x0a\x09\x09ifNotNil: [ self error: 'A class named ', aClassName, ' already exists' ].\x0a\x09\x09\x0a\x09ClassBuilder new copyClass: aClass named: aClassName",
-messageSends: ["ifNotNil:", "at:", "current", "error:", ",", "copyClass:named:", "new"],
+source: "copyClass: aClass to: aClassName\x0a\x09(Smalltalk globals at: aClassName)\x0a\x09\x09ifNotNil: [ self error: 'A class named ', aClassName, ' already exists' ].\x0a\x09\x09\x0a\x09ClassBuilder new copyClass: aClass named: aClassName",
+messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "copyClass:named:", "new"],
 referencedClasses: ["Smalltalk", "ClassBuilder"]
 }),
 smalltalk.Environment);
@@ -557,30 +557,23 @@ protocol: 'actions',
 fn: function (aMethod,aClassName){
 var self=this;
 var destinationClass;
-function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
 return smalltalk.withContext(function($ctx1) { 
-var $1,$3,$4,$2;
-destinationClass=_st(_st($Smalltalk())._current())._at_(_st(aClassName)._asSymbol());
-$1=destinationClass;
-if(($receiver = $1) == nil || $receiver == null){
-self._error_("Invalid class name");
-} else {
-$1;
-};
-$3=destinationClass;
-$4=_st(aMethod)._methodClass();
+var $2,$3,$1;
+destinationClass=self._classNamed_(aClassName);
+$2=destinationClass;
+$3=_st(aMethod)._methodClass();
 $ctx1.sendIdx["methodClass"]=1;
-$2=_st($3).__eq_eq($4);
-if(smalltalk.assert($2)){
+$1=_st($2).__eq_eq($3);
+if(smalltalk.assert($1)){
 return self;
 };
 _st(destinationClass)._compile_protocol_(_st(aMethod)._source(),_st(aMethod)._protocol());
 _st(_st(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
 return self}, function($ctx1) {$ctx1.fill(self,"moveMethod:toClass:",{aMethod:aMethod,aClassName:aClassName,destinationClass:destinationClass},smalltalk.Environment)})},
 args: ["aMethod", "aClassName"],
-source: "moveMethod: aMethod toClass: aClassName\x0a\x09| destinationClass |\x0a\x09\x0a\x09destinationClass := Smalltalk current at: aClassName asSymbol.\x0a\x09destinationClass ifNil: [ self error: 'Invalid class name' ].\x0a\x09destinationClass == aMethod methodClass ifTrue: [ ^ self ].\x0a\x09\x0a\x09destinationClass \x0a\x09\x09compile: aMethod source\x0a\x09\x09protocol: aMethod protocol.\x0a\x09aMethod methodClass \x0a\x09\x09removeCompiledMethod: aMethod",
-messageSends: ["at:", "current", "asSymbol", "ifNil:", "error:", "ifTrue:", "==", "methodClass", "compile:protocol:", "source", "protocol", "removeCompiledMethod:"],
-referencedClasses: ["Smalltalk"]
+source: "moveMethod: aMethod toClass: aClassName\x0a\x09| destinationClass |\x0a\x09\x0a\x09destinationClass := self classNamed: aClassName.\x0a\x09destinationClass == aMethod methodClass ifTrue: [ ^ self ].\x0a\x09\x0a\x09destinationClass \x0a\x09\x09compile: aMethod source\x0a\x09\x09protocol: aMethod protocol.\x0a\x09aMethod methodClass \x0a\x09\x09removeCompiledMethod: aMethod",
+messageSends: ["classNamed:", "ifTrue:", "==", "methodClass", "compile:protocol:", "source", "protocol", "removeCompiledMethod:"],
+referencedClasses: []
 }),
 smalltalk.Environment);
 
@@ -609,12 +602,12 @@ var self=this;
 function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
 return smalltalk.withContext(function($ctx1) { 
 var $1;
-$1=_st(_st($Smalltalk())._current())._packages();
+$1=_st($Smalltalk())._packages();
 return $1;
 }, function($ctx1) {$ctx1.fill(self,"packages",{},smalltalk.Environment)})},
 args: [],
-source: "packages\x0a\x09^ Smalltalk current packages",
-messageSends: ["packages", "current"],
+source: "packages\x0a\x09^ Smalltalk packages",
+messageSends: ["packages"],
 referencedClasses: ["Smalltalk"]
 }),
 smalltalk.Environment);
@@ -678,11 +671,11 @@ fn: function (aClass){
 var self=this;
 function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
 return smalltalk.withContext(function($ctx1) { 
-_st(_st($Smalltalk())._current())._removeClass_(aClass);
+_st($Smalltalk())._removeClass_(aClass);
 return self}, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},smalltalk.Environment)})},
 args: ["aClass"],
-source: "removeClass: aClass\x0a\x09Smalltalk current removeClass: aClass",
-messageSends: ["removeClass:", "current"],
+source: "removeClass: aClass\x0a\x09Smalltalk removeClass: aClass",
+messageSends: ["removeClass:"],
 referencedClasses: ["Smalltalk"]
 }),
 smalltalk.Environment);
@@ -732,7 +725,7 @@ function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"
 function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
 return smalltalk.withContext(function($ctx1) { 
 var $1,$2;
-$1=_st(_st($Smalltalk())._current())._at_(aClassName);
+$1=_st(_st($Smalltalk())._globals())._at_(aClassName);
 if(($receiver = $1) == nil || $receiver == null){
 $1;
 } else {
@@ -743,8 +736,8 @@ self._error_($2);
 _st(_st($ClassBuilder())._new())._renameClass_to_(aClass,aClassName);
 return self}, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,aClassName:aClassName},smalltalk.Environment)})},
 args: ["aClass", "aClassName"],
-source: "renameClass: aClass to: aClassName\x0a\x09(Smalltalk current at: aClassName)\x0a\x09\x09ifNotNil: [ self error: 'A class named ', aClassName, ' already exists' ].\x0a\x09\x09\x0a\x09ClassBuilder new renameClass: aClass to: aClassName",
-messageSends: ["ifNotNil:", "at:", "current", "error:", ",", "renameClass:to:", "new"],
+source: "renameClass: aClass to: aClassName\x0a\x09(Smalltalk globals at: aClassName)\x0a\x09\x09ifNotNil: [ self error: 'A class named ', aClassName, ' already exists' ].\x0a\x09\x09\x0a\x09ClassBuilder new renameClass: aClass to: aClassName",
+messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "renameClass:to:", "new"],
 referencedClasses: ["Smalltalk", "ClassBuilder"]
 }),
 smalltalk.Environment);
@@ -793,13 +786,12 @@ var self=this;
 function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
 return smalltalk.withContext(function($ctx1) { 
 var $1;
-$1=_st(_st(_st($Smalltalk())._current())._at_("SystemAnnouncer"))._current();
-$ctx1.sendIdx["current"]=1;
+$1=_st(_st(_st($Smalltalk())._globals())._at_("SystemAnnouncer"))._current();
 return $1;
 }, function($ctx1) {$ctx1.fill(self,"systemAnnouncer",{},smalltalk.Environment)})},
 args: [],
-source: "systemAnnouncer\x0a\x09^ (Smalltalk current at: #SystemAnnouncer) current",
-messageSends: ["current", "at:"],
+source: "systemAnnouncer\x0a\x09^ (Smalltalk globals at: #SystemAnnouncer) current",
+messageSends: ["current", "at:", "globals"],
 referencedClasses: ["Smalltalk"]
 }),
 smalltalk.Environment);
@@ -1408,7 +1400,7 @@ $2=_st($3)._asSet();
 _st($2)._remove_ifAbsent_(nil,(function(){
 return smalltalk.withContext(function($ctx2) {
 }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
-_st($2)._addAll_(_st(_st(_st($Smalltalk())._current())._classes())._select_((function(each){
+_st($2)._addAll_(_st(_st($Smalltalk())._classes())._select_((function(each){
 return smalltalk.withContext(function($ctx2) {
 $6=_st(each)._protocols();
 $ctx2.sendIdx["protocols"]=1;
@@ -1420,8 +1412,8 @@ $1=$7;
 return $1;
 }, function($ctx1) {$ctx1.fill(self,"loadDependencyClasses",{starCategoryName:starCategoryName},smalltalk.Package)})},
 args: [],
-source: "loadDependencyClasses\x0a\x09\x22Returns classes needed at the time of loading a package.\x0a\x09These are all that are used to subclass\x0a\x09and to define an extension method\x22\x0a\x09\x0a\x09| starCategoryName |\x0a\x09starCategoryName := '*', self name.\x0a\x09^ (self classes collect: [ :each | each superclass ]) asSet\x0a\x09\x09remove: nil ifAbsent: [];\x0a\x09\x09addAll: (Smalltalk current classes select: [ :each | each protocols, each class protocols includes: starCategoryName ]);\x0a\x09\x09yourself",
-messageSends: [",", "name", "remove:ifAbsent:", "asSet", "collect:", "classes", "superclass", "addAll:", "select:", "current", "includes:", "protocols", "class", "yourself"],
+source: "loadDependencyClasses\x0a\x09\x22Returns classes needed at the time of loading a package.\x0a\x09These are all that are used to subclass\x0a\x09and to define an extension method\x22\x0a\x09\x0a\x09| starCategoryName |\x0a\x09starCategoryName := '*', self name.\x0a\x09^ (self classes collect: [ :each | each superclass ]) asSet\x0a\x09\x09remove: nil ifAbsent: [];\x0a\x09\x09addAll: (Smalltalk classes select: [ :each | each protocols, each class protocols includes: starCategoryName ]);\x0a\x09\x09yourself",
+messageSends: [",", "name", "remove:ifAbsent:", "asSet", "collect:", "classes", "superclass", "addAll:", "select:", "includes:", "protocols", "class", "yourself"],
 referencedClasses: ["Smalltalk"]
 }),
 smalltalk.Package);
@@ -1598,18 +1590,16 @@ fn: function (aPackageName){
 var self=this;
 function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
 return smalltalk.withContext(function($ctx1) { 
-var $2,$1;
-$2=_st($Smalltalk())._current();
-$ctx1.sendIdx["current"]=1;
-$1=_st($2)._packageAt_ifAbsent_(aPackageName,(function(){
+var $1;
+$1=_st($Smalltalk())._packageAt_ifAbsent_(aPackageName,(function(){
 return smalltalk.withContext(function($ctx2) {
-return _st(_st($Smalltalk())._current())._createPackage_(aPackageName);
+return _st($Smalltalk())._createPackage_(aPackageName);
 }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
 return $1;
 }, function($ctx1) {$ctx1.fill(self,"named:",{aPackageName:aPackageName},smalltalk.Package.klass)})},
 args: ["aPackageName"],
-source: "named: aPackageName\x0a\x09^ Smalltalk current \x0a\x09\x09packageAt: aPackageName\x0a\x09\x09ifAbsent: [ \x0a\x09\x09\x09Smalltalk current createPackage: aPackageName ]",
-messageSends: ["packageAt:ifAbsent:", "current", "createPackage:"],
+source: "named: aPackageName\x0a\x09^ Smalltalk \x0a\x09\x09packageAt: aPackageName\x0a\x09\x09ifAbsent: [ \x0a\x09\x09\x09Smalltalk createPackage: aPackageName ]",
+messageSends: ["packageAt:ifAbsent:", "createPackage:"],
 referencedClasses: ["Smalltalk"]
 }),
 smalltalk.Package.klass);
@@ -1623,12 +1613,12 @@ var self=this;
 function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
 return smalltalk.withContext(function($ctx1) { 
 var $1;
-$1=_st(_st($Smalltalk())._current())._packageAt_ifAbsent_(aPackageName,aBlock);
+$1=_st($Smalltalk())._packageAt_ifAbsent_(aPackageName,aBlock);
 return $1;
 }, function($ctx1) {$ctx1.fill(self,"named:ifAbsent:",{aPackageName:aPackageName,aBlock:aBlock},smalltalk.Package.klass)})},
 args: ["aPackageName", "aBlock"],
-source: "named: aPackageName ifAbsent: aBlock\x0a\x09^ Smalltalk current packageAt: aPackageName ifAbsent: aBlock",
-messageSends: ["packageAt:ifAbsent:", "current"],
+source: "named: aPackageName ifAbsent: aBlock\x0a\x09^ Smalltalk packageAt: aPackageName ifAbsent: aBlock",
+messageSends: ["packageAt:ifAbsent:"],
 referencedClasses: ["Smalltalk"]
 }),
 smalltalk.Package.klass);
@@ -1984,8 +1974,8 @@ referencedClasses: []
 smalltalk.ProgressHandler.klass);
 
 
-smalltalk.addClass('Smalltalk', smalltalk.Object, [], 'Kernel-Infrastructure');
-smalltalk.Smalltalk.comment="I represent the global JavaScript variable `smalltalk` declared in `js/boot.js`.\x0a\x0a## API\x0a\x0aI have only one instance, accessed with class-side method `#current`.\x0a\x0aThe `smalltalk` object holds all class and packages defined in the system.\x0a\x0a## Classes\x0a\x0aClasses can be accessed using the following methods:\x0a\x0a- `#classes` answers the full list of Smalltalk classes in the system\x0a- `#at:` answers a specific class or `nil`\x0a\x0a## Packages\x0a\x0aPackages can be accessed using the following methods:\x0a\x0a- `#packages` answers the full list of packages\x0a- `#packageAt:` answers a specific package or `nil`\x0a\x0a## Parsing\x0a\x0aThe `#parse:` method is used to parse Amber source code.\x0aIt requires the `Compiler` package and the `js/parser.js` parser file in order to work.";
+smalltalk.addClass('SmalltalkImage', smalltalk.Object, [], 'Kernel-Infrastructure');
+smalltalk.SmalltalkImage.comment="I represent the Smalltalk system, wrapping\x0aoperations of variable `smalltalk` declared in `js/boot.js`.\x0a\x0a## API\x0a\x0aI have only one instance, accessed with global variable `Smalltalk`.\x0a\x0aThe `smalltalk` object holds all class and packages defined in the system.\x0a\x0a## Classes\x0a\x0aClasses can be accessed using the following methods:\x0a\x0a- `#classes` answers the full list of Smalltalk classes in the system\x0a- `#at:` answers a specific class or `nil`\x0a\x0a## Packages\x0a\x0aPackages can be accessed using the following methods:\x0a\x0a- `#packages` answers the full list of packages\x0a- `#packageAt:` answers a specific package or `nil`\x0a\x0a## Parsing\x0a\x0aThe `#parse:` method is used to parse Amber source code.\x0aIt requires the `Compiler` package and the `js/parser.js` parser file in order to work.";
 smalltalk.addMethod(
 smalltalk.method({
 selector: "addGlobalJsVariable:",
@@ -1994,13 +1984,13 @@ fn: function (aString){
 var self=this;
 return smalltalk.withContext(function($ctx1) { 
 _st(self._globalJsVariables())._add_(aString);
-return self}, function($ctx1) {$ctx1.fill(self,"addGlobalJsVariable:",{aString:aString},smalltalk.Smalltalk)})},
+return self}, function($ctx1) {$ctx1.fill(self,"addGlobalJsVariable:",{aString:aString},smalltalk.SmalltalkImage)})},
 args: ["aString"],
 source: "addGlobalJsVariable: aString\x0a\x09self globalJsVariables add: aString",
 messageSends: ["add:", "globalJsVariables"],
 referencedClasses: []
 }),
-smalltalk.Smalltalk);
+smalltalk.SmalltalkImage);
 
 smalltalk.addMethod(
 smalltalk.method({
@@ -2012,13 +2002,13 @@ return smalltalk.withContext(function($ctx1) {
 var $1;
 $1=self._at_("amdRequire");
 return $1;
-}, function($ctx1) {$ctx1.fill(self,"amdRequire",{},smalltalk.Smalltalk)})},
+}, function($ctx1) {$ctx1.fill(self,"amdRequire",{},smalltalk.SmalltalkImage)})},
 args: [],
 source: "amdRequire\x0a\x09^ self at: 'amdRequire'",
 messageSends: ["at:"],
 referencedClasses: []
 }),
-smalltalk.Smalltalk);
+smalltalk.SmalltalkImage);
 
 smalltalk.addMethod(
 smalltalk.method({
@@ -2040,13 +2030,13 @@ $1=anObject;
 $1=_st($JavaScriptException())._on_(anObject);
 };
 return $1;
-}, function($ctx1) {$ctx1.fill(self,"asSmalltalkException:",{anObject:anObject},smalltalk.Smalltalk)})},
+}, function($ctx1) {$ctx1.fill(self,"asSmalltalkException:",{anObject:anObject},smalltalk.SmalltalkImage)})},
 args: ["anObject"],
 source: "asSmalltalkException: anObject\x0a\x09\x22A JavaScript exception may be thrown.\x0a\x09We then need to convert it back to a Smalltalk object\x22\x0a\x09\x0a\x09^ ((self isSmalltalkObject: anObject) and: [ anObject isKindOf: Error ])\x0a\x09\x09ifTrue: [ anObject ]\x0a\x09\x09ifFalse: [ JavaScriptException on: anObject ]",
 messageSends: ["ifTrue:ifFalse:", "and:", "isSmalltalkObject:", "isKindOf:", "on:"],
 referencedClasses: ["Error", "JavaScriptException"]
 }),
-smalltalk.Smalltalk);
+smalltalk.SmalltalkImage);
 
 smalltalk.addMethod(
 smalltalk.method({
@@ -2056,13 +2046,13 @@ fn: function (aString){
 var self=this;
 return smalltalk.withContext(function($ctx1) { 
 return smalltalk[aString];
-return self}, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},smalltalk.Smalltalk)})},
+return self}, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},smalltalk.SmalltalkImage)})},
 args: ["aString"],
 source: "at: aString\x0a\x09<return smalltalk[aString]>",
 messageSends: [],
 referencedClasses: []
 }),
-smalltalk.Smalltalk);
+smalltalk.SmalltalkImage);
 
 smalltalk.addMethod(
 smalltalk.method({
@@ -2079,13 +2069,13 @@ $1=self._at_(aKey);
 $1=_st(aBlock)._value();
 };
 return $1;
-}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},smalltalk.Smalltalk)})},
+}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},smalltalk.SmalltalkImage)})},
 args: ["aKey", "aBlock"],
 source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self at: aKey ]\x0a\x09\x09ifFalse: [ aBlock value ]",
 messageSends: ["ifTrue:ifFalse:", "includesKey:", "at:", "value"],
 referencedClasses: []
 }),
-smalltalk.Smalltalk);
+smalltalk.SmalltalkImage);
 
 smalltalk.addMethod(
 smalltalk.method({
@@ -2095,13 +2085,13 @@ fn: function (aString,anObject){
 var self=this;
 return smalltalk.withContext(function($ctx1) { 
 return smalltalk[aString]=anObject;
-return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{aString:aString,anObject:anObject},smalltalk.Smalltalk)})},
+return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{aString:aString,anObject:anObject},smalltalk.SmalltalkImage)})},
 args: ["aString", "anObject"],
 source: "at: aString put: anObject\x0a\x09<return smalltalk[aString]=anObject>",
 messageSends: [],
 referencedClasses: []
 }),
-smalltalk.Smalltalk);
+smalltalk.SmalltalkImage);
 
 smalltalk.addMethod(
 smalltalk.method({
@@ -2111,13 +2101,13 @@ fn: function (packageName){
 var self=this;
 return smalltalk.withContext(function($ctx1) { 
 return smalltalk.addPackage(packageName);
-return self}, function($ctx1) {$ctx1.fill(self,"basicCreatePackage:",{packageName:packageName},smalltalk.Smalltalk)})},
+return self}, function($ctx1) {$ctx1.fill(self,"basicCreatePackage:",{packageName:packageName},smalltalk.SmalltalkImage)})},
 args: ["packageName"],
 source: "basicCreatePackage: packageName\x0a\x09\x22Create and bind a new bare package with given name and return it.\x22\x0a\x09<return smalltalk.addPackage(packageName)>",
 messageSends: [],
 referencedClasses: []
 }),
-smalltalk.Smalltalk);
+smalltalk.SmalltalkImage);
 
 smalltalk.addMethod(
 smalltalk.method({
@@ -2127,13 +2117,13 @@ fn: function (aString){
 var self=this;
 return smalltalk.withContext(function($ctx1) { 
 return smalltalk.parser.parse(aString);
-return self}, function($ctx1) {$ctx1.fill(self,"basicParse:",{aString:aString},smalltalk.Smalltalk)})},
+return self}, function($ctx1) {$ctx1.fill(self,"basicParse:",{aString:aString},smalltalk.SmalltalkImage)})},
 args: ["aString"],
 source: "basicParse: aString\x0a\x09<return smalltalk.parser.parse(aString)>",
 messageSends: [],
 referencedClasses: []
 }),
-smalltalk.Smalltalk);
+smalltalk.SmalltalkImage);
 
 smalltalk.addMethod(
 smalltalk.method({
@@ -2143,13 +2133,13 @@ fn: function (){
 var self=this;
 return smalltalk.withContext(function($ctx1) { 
 return smalltalk.classes();
-return self}, function($ctx1) {$ctx1.fill(self,"classes",{},smalltalk.Smalltalk)})},
+return self}, function($ctx1) {$ctx1.fill(self,"classes",{},smalltalk.SmalltalkImage)})},
 args: [],
 source: "classes\x0a\x09<return smalltalk.classes()>",
 messageSends: [],
 referencedClasses: []
 }),
-smalltalk.Smalltalk);
+smalltalk.SmalltalkImage);
 
 smalltalk.addMethod(
 smalltalk.method({
@@ -2170,13 +2160,13 @@ announcement=$2;
 _st(_st($SystemAnnouncer())._current())._announce_(announcement);
 $3=package_;
 return $3;
-}, function($ctx1) {$ctx1.fill(self,"createPackage:",{packageName:packageName,package_:package_,announcement:announcement},smalltalk.Smalltalk)})},
+}, function($ctx1) {$ctx1.fill(self,"createPackage:",{packageName:packageName,package_:package_,announcement:announcement},smalltalk.SmalltalkImage)})},
 args: ["packageName"],
 source: "createPackage: packageName\x0a\x09| package announcement |\x0a\x09\x0a\x09package := self basicCreatePackage: packageName.\x0a\x09announcement := PackageAdded new\x0a\x09\x09package: package;\x0a\x09\x09yourself.\x0a\x09\x09\x0a\x09SystemAnnouncer current announce: announcement.\x0a\x09\x0a\x09^ package",
 messageSends: ["basicCreatePackage:", "package:", "new", "yourself", "announce:", "current"],
 referencedClasses: ["PackageAdded", "SystemAnnouncer"]
 }),
-smalltalk.Smalltalk);
+smalltalk.SmalltalkImage);
 
 smalltalk.addMethod(
 smalltalk.method({
@@ -2193,13 +2183,30 @@ self._error_("createPackage:properties: called with nonempty properties");
 };
 $2=self._createPackage_(packageName);
 return $2;
-}, function($ctx1) {$ctx1.fill(self,"createPackage:properties:",{packageName:packageName,aDict:aDict},smalltalk.Smalltalk)})},
+}, function($ctx1) {$ctx1.fill(self,"createPackage:properties:",{packageName:packageName,aDict:aDict},smalltalk.SmalltalkImage)})},
 args: ["packageName", "aDict"],
 source: "createPackage: packageName properties: aDict\x0a\x09\x22Needed to import .st files: they begin with this call.\x22\x0a\x09self deprecatedAPI.\x0a\x09\x0a\x09aDict isEmpty ifFalse: [ self error: 'createPackage:properties: called with nonempty properties' ].\x0a\x09^ self createPackage: packageName",
 messageSends: ["deprecatedAPI", "ifFalse:", "isEmpty", "error:", "createPackage:"],
 referencedClasses: []
 }),
-smalltalk.Smalltalk);
+smalltalk.SmalltalkImage);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "current",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._deprecatedAPI();
+return self;
+}, function($ctx1) {$ctx1.fill(self,"current",{},smalltalk.SmalltalkImage)})},
+args: [],
+source: "current\x0a\x09\x22Backward compatibility for Smalltalk current ...\x22\x0a\x09self deprecatedAPI.\x0a\x09^ self",
+messageSends: ["deprecatedAPI"],
+referencedClasses: []
+}),
+smalltalk.SmalltalkImage);
 
 smalltalk.addMethod(
 smalltalk.method({
@@ -2211,13 +2218,13 @@ return smalltalk.withContext(function($ctx1) {
 var $1;
 $1=self._at_("defaultAmdNamespace");
 return $1;
-}, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace",{},smalltalk.Smalltalk)})},
+}, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace",{},smalltalk.SmalltalkImage)})},
 args: [],
 source: "defaultAmdNamespace\x0a\x09^ self at: 'defaultAmdNamespace'",
 messageSends: ["at:"],
 referencedClasses: []
 }),
-smalltalk.Smalltalk);
+smalltalk.SmalltalkImage);
 
 smalltalk.addMethod(
 smalltalk.method({
@@ -2227,13 +2234,13 @@ fn: function (aString){
 var self=this;
 return smalltalk.withContext(function($ctx1) { 
 self._at_put_("defaultAmdNamespace",aString);
-return self}, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace:",{aString:aString},smalltalk.Smalltalk)})},
+return self}, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace:",{aString:aString},smalltalk.SmalltalkImage)})},
 args: ["aString"],
 source: "defaultAmdNamespace: aString\x0a\x09self at: 'defaultAmdNamespace' put: aString",
 messageSends: ["at:put:"],
 referencedClasses: []
 }),
-smalltalk.Smalltalk);
+smalltalk.SmalltalkImage);
 
 smalltalk.addMethod(
 smalltalk.method({
@@ -2243,13 +2250,13 @@ fn: function (aClass){
 var self=this;
 return smalltalk.withContext(function($ctx1) { 
 smalltalk.removeClass(aClass);
-return self}, function($ctx1) {$ctx1.fill(self,"deleteClass:",{aClass:aClass},smalltalk.Smalltalk)})},
+return self}, function($ctx1) {$ctx1.fill(self,"deleteClass:",{aClass:aClass},smalltalk.SmalltalkImage)})},
 args: ["aClass"],
 source: "deleteClass: aClass\x0a\x09\x22Deletes a class by deleting its binding only. Use #removeClass instead\x22\x0a\x09\x0a\x09<smalltalk.removeClass(aClass)>",
 messageSends: [],
 referencedClasses: []
 }),
-smalltalk.Smalltalk);
+smalltalk.SmalltalkImage);
 
 smalltalk.addMethod(
 smalltalk.method({
@@ -2261,13 +2268,13 @@ return smalltalk.withContext(function($ctx1) {
 _st(self._globalJsVariables())._remove_ifAbsent_(aString,(function(){
 return smalltalk.withContext(function($ctx2) {
 }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
-return self}, function($ctx1) {$ctx1.fill(self,"deleteGlobalJsVariable:",{aString:aString},smalltalk.Smalltalk)})},
+return self}, function($ctx1) {$ctx1.fill(self,"deleteGlobalJsVariable:",{aString:aString},smalltalk.SmalltalkImage)})},
 args: ["aString"],
 source: "deleteGlobalJsVariable: aString\x0a\x09self globalJsVariables remove: aString ifAbsent:[]",
 messageSends: ["remove:ifAbsent:", "globalJsVariables"],
 referencedClasses: []
 }),
-smalltalk.Smalltalk);
+smalltalk.SmalltalkImage);
 
 smalltalk.addMethod(
 smalltalk.method({
@@ -2277,13 +2284,13 @@ fn: function (packageName){
 var self=this;
 return smalltalk.withContext(function($ctx1) { 
 delete smalltalk.packages[packageName];
-return self}, function($ctx1) {$ctx1.fill(self,"deletePackage:",{packageName:packageName},smalltalk.Smalltalk)})},
+return self}, function($ctx1) {$ctx1.fill(self,"deletePackage:",{packageName:packageName},smalltalk.SmalltalkImage)})},
 args: ["packageName"],
 source: "deletePackage: packageName\x0a\x09\x22Deletes a package by deleting its binding, but does not check if it contains classes etc.\x0a\x09To remove a package, use #removePackage instead.\x22\x0a\x0a\x09<delete smalltalk.packages[packageName]>",
 messageSends: [],
 referencedClasses: []
 }),
-smalltalk.Smalltalk);
+smalltalk.SmalltalkImage);
 
 smalltalk.addMethod(
 smalltalk.method({
@@ -2293,13 +2300,29 @@ fn: function (){
 var self=this;
 return smalltalk.withContext(function($ctx1) { 
 return smalltalk.globalJsVariables;
-return self}, function($ctx1) {$ctx1.fill(self,"globalJsVariables",{},smalltalk.Smalltalk)})},
+return self}, function($ctx1) {$ctx1.fill(self,"globalJsVariables",{},smalltalk.SmalltalkImage)})},
 args: [],
 source: "globalJsVariables\x0a\x09\x22Array of global JavaScript variables\x22\x0a\x09<return smalltalk.globalJsVariables>",
 messageSends: [],
 referencedClasses: []
 }),
-smalltalk.Smalltalk);
+smalltalk.SmalltalkImage);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "globals",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return self;
+}, function($ctx1) {$ctx1.fill(self,"globals",{},smalltalk.SmalltalkImage)})},
+args: [],
+source: "globals\x0a\x09\x22Future compatibility to be able to use Smalltalk globals at: ...\x22\x0a\x09^ self",
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.SmalltalkImage);
 
 smalltalk.addMethod(
 smalltalk.method({
@@ -2309,13 +2332,13 @@ fn: function (aKey){
 var self=this;
 return smalltalk.withContext(function($ctx1) { 
 return smalltalk.hasOwnProperty(aKey);
-return self}, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},smalltalk.Smalltalk)})},
+return self}, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},smalltalk.SmalltalkImage)})},
 args: ["aKey"],
 source: "includesKey: aKey\x0a\x09<return smalltalk.hasOwnProperty(aKey)>",
 messageSends: [],
 referencedClasses: []
 }),
-smalltalk.Smalltalk);
+smalltalk.SmalltalkImage);
 
 smalltalk.addMethod(
 smalltalk.method({
@@ -2325,13 +2348,13 @@ fn: function (anObject){
 var self=this;
 return smalltalk.withContext(function($ctx1) { 
 return typeof anObject.klass !== 'undefined';
-return self}, function($ctx1) {$ctx1.fill(self,"isSmalltalkObject:",{anObject:anObject},smalltalk.Smalltalk)})},
+return self}, function($ctx1) {$ctx1.fill(self,"isSmalltalkObject:",{anObject:anObject},smalltalk.SmalltalkImage)})},
 args: ["anObject"],
 source: "isSmalltalkObject: anObject\x0a\x09\x22Consider anObject a Smalltalk object if it has a 'klass' property.\x0a\x09Note that this may be unaccurate\x22\x0a\x09\x0a\x09<return typeof anObject.klass !== 'undefined'>",
 messageSends: [],
 referencedClasses: []
 }),
-smalltalk.Smalltalk);
+smalltalk.SmalltalkImage);
 
 smalltalk.addMethod(
 smalltalk.method({
@@ -2341,13 +2364,13 @@ fn: function (packageName){
 var self=this;
 return smalltalk.withContext(function($ctx1) { 
 return smalltalk.packages[packageName];
-return self}, function($ctx1) {$ctx1.fill(self,"packageAt:",{packageName:packageName},smalltalk.Smalltalk)})},
+return self}, function($ctx1) {$ctx1.fill(self,"packageAt:",{packageName:packageName},smalltalk.SmalltalkImage)})},
 args: ["packageName"],
 source: "packageAt: packageName\x0a\x09<return smalltalk.packages[packageName]>",
 messageSends: [],
 referencedClasses: []
 }),
-smalltalk.Smalltalk);
+smalltalk.SmalltalkImage);
 
 smalltalk.addMethod(
 smalltalk.method({
@@ -2360,13 +2383,13 @@ var $2,$1;
 $2=self._packageAt_(packageName);
 $1=_st($2)._ifNil_(aBlock);
 return $1;
-}, function($ctx1) {$ctx1.fill(self,"packageAt:ifAbsent:",{packageName:packageName,aBlock:aBlock},smalltalk.Smalltalk)})},
+}, function($ctx1) {$ctx1.fill(self,"packageAt:ifAbsent:",{packageName:packageName,aBlock:aBlock},smalltalk.SmalltalkImage)})},
 args: ["packageName", "aBlock"],
 source: "packageAt: packageName ifAbsent: aBlock\x0a\x09^ (self packageAt: packageName) ifNil: aBlock",
 messageSends: ["ifNil:", "packageAt:"],
 referencedClasses: []
 }),
-smalltalk.Smalltalk);
+smalltalk.SmalltalkImage);
 
 smalltalk.addMethod(
 smalltalk.method({
@@ -2380,13 +2403,13 @@ return smalltalk.withContext(function($ctx1) {
 			return smalltalk.packages[k];
 		})
 	;
-return self}, function($ctx1) {$ctx1.fill(self,"packages",{},smalltalk.Smalltalk)})},
+return self}, function($ctx1) {$ctx1.fill(self,"packages",{},smalltalk.SmalltalkImage)})},
 args: [],
 source: "packages\x0a\x09\x22Return all Package instances in the system.\x22\x0a\x0a\x09<\x0a\x09\x09return Object.keys(smalltalk.packages).map(function(k) {\x0a\x09\x09\x09return smalltalk.packages[k];\x0a\x09\x09})\x0a\x09>",
 messageSends: [],
 referencedClasses: []
 }),
-smalltalk.Smalltalk);
+smalltalk.SmalltalkImage);
 
 smalltalk.addMethod(
 smalltalk.method({
@@ -2410,13 +2433,13 @@ _st($2)._source_(aString);
 $3=_st($2)._yourself();
 $1=$3;
 return $1;
-}, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString,result:result},smalltalk.Smalltalk)})},
+}, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString,result:result},smalltalk.SmalltalkImage)})},
 args: ["aString"],
 source: "parse: aString\x0a\x09| result |\x0a\x09\x0a\x09self \x0a\x09\x09try: [ result := self basicParse: aString ] \x0a\x09\x09catch: [ :ex | (self parseError: ex parsing: aString) signal ].\x0a\x09\x09\x0a\x09^ result\x0a\x09\x09source: aString;\x0a\x09\x09yourself",
 messageSends: ["try:catch:", "basicParse:", "signal", "parseError:parsing:", "source:", "yourself"],
 referencedClasses: []
 }),
-smalltalk.Smalltalk);
+smalltalk.SmalltalkImage);
 
 smalltalk.addMethod(
 smalltalk.method({
@@ -2443,13 +2466,13 @@ $3=_st($4).__comma(_st(anException)._basicAt_("found"));
 $ctx1.sendIdx[","]=1;
 $1=_st($2)._messageText_($3);
 return $1;
-}, function($ctx1) {$ctx1.fill(self,"parseError:parsing:",{anException:anException,aString:aString},smalltalk.Smalltalk)})},
+}, function($ctx1) {$ctx1.fill(self,"parseError:parsing:",{anException:anException,aString:aString},smalltalk.SmalltalkImage)})},
 args: ["anException", "aString"],
 source: "parseError: anException parsing: aString\x0a\x09^ ParseError new messageText: 'Parse error on line ', (anException basicAt: 'line') ,' column ' , (anException basicAt: 'column') ,' : Unexpected character ', (anException basicAt: 'found')",
 messageSends: ["messageText:", "new", ",", "basicAt:"],
 referencedClasses: ["ParseError"]
 }),
-smalltalk.Smalltalk);
+smalltalk.SmalltalkImage);
 
 smalltalk.addMethod(
 smalltalk.method({
@@ -2461,13 +2484,13 @@ return smalltalk.withContext(function($ctx1) {
 var $1;
 $1=["self", "super", "nil", "true", "false", "thisContext"];
 return $1;
-}, function($ctx1) {$ctx1.fill(self,"pseudoVariableNames",{},smalltalk.Smalltalk)})},
+}, function($ctx1) {$ctx1.fill(self,"pseudoVariableNames",{},smalltalk.SmalltalkImage)})},
 args: [],
 source: "pseudoVariableNames\x0a\x09^ #('self' 'super' 'nil' 'true' 'false' 'thisContext')",
 messageSends: [],
 referencedClasses: []
 }),
-smalltalk.Smalltalk);
+smalltalk.SmalltalkImage);
 
 smalltalk.addMethod(
 smalltalk.method({
@@ -2477,13 +2500,13 @@ fn: function (anObject){
 var self=this;
 return smalltalk.withContext(function($ctx1) { 
 return smalltalk.readJSObject(anObject);
-return self}, function($ctx1) {$ctx1.fill(self,"readJSObject:",{anObject:anObject},smalltalk.Smalltalk)})},
+return self}, function($ctx1) {$ctx1.fill(self,"readJSObject:",{anObject:anObject},smalltalk.SmalltalkImage)})},
 args: ["anObject"],
 source: "readJSObject: anObject\x0a\x09<return smalltalk.readJSObject(anObject)>",
 messageSends: [],
 referencedClasses: []
 }),
-smalltalk.Smalltalk);
+smalltalk.SmalltalkImage);
 
 smalltalk.addMethod(
 smalltalk.method({
@@ -2504,13 +2527,13 @@ $2=_st($ClassRemoved())._new();
 _st($2)._theClass_(aClass);
 $3=_st($2)._yourself();
 _st(_st($SystemAnnouncer())._current())._announce_($3);
-return self}, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},smalltalk.Smalltalk)})},
+return self}, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},smalltalk.SmalltalkImage)})},
 args: ["aClass"],
 source: "removeClass: aClass\x0a\x09aClass isMetaclass ifTrue: [ self error: aClass asString, ' is a Metaclass and cannot be removed!' ].\x0a\x09\x0a\x09self deleteClass: aClass.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassRemoved new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
 messageSends: ["ifTrue:", "isMetaclass", "error:", ",", "asString", "deleteClass:", "announce:", "current", "theClass:", "new", "yourself"],
 referencedClasses: ["SystemAnnouncer", "ClassRemoved"]
 }),
-smalltalk.Smalltalk);
+smalltalk.SmalltalkImage);
 
 smalltalk.addMethod(
 smalltalk.method({
@@ -2529,13 +2552,13 @@ return smalltalk.withContext(function($ctx2) {
 return self._removeClass_(each);
 }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
 self._deletePackage_(packageName);
-return self}, function($ctx1) {$ctx1.fill(self,"removePackage:",{packageName:packageName,pkg:pkg},smalltalk.Smalltalk)})},
+return self}, function($ctx1) {$ctx1.fill(self,"removePackage:",{packageName:packageName,pkg:pkg},smalltalk.SmalltalkImage)})},
 args: ["packageName"],
 source: "removePackage: packageName\x0a\x09\x22Removes a package and all its classes.\x22\x0a\x0a\x09| pkg |\x0a\x09pkg := self packageAt: packageName ifAbsent: [ self error: 'Missing package: ', packageName ].\x0a\x09pkg classes do: [ :each |\x0a\x09\x09\x09self removeClass: each ].\x0a\x09self deletePackage: packageName",
 messageSends: ["packageAt:ifAbsent:", "error:", ",", "do:", "classes", "removeClass:", "deletePackage:"],
 referencedClasses: []
 }),
-smalltalk.Smalltalk);
+smalltalk.SmalltalkImage);
 
 smalltalk.addMethod(
 smalltalk.method({
@@ -2562,13 +2585,13 @@ self._error_("Already exists a package called: ".__comma(newName));
 _st(self._at_("packages"))._at_put_(newName,pkg);
 _st(pkg)._name_(newName);
 self._deletePackage_(packageName);
-return self}, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{packageName:packageName,newName:newName,pkg:pkg},smalltalk.Smalltalk)})},
+return self}, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{packageName:packageName,newName:newName,pkg:pkg},smalltalk.SmalltalkImage)})},
 args: ["packageName", "newName"],
 source: "renamePackage: packageName to: newName\x0a\x09\x22Rename a package.\x22\x0a\x0a\x09| pkg |\x0a\x09pkg := self packageAt: packageName ifAbsent: [ self error: 'Missing package: ', packageName ].\x0a\x09(self packageAt: newName) ifNotNil: [ self error: 'Already exists a package called: ', newName ].\x0a\x09(self at: 'packages') at: newName put: pkg.\x0a\x09pkg name: newName.\x0a\x09self deletePackage: packageName.",
 messageSends: ["packageAt:ifAbsent:", "error:", ",", "ifNotNil:", "packageAt:", "at:put:", "at:", "name:", "deletePackage:"],
 referencedClasses: []
 }),
-smalltalk.Smalltalk);
+smalltalk.SmalltalkImage);
 
 smalltalk.addMethod(
 smalltalk.method({
@@ -2578,13 +2601,13 @@ fn: function (){
 var self=this;
 return smalltalk.withContext(function($ctx1) { 
 return smalltalk.reservedWords;
-return self}, function($ctx1) {$ctx1.fill(self,"reservedWords",{},smalltalk.Smalltalk)})},
+return self}, function($ctx1) {$ctx1.fill(self,"reservedWords",{},smalltalk.SmalltalkImage)})},
 args: [],
 source: "reservedWords\x0a\x09\x22JavaScript reserved words\x22\x0a\x09<return smalltalk.reservedWords>",
 messageSends: [],
 referencedClasses: []
 }),
-smalltalk.Smalltalk);
+smalltalk.SmalltalkImage);
 
 smalltalk.addMethod(
 smalltalk.method({
@@ -2594,16 +2617,32 @@ fn: function (){
 var self=this;
 return smalltalk.withContext(function($ctx1) { 
 return "0.13.0-pre";
-}, function($ctx1) {$ctx1.fill(self,"version",{},smalltalk.Smalltalk)})},
+}, function($ctx1) {$ctx1.fill(self,"version",{},smalltalk.SmalltalkImage)})},
 args: [],
 source: "version\x0a\x09\x22Answer the version string of Amber\x22\x0a\x09\x0a\x09^ '0.13.0-pre'",
 messageSends: [],
 referencedClasses: []
 }),
-smalltalk.Smalltalk);
+smalltalk.SmalltalkImage);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "vm",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return smalltalk;
+return self}, function($ctx1) {$ctx1.fill(self,"vm",{},smalltalk.SmalltalkImage)})},
+args: [],
+source: "vm\x0a\x09\x22Future compatibility to be able to use Smalltalk vm ...\x22\x0a\x09<return smalltalk>",
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.SmalltalkImage);
 
 
-smalltalk.Smalltalk.klass.iVarNames = ['current'];
+smalltalk.SmalltalkImage.klass.iVarNames = ['current'];
 smalltalk.addMethod(
 smalltalk.method({
 selector: "current",
@@ -2614,19 +2653,36 @@ return smalltalk.withContext(function($ctx1) {
 var $2,$1;
 $2=self["@current"];
 if(($receiver = $2) == nil || $receiver == null){
-self["@current"]=smalltalk.Smalltalk.klass.superclass.fn.prototype._new.apply(_st(self), []);
+self["@current"]=smalltalk.SmalltalkImage.klass.superclass.fn.prototype._new.apply(_st(self), []);
 $1=self["@current"];
 } else {
-$1=$2;
+self._deprecatedAPI();
+$1=self["@current"];
 };
 return $1;
-}, function($ctx1) {$ctx1.fill(self,"current",{},smalltalk.Smalltalk.klass)})},
+}, function($ctx1) {$ctx1.fill(self,"current",{},smalltalk.SmalltalkImage.klass)})},
 args: [],
-source: "current\x0a\x09^ current ifNil: [ current := super new ]",
-messageSends: ["ifNil:", "new"],
+source: "current\x0a\x09^ current ifNil: [ current := super new ] ifNotNil: [ self deprecatedAPI. current ]",
+messageSends: ["ifNil:ifNotNil:", "new", "deprecatedAPI"],
+referencedClasses: []
+}),
+smalltalk.SmalltalkImage.klass);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "initialize",
+protocol: 'initialization',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+_st(smalltalk)._at_put_("Smalltalk",self._current());
+return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.SmalltalkImage.klass)})},
+args: [],
+source: "initialize\x0a\x09smalltalk at: 'Smalltalk' put: self current",
+messageSends: ["at:put:", "current"],
 referencedClasses: []
 }),
-smalltalk.Smalltalk.klass);
+smalltalk.SmalltalkImage.klass);
 
 smalltalk.addMethod(
 smalltalk.method({
@@ -2636,13 +2692,13 @@ fn: function (){
 var self=this;
 return smalltalk.withContext(function($ctx1) { 
 self._shouldNotImplement();
-return self}, function($ctx1) {$ctx1.fill(self,"new",{},smalltalk.Smalltalk.klass)})},
+return self}, function($ctx1) {$ctx1.fill(self,"new",{},smalltalk.SmalltalkImage.klass)})},
 args: [],
 source: "new\x0a\x09self shouldNotImplement",
 messageSends: ["shouldNotImplement"],
 referencedClasses: []
 }),
-smalltalk.Smalltalk.klass);
+smalltalk.SmalltalkImage.klass);
 
 smalltalk.addMethod(
 smalltalk.method({

+ 3 - 3
js/Kernel-Methods.js

@@ -227,7 +227,7 @@ var $2,$1;
 $1=self._try_catch_(self,(function(error){
 var smalltalkError;
 return smalltalk.withContext(function($ctx2) {
-smalltalkError=_st(_st($Smalltalk())._current())._asSmalltalkException_(error);
+smalltalkError=_st($Smalltalk())._asSmalltalkException_(error);
 smalltalkError;
 $2=_st(smalltalkError)._isKindOf_(anErrorClass);
 if(smalltalk.assert($2)){
@@ -239,8 +239,8 @@ return _st(smalltalkError)._resignal();
 return $1;
 }, function($ctx1) {$ctx1.fill(self,"on:do:",{anErrorClass:anErrorClass,aBlock:aBlock},smalltalk.BlockClosure)})},
 args: ["anErrorClass", "aBlock"],
-source: "on: anErrorClass do: aBlock\x0a\x09\x22All exceptions thrown in the Smalltalk stack are cought.\x0a\x09Convert all JS exceptions to JavaScriptException instances.\x22\x0a\x09\x0a\x09^ self try: self catch: [ :error | | smalltalkError |\x0a\x09\x09smalltalkError := Smalltalk current asSmalltalkException: error.\x0a\x09\x09(smalltalkError isKindOf: anErrorClass)\x0a\x09\x09ifTrue: [ aBlock value: smalltalkError ]\x0a\x09\x09ifFalse: [ smalltalkError resignal ] ]",
-messageSends: ["try:catch:", "asSmalltalkException:", "current", "ifTrue:ifFalse:", "isKindOf:", "value:", "resignal"],
+source: "on: anErrorClass do: aBlock\x0a\x09\x22All exceptions thrown in the Smalltalk stack are cought.\x0a\x09Convert all JS exceptions to JavaScriptException instances.\x22\x0a\x09\x0a\x09^ self try: self catch: [ :error | | smalltalkError |\x0a\x09\x09smalltalkError := Smalltalk asSmalltalkException: error.\x0a\x09\x09(smalltalkError isKindOf: anErrorClass)\x0a\x09\x09ifTrue: [ aBlock value: smalltalkError ]\x0a\x09\x09ifFalse: [ smalltalkError resignal ] ]",
+messageSends: ["try:catch:", "asSmalltalkException:", "ifTrue:ifFalse:", "isKindOf:", "value:", "resignal"],
 referencedClasses: ["Smalltalk"]
 }),
 smalltalk.BlockClosure);

+ 36 - 46
js/Kernel-Tests.js

@@ -1029,14 +1029,14 @@ $1=self["@theClass"];
 if(($receiver = $1) == nil || $receiver == null){
 $1;
 } else {
-_st(_st($Smalltalk())._current())._removeClass_(self["@theClass"]);
+_st($Smalltalk())._removeClass_(self["@theClass"]);
 self["@theClass"]=nil;
 self["@theClass"];
 };
 return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},smalltalk.ClassBuilderTest)})},
 args: [],
-source: "tearDown\x0a\x09theClass ifNotNil: [ Smalltalk current removeClass: theClass. theClass := nil ]",
-messageSends: ["ifNotNil:", "removeClass:", "current"],
+source: "tearDown\x0a\x09theClass ifNotNil: [ Smalltalk removeClass: theClass. theClass := nil ]",
+messageSends: ["ifNotNil:", "removeClass:"],
 referencedClasses: ["Smalltalk"]
 }),
 smalltalk.ClassBuilderTest);
@@ -1093,15 +1093,15 @@ function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefin
 function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
 function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
 return smalltalk.withContext(function($ctx1) { 
-var $2,$1,$4,$3,$5,$6,$7,$8,$9,$11,$10,$14,$13,$12;
+var $2,$1,$4,$3,$5,$6,$7,$8,$9,$11,$10;
 oldClass=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
-$2=_st($Smalltalk())._current();
-$ctx1.sendIdx["current"]=1;
+$2=_st($Smalltalk())._globals();
+$ctx1.sendIdx["globals"]=1;
 $1=_st($2)._at_("ObjectMock2");
 $ctx1.sendIdx["at:"]=1;
 instance=_st($1)._new();
-$4=_st($Smalltalk())._current();
-$ctx1.sendIdx["current"]=2;
+$4=_st($Smalltalk())._globals();
+$ctx1.sendIdx["globals"]=2;
 $3=_st($4)._at_("ObjectMock2");
 $ctx1.sendIdx["at:"]=2;
 _st($ObjectMock())._subclass_instanceVariableNames_package_($3,"","Kernel-Tests");
@@ -1130,16 +1130,12 @@ $11=_st(instance)._class();
 $ctx1.sendIdx["class"]=1;
 $10=_st($11).__eq_eq($ObjectMock2());
 self._deny_($10);
-$14=_st($Smalltalk())._current();
-$ctx1.sendIdx["current"]=3;
-$13=_st($14)._at_(_st(_st(instance)._class())._name());
-$12=_st($13)._isNil();
-self._assert_($12);
-_st(_st($Smalltalk())._current())._removeClass_($ObjectMock2());
+self._assert_(_st(_st(_st($Smalltalk())._globals())._at_(_st(_st(instance)._class())._name()))._isNil());
+_st($Smalltalk())._removeClass_($ObjectMock2());
 return self}, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},smalltalk.ClassBuilderTest)})},
 args: [],
-source: "testClassMigration\x0a\x09| instance oldClass |\x0a\x09\x0a\x09oldClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09instance := (Smalltalk current at: 'ObjectMock2') new.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk current at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self deny: oldClass == ObjectMock2.\x0a\x09\x0a\x09self assert: ObjectMock2 superclass == ObjectMock.\x0a\x09self assert: ObjectMock2 instanceVariableNames isEmpty.\x0a\x09self assert: ObjectMock2 selectors equals: oldClass selectors.\x0a\x09self assert: ObjectMock2 comment equals: oldClass comment.\x0a\x09self assert: ObjectMock2 package name equals: 'Kernel-Tests'.\x0a\x09\x0a\x09self deny: instance class == ObjectMock2.\x0a\x09\x22Commeting this out. Tests implementation detail.\x22\x0a\x09\x22self assert: instance class name equals: 'OldObjectMock2'.\x22\x0a\x09\x0a\x09self assert: (Smalltalk current at: instance class name) isNil.\x0a\x09\x0a\x09Smalltalk current removeClass: ObjectMock2",
-messageSends: ["copyClass:named:", "new", "at:", "current", "subclass:instanceVariableNames:package:", "deny:", "==", "assert:", "superclass", "isEmpty", "instanceVariableNames", "assert:equals:", "selectors", "comment", "name", "package", "class", "isNil", "removeClass:"],
+source: "testClassMigration\x0a\x09| instance oldClass |\x0a\x09\x0a\x09oldClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09instance := (Smalltalk globals at: 'ObjectMock2') new.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk globals at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self deny: oldClass == ObjectMock2.\x0a\x09\x0a\x09self assert: ObjectMock2 superclass == ObjectMock.\x0a\x09self assert: ObjectMock2 instanceVariableNames isEmpty.\x0a\x09self assert: ObjectMock2 selectors equals: oldClass selectors.\x0a\x09self assert: ObjectMock2 comment equals: oldClass comment.\x0a\x09self assert: ObjectMock2 package name equals: 'Kernel-Tests'.\x0a\x09\x0a\x09self deny: instance class == ObjectMock2.\x0a\x09\x22Commeting this out. Tests implementation detail.\x22\x0a\x09\x22self assert: instance class name equals: 'OldObjectMock2'.\x22\x0a\x09\x0a\x09self assert: (Smalltalk globals at: instance class name) isNil.\x0a\x09\x0a\x09Smalltalk removeClass: ObjectMock2",
+messageSends: ["copyClass:named:", "new", "at:", "globals", "subclass:instanceVariableNames:package:", "deny:", "==", "assert:", "superclass", "isEmpty", "instanceVariableNames", "assert:equals:", "selectors", "comment", "name", "package", "class", "isNil", "removeClass:"],
 referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"]
 }),
 smalltalk.ClassBuilderTest);
@@ -1154,21 +1150,18 @@ function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefin
 function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
 function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
 return smalltalk.withContext(function($ctx1) { 
-var $1,$3,$2;
+var $1;
 _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
 $1=_st($ObjectMock2())._class();
 $ctx1.sendIdx["class"]=1;
 _st($1)._instanceVariableNames_("foo bar");
-$3=_st($Smalltalk())._current();
-$ctx1.sendIdx["current"]=1;
-$2=_st($3)._at_("ObjectMock2");
-_st($ObjectMock())._subclass_instanceVariableNames_package_($2,"","Kernel-Tests");
+_st($ObjectMock())._subclass_instanceVariableNames_package_(_st(_st($Smalltalk())._globals())._at_("ObjectMock2"),"","Kernel-Tests");
 self._assert_equals_(_st(_st($ObjectMock2())._class())._instanceVariableNames(),["foo", "bar"]);
-_st(_st($Smalltalk())._current())._removeClass_($ObjectMock2());
+_st($Smalltalk())._removeClass_($ObjectMock2());
 return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},smalltalk.ClassBuilderTest)})},
 args: [],
-source: "testClassMigrationWithClassInstanceVariables\x0a\x09\x0a\x09builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09ObjectMock2 class instanceVariableNames: 'foo bar'.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk current at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self assert: ObjectMock2 class instanceVariableNames equals: #('foo' 'bar').\x0a\x09\x0a\x09Smalltalk current removeClass: ObjectMock2",
-messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "current", "assert:equals:", "instanceVariableNames", "removeClass:"],
+source: "testClassMigrationWithClassInstanceVariables\x0a\x09\x0a\x09builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09ObjectMock2 class instanceVariableNames: 'foo bar'.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk globals at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self assert: ObjectMock2 class instanceVariableNames equals: #('foo' 'bar').\x0a\x09\x0a\x09Smalltalk removeClass: ObjectMock2",
+messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:equals:", "instanceVariableNames", "removeClass:"],
 referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"]
 }),
 smalltalk.ClassBuilderTest);
@@ -1185,37 +1178,34 @@ function $ObjectMock3(){return smalltalk.ObjectMock3||(typeof ObjectMock3=="unde
 function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
 function $ObjectMock4(){return smalltalk.ObjectMock4||(typeof ObjectMock4=="undefined"?nil:ObjectMock4)}
 return smalltalk.withContext(function($ctx1) { 
-var $2,$1,$4,$3,$6,$5;
+var $2,$1,$4,$3;
 _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
 _st($ObjectMock2())._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
 $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=1;
 _st($ObjectMock3())._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
 $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=2;
-$2=_st($Smalltalk())._current();
-$ctx1.sendIdx["current"]=1;
-$1=_st($2)._at_("ObjectMock2");
-_st($ObjectMock())._subclass_instanceVariableNames_package_($1,"","Kernel-Tests");
-$4=_st($ObjectMock())._subclasses();
+_st($ObjectMock())._subclass_instanceVariableNames_package_(_st(_st($Smalltalk())._globals())._at_("ObjectMock2"),"","Kernel-Tests");
+$2=_st($ObjectMock())._subclasses();
 $ctx1.sendIdx["subclasses"]=1;
-$3=_st($4)._includes_($ObjectMock2());
+$1=_st($2)._includes_($ObjectMock2());
 $ctx1.sendIdx["includes:"]=1;
-self._assert_($3);
+self._assert_($1);
 $ctx1.sendIdx["assert:"]=1;
-$6=_st($ObjectMock2())._subclasses();
+$4=_st($ObjectMock2())._subclasses();
 $ctx1.sendIdx["subclasses"]=2;
-$5=_st($6)._includes_($ObjectMock3());
+$3=_st($4)._includes_($ObjectMock3());
 $ctx1.sendIdx["includes:"]=2;
-self._assert_($5);
+self._assert_($3);
 $ctx1.sendIdx["assert:"]=2;
 self._assert_(_st(_st($ObjectMock3())._subclasses())._includes_($ObjectMock4()));
 _st(_st($ObjectMock())._allSubclasses())._do_((function(each){
 return smalltalk.withContext(function($ctx2) {
-return _st(_st($Smalltalk())._current())._removeClass_(each);
+return _st($Smalltalk())._removeClass_(each);
 }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
 return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},smalltalk.ClassBuilderTest)})},
 args: [],
-source: "testClassMigrationWithSubclasses\x0a\x09\x0a\x09builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09ObjectMock2 subclass: 'ObjectMock3' instanceVariableNames: '' package: 'Kernel-Tests'.\x0a\x09ObjectMock3 subclass: 'ObjectMock4' instanceVariableNames: '' package: 'Kernel-Tests'.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk current at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self assert: (ObjectMock subclasses includes: ObjectMock2).\x0a\x09self assert: (ObjectMock2 subclasses includes: ObjectMock3).\x0a\x09self assert: (ObjectMock3 subclasses includes: ObjectMock4).\x0a\x09\x0a\x09ObjectMock allSubclasses do: [ :each | Smalltalk current removeClass: each ]",
-messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "current", "assert:", "includes:", "subclasses", "do:", "allSubclasses", "removeClass:"],
+source: "testClassMigrationWithSubclasses\x0a\x09\x0a\x09builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09ObjectMock2 subclass: 'ObjectMock3' instanceVariableNames: '' package: 'Kernel-Tests'.\x0a\x09ObjectMock3 subclass: 'ObjectMock4' instanceVariableNames: '' package: 'Kernel-Tests'.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk globals at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self assert: (ObjectMock subclasses includes: ObjectMock2).\x0a\x09self assert: (ObjectMock2 subclasses includes: ObjectMock3).\x0a\x09self assert: (ObjectMock3 subclasses includes: ObjectMock4).\x0a\x09\x0a\x09ObjectMock allSubclasses do: [ :each | Smalltalk removeClass: each ]",
+messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:", "includes:", "subclasses", "do:", "allSubclasses", "removeClass:"],
 referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"]
 }),
 smalltalk.ClassBuilderTest);
@@ -5339,7 +5329,7 @@ function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"
 return smalltalk.withContext(function($ctx1) { 
 var $2,$3,$1;
 $2=_st($Set())._new();
-_st($2)._add_(_st($Smalltalk())._current());
+_st($2)._add_($Smalltalk());
 $ctx1.sendIdx["add:"]=1;
 _st($2)._add_(nil);
 $ctx1.sendIdx["add:"]=2;
@@ -5351,8 +5341,8 @@ $1=$3;
 return $1;
 }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.SetTest)})},
 args: [],
-source: "collection\x0a\x09^ Set new\x0a\x09\x09add: Smalltalk current;\x0a\x09\x09add: nil;\x0a\x09\x09add: 3@3;\x0a\x09\x09add: false;\x0a\x09\x09yourself",
-messageSends: ["add:", "new", "current", "@", "yourself"],
+source: "collection\x0a\x09^ Set new\x0a\x09\x09add: Smalltalk;\x0a\x09\x09add: nil;\x0a\x09\x09add: 3@3;\x0a\x09\x09add: false;\x0a\x09\x09yourself",
+messageSends: ["add:", "new", "@", "yourself"],
 referencedClasses: ["Set", "Smalltalk"]
 }),
 smalltalk.SetTest);
@@ -5367,7 +5357,7 @@ function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
 return smalltalk.withContext(function($ctx1) { 
 var $2,$3,$1;
 $2=_st($Set())._new();
-_st($2)._add_("a Smalltalk");
+_st($2)._add_("a SmalltalkImage");
 $ctx1.sendIdx["add:"]=1;
 _st($2)._add_("nil");
 $ctx1.sendIdx["add:"]=2;
@@ -5379,7 +5369,7 @@ $1=$3;
 return $1;
 }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.SetTest)})},
 args: [],
-source: "collectionOfPrintStrings\x0a\x09^ Set new\x0a\x09\x09add: 'a Smalltalk';\x0a\x09\x09add: 'nil';\x0a\x09\x09add: '3@3';\x0a\x09\x09add: 'false';\x0a\x09\x09yourself",
+source: "collectionOfPrintStrings\x0a\x09^ Set new\x0a\x09\x09add: 'a SmalltalkImage';\x0a\x09\x09add: 'nil';\x0a\x09\x09add: '3@3';\x0a\x09\x09add: 'false';\x0a\x09\x09yourself",
 messageSends: ["add:", "new", "yourself"],
 referencedClasses: ["Set"]
 }),
@@ -5433,7 +5423,7 @@ function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"
 return smalltalk.withContext(function($ctx1) { 
 var $2,$3,$1;
 $2=_st($Set())._new();
-_st($2)._add_(_st($Smalltalk())._current());
+_st($2)._add_($Smalltalk());
 $ctx1.sendIdx["add:"]=1;
 _st($2)._add_(nil);
 $ctx1.sendIdx["add:"]=2;
@@ -5447,8 +5437,8 @@ $1=$3;
 return $1;
 }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.SetTest)})},
 args: [],
-source: "collectionWithNewValue\x0a\x09^ Set new\x0a\x09\x09add: Smalltalk current;\x0a\x09\x09add: nil;\x0a\x09\x09add: 3@3;\x0a\x09\x09add: 'N';\x0a\x09\x09add: false;\x0a\x09\x09yourself",
-messageSends: ["add:", "new", "current", "@", "yourself"],
+source: "collectionWithNewValue\x0a\x09^ Set new\x0a\x09\x09add: Smalltalk;\x0a\x09\x09add: nil;\x0a\x09\x09add: 3@3;\x0a\x09\x09add: 'N';\x0a\x09\x09add: false;\x0a\x09\x09yourself",
+messageSends: ["add:", "new", "@", "yourself"],
 referencedClasses: ["Set", "Smalltalk"]
 }),
 smalltalk.SetTest);

+ 1 - 1
st/Benchfib.st

@@ -1,4 +1,4 @@
-Smalltalk current createPackage: 'Benchfib'!
+Smalltalk createPackage: 'Benchfib'!
 Object subclass: #Benchfib
 	instanceVariableNames: ''
 	package: 'Benchfib'!

+ 1 - 1
st/Canvas.st

@@ -1,4 +1,4 @@
-Smalltalk current createPackage: 'Canvas'!
+Smalltalk createPackage: 'Canvas'!
 Object subclass: #BrowserInterface
 	instanceVariableNames: ''
 	package: 'Canvas'!

+ 2 - 2
st/Compiler-AST.st

@@ -1,4 +1,4 @@
-Smalltalk current createPackage: 'Compiler-AST'!
+Smalltalk createPackage: 'Compiler-AST'!
 Object subclass: #Node
 	instanceVariableNames: 'parent position nodes shouldBeInlined shouldBeAliased'
 	package: 'Compiler-AST'!
@@ -745,6 +745,6 @@ isNode
 ast
 	self source ifEmpty: [ self error: 'Method source is empty' ].
 	
-	^ Smalltalk current parse: self source
+	^ Smalltalk parse: self source
 ! !
 

+ 13 - 11
st/Compiler-Core.st

@@ -1,4 +1,4 @@
-Smalltalk current createPackage: 'Compiler-Core'!
+Smalltalk createPackage: 'Compiler-Core'!
 Object subclass: #AbstractCodeGenerator
 	instanceVariableNames: 'currentClass source'
 	package: 'Compiler-Core'!
@@ -25,13 +25,7 @@ currentClass: aClass
 !
 
 pseudoVariables
-	^ Smalltalk current pseudoVariableNames
-!
-
-safeVariableNameFor: aString
-	^ (Smalltalk current reservedWords includes: aString)
-		ifTrue: [ aString, '_' ]
-		ifFalse: [ aString ]
+	^ Smalltalk pseudoVariableNames
 !
 
 source
@@ -188,7 +182,7 @@ install: aString forClass: aBehavior protocol: anotherString
 !
 
 parse: aString
-	^ Smalltalk current parse: aString
+	^ Smalltalk parse: aString
 !
 
 parseExpression: aString
@@ -207,7 +201,7 @@ recompile: aClass
 !
 
 recompileAll
-	Smalltalk current classes 
+	Smalltalk classes 
 		do: [ :each | self recompile: each ]
 		displayingProgress: 'Compiling all classes...'
 ! !
@@ -219,7 +213,7 @@ recompile: aClass
 !
 
 recompileAll
-	Smalltalk current classes do: [ :each |
+	Smalltalk classes do: [ :each |
 		self recompile: each ]
 ! !
 
@@ -301,3 +295,11 @@ visitVariableNode: aNode
 	^ self visitNode: aNode
 ! !
 
+!String methodsFor: '*Compiler-Core'!
+
+asVariableName
+	^ (Smalltalk reservedWords includes: self)
+		ifTrue: [ self, '_' ]
+		ifFalse: [ self ]
+! !
+

+ 1 - 1
st/Compiler-Exceptions.st

@@ -1,4 +1,4 @@
-Smalltalk current createPackage: 'Compiler-Exceptions'!
+Smalltalk createPackage: 'Compiler-Exceptions'!
 Error subclass: #CompilerError
 	instanceVariableNames: ''
 	package: 'Compiler-Exceptions'!

+ 1 - 9
st/Compiler-IR.st

@@ -1,4 +1,4 @@
-Smalltalk current createPackage: 'Compiler-IR'!
+Smalltalk createPackage: 'Compiler-IR'!
 NodeVisitor subclass: #IRASTTranslator
 	instanceVariableNames: 'source theClass method sequence nextAlias'
 	package: 'Compiler-IR'!
@@ -1281,11 +1281,3 @@ appendToInstruction: anIRInstruction
 	anIRInstruction appendBlock: self
 ! !
 
-!String methodsFor: '*Compiler-IR'!
-
-asVariableName
-	^ (Smalltalk current reservedWords includes: self)
-		ifTrue: [ self, '_' ]
-		ifFalse: [ self ]
-! !
-

+ 1 - 1
st/Compiler-Inlining.st

@@ -1,4 +1,4 @@
-Smalltalk current createPackage: 'Compiler-Inlining'!
+Smalltalk createPackage: 'Compiler-Inlining'!
 IRAssignment subclass: #IRInlinedAssignment
 	instanceVariableNames: ''
 	package: 'Compiler-Inlining'!

+ 3 - 3
st/Compiler-Interpreter.st

@@ -1,4 +1,4 @@
-Smalltalk current createPackage: 'Compiler-Interpreter'!
+Smalltalk createPackage: 'Compiler-Interpreter'!
 BlockClosure subclass: #AIBlockClosure
 	instanceVariableNames: 'node outerContext'
 	package: 'Compiler-Interpreter'!
@@ -351,7 +351,7 @@ buildAST
 	
 	| ast |
 	
-	ast := Smalltalk current parse: self method source.
+	ast := Smalltalk parse: self method source.
 	(SemanticAnalyzer on: self context receiver class)
 		visit: ast.
 	
@@ -711,7 +711,7 @@ visitVariableNode: aNode
 			ifAbsent: [
 				aNode value isCapitalized
 					ifTrue: [
-						Smalltalk current 
+						Smalltalk globals 
 							at: aNode value 
 							ifAbsent: [ PlatformInterface globals at: aNode value ] ] ] ])
 ! !

+ 3 - 3
st/Compiler-Semantic.st

@@ -1,4 +1,4 @@
-Smalltalk current createPackage: 'Compiler-Semantic'!
+Smalltalk createPackage: 'Compiler-Semantic'!
 Object subclass: #LexicalScope
 	instanceVariableNames: 'node instruction temps args outerScope blockIndex'
 	package: 'Compiler-Semantic'!
@@ -163,7 +163,7 @@ nonLocalReturns
 pseudoVars
 	pseudoVars ifNil: [
 		pseudoVars := Dictionary new.
-		Smalltalk current pseudoVariableNames do: [ :each |
+		Smalltalk pseudoVariableNames do: [ :each |
 			pseudoVars at: each put: ((PseudoVar on: each)
 				scope: self methodScope;
 				yourself) ]].
@@ -451,7 +451,7 @@ errorUnknownVariable: aNode
 	| identifier |
 	identifier := aNode value.
 	
-	((Smalltalk current globalJsVariables includes: identifier) not
+	((Smalltalk globalJsVariables includes: identifier) not
 		and: [ self isVariableGloballyUndefined: identifier ])
 			ifTrue: [
 				UnknownVariableError new

+ 18 - 18
st/Compiler-Tests.st

@@ -1,4 +1,4 @@
-Smalltalk current createPackage: 'Compiler-Tests'!
+Smalltalk createPackage: 'Compiler-Tests'!
 TestCase subclass: #ASTParsingTest
 	instanceVariableNames: ''
 	package: 'Compiler-Tests'!
@@ -13,7 +13,7 @@ analyze: aNode forClass: aClass
 !ASTParsingTest methodsFor: 'parsing'!
 
 parse: aString
-	^ Smalltalk current parse: aString
+	^ Smalltalk parse: aString
 !
 
 parse: aString forClass: aClass
@@ -309,7 +309,7 @@ testNonLocalReturn
 !
 
 testPascalCaseGlobal
-	self should: 'foo ^Object' return: (Smalltalk current at: 'Object').
+	self should: 'foo ^Object' return: (Smalltalk globals at: 'Object').
 	self should: 'foo ^NonExistent' return: nil
 !
 
@@ -437,7 +437,7 @@ analyze: aNode forClass: aClass
 !
 
 parse: aString
-	^ Smalltalk current parse: aString
+	^ Smalltalk parse: aString
 !
 
 parse: aString forClass: aClass
@@ -555,7 +555,7 @@ testAssignment
 	| src ast |
 
 	src := 'foo self := 1'.
-	ast := Smalltalk current parse: src.
+	ast := Smalltalk parse: src.
 	self should: [analyzer visit: ast] raise: InvalidAssignmentError
 !
 
@@ -563,7 +563,7 @@ testNonLocalReturn
 	| src ast |
 
 	src := 'foo | a | a + 1. ^ a'.
-	ast := Smalltalk current parse: src.
+	ast := Smalltalk parse: src.
 	analyzer visit: ast.
 
 	self deny: ast scope hasNonLocalReturn
@@ -573,7 +573,7 @@ testNonLocalReturn2
 	| src ast |
 
 	src := 'foo | a | a + 1. [ [ ^ a] ]'.
-	ast := Smalltalk current parse: src.
+	ast := Smalltalk parse: src.
 	analyzer visit: ast.
 
 	self assert: ast scope hasNonLocalReturn
@@ -583,7 +583,7 @@ testScope
 	| src ast |
 
 	src := 'foo | a | a + 1. [ | b | b := a ]'.
-	ast := Smalltalk current parse: src.
+	ast := Smalltalk parse: src.
 	analyzer visit: ast.
 
 	self deny: ast nodes first nodes last scope == ast scope.
@@ -593,7 +593,7 @@ testScope2
 	| src ast |
 
 	src := 'foo | a | a + 1. [ [ | b | b := a ] ]'.
-	ast := Smalltalk current parse: src.
+	ast := Smalltalk parse: src.
 	analyzer visit: ast.
 
 	self deny: ast nodes first nodes last nodes first nodes first scope == ast scope.
@@ -603,7 +603,7 @@ testScopeLevel
 	| src ast |
 
 	src := 'foo | a | a + 1. [ [ | b | b := a ] ]'.
-	ast := Smalltalk current parse: src.
+	ast := Smalltalk parse: src.
 	analyzer visit: ast.
 
 	self assert: ast scope scopeLevel equals: 1.
@@ -614,7 +614,7 @@ testUnknownVariables
 	| src ast |
 
 	src := 'foo | a | b + a'.
-	ast := Smalltalk current parse: src.
+	ast := Smalltalk parse: src.
 
 	self should: [ analyzer visit: ast ] raise: UnknownVariableError
 !
@@ -623,7 +623,7 @@ testUnknownVariablesWithScope
 	| src ast |
 
 	src := 'foo | a b | [ c + 1. [ a + 1. d + 1 ]]'.
-	ast := Smalltalk current parse: src.
+	ast := Smalltalk parse: src.
 	
 	self should: [ analyzer visit: ast ] raise: UnknownVariableError
 !
@@ -631,35 +631,35 @@ testUnknownVariablesWithScope
 testVariableShadowing
 	| src ast |
 	src := 'foo | a | a + 1'.
-	ast := Smalltalk current parse: src.
+	ast := Smalltalk parse: src.
 	analyzer visit: ast
 !
 
 testVariableShadowing2
 	| src ast |
 	src := 'foo | a | a + 1. [ | a | a := 2 ]'.
-	ast := Smalltalk current parse: src.
+	ast := Smalltalk parse: src.
 	self should: [analyzer visit: ast] raise: ShadowingVariableError
 !
 
 testVariableShadowing3
 	| src ast |
 	src := 'foo | a | a + 1. [ | b | b := 2 ]'.
-	ast := Smalltalk current parse: src.
+	ast := Smalltalk parse: src.
 	analyzer visit: ast
 !
 
 testVariableShadowing4
 	| src ast |
 	src := 'foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]'.
-	ast := Smalltalk current parse: src.
+	ast := Smalltalk parse: src.
 	analyzer visit: ast
 !
 
 testVariableShadowing5
 	| src ast |
 	src := 'foo | a | a + 1. [ [ [ | a | a := 2 ] ] ]'.
-	ast := Smalltalk current parse: src.
+	ast := Smalltalk parse: src.
 	self should: [analyzer visit: ast] raise: ShadowingVariableError
 !
 
@@ -667,7 +667,7 @@ testVariablesLookup
 	| src ast |
 
 	src := 'foo | a | a + 1. [ | b | b := a ]'.
-	ast := Smalltalk current parse: src.
+	ast := Smalltalk parse: src.
 	analyzer visit: ast.
 
 	"Binding for `a` in the message send"

+ 1 - 1
st/Examples.st

@@ -1,4 +1,4 @@
-Smalltalk current createPackage: 'Examples'!
+Smalltalk createPackage: 'Examples'!
 Widget subclass: #Counter
 	instanceVariableNames: 'count header'
 	package: 'Examples'!

+ 1 - 1
st/Helios-Announcements.st

@@ -1,4 +1,4 @@
-Smalltalk current createPackage: 'Helios-Announcements'!
+Smalltalk createPackage: 'Helios-Announcements'!
 Object subclass: #HLAboutToChange
 	instanceVariableNames: 'actionBlock'
 	package: 'Helios-Announcements'!

+ 1 - 1
st/Helios-Browser.st

@@ -1,4 +1,4 @@
-Smalltalk current createPackage: 'Helios-Browser'!
+Smalltalk createPackage: 'Helios-Browser'!
 HLWidget subclass: #HLBrowser
 	instanceVariableNames: 'model packagesListWidget classesListWidget protocolsListWidget methodsListWidget sourceWidget bottomDiv'
 	package: 'Helios-Browser'!

+ 1 - 1
st/Helios-Commands-Browser.st

@@ -1,4 +1,4 @@
-Smalltalk current createPackage: 'Helios-Commands-Browser'!
+Smalltalk createPackage: 'Helios-Commands-Browser'!
 HLToolCommand subclass: #HLBrowserCommand
 	instanceVariableNames: ''
 	package: 'Helios-Commands-Browser'!

+ 1 - 1
st/Helios-Commands-Core.st

@@ -1,4 +1,4 @@
-Smalltalk current createPackage: 'Helios-Commands-Core'!
+Smalltalk createPackage: 'Helios-Commands-Core'!
 Object subclass: #HLCommand
 	instanceVariableNames: 'input'
 	package: 'Helios-Commands-Core'!

+ 1 - 1
st/Helios-Commands-Tools.st

@@ -1,4 +1,4 @@
-Smalltalk current createPackage: 'Helios-Commands-Tools'!
+Smalltalk createPackage: 'Helios-Commands-Tools'!
 HLModelCommand subclass: #HLToolCommand
 	instanceVariableNames: ''
 	package: 'Helios-Commands-Tools'!

+ 6 - 5
st/Helios-Core.st

@@ -1,4 +1,4 @@
-Smalltalk current createPackage: 'Helios-Core'!
+Smalltalk createPackage: 'Helios-Core'!
 InterfacingObject subclass: #HLModel
 	instanceVariableNames: 'announcer environment'
 	package: 'Helios-Core'!
@@ -1227,15 +1227,16 @@ request: aString value: valueString do: aBlock
 defaultEnvironment
 	"If helios is loaded from within a frame, answer the parent window environment"
 	
-	| parent parentSmalltalk |
+	| parent parentSmalltalkGlobals |
 	
 	parent := window opener ifNil: [ window parent ].
 	parent ifNil: [ ^ Environment new ].
 	
-	parentSmalltalk := (parent at: 'requirejs') value: 'amber_vm/smalltalk'.
-	parentSmalltalk ifNil: [ ^ Environment new ].
+	parentSmalltalkGlobals := ((parent at: 'requirejs') value: 'amber_vm/boot')
+		ifNotNil: [ :boot | boot at: 'globals' ].
+	parentSmalltalkGlobals ifNil: [ ^ Environment new ].
 	
-	^ (parentSmalltalk at: 'Environment') new
+	^ (parentSmalltalkGlobals at: 'Environment') new
 ! !
 
 !HLManager methodsFor: 'initialization'!

+ 1 - 1
st/Helios-Debugger.st

@@ -1,4 +1,4 @@
-Smalltalk current createPackage: 'Helios-Debugger'!
+Smalltalk createPackage: 'Helios-Debugger'!
 Object subclass: #HLContextInspectorDecorator
 	instanceVariableNames: 'context'
 	package: 'Helios-Debugger'!

+ 1 - 1
st/Helios-Exceptions.st

@@ -1,4 +1,4 @@
-Smalltalk current createPackage: 'Helios-Exceptions'!
+Smalltalk createPackage: 'Helios-Exceptions'!
 Error subclass: #HLError
 	instanceVariableNames: ''
 	package: 'Helios-Exceptions'!

+ 1 - 1
st/Helios-Helpers.st

@@ -1,4 +1,4 @@
-Smalltalk current createPackage: 'Helios-Helpers'!
+Smalltalk createPackage: 'Helios-Helpers'!
 Object subclass: #HLClassifier
 	instanceVariableNames: 'next method'
 	package: 'Helios-Helpers'!

+ 1 - 1
st/Helios-Inspector.st

@@ -1,4 +1,4 @@
-Smalltalk current createPackage: 'Helios-Inspector'!
+Smalltalk createPackage: 'Helios-Inspector'!
 HLNavigationListWidget subclass: #HLInspectorDisplayWidget
 	instanceVariableNames: 'model'
 	package: 'Helios-Inspector'!

+ 1 - 1
st/Helios-KeyBindings.st

@@ -1,4 +1,4 @@
-Smalltalk current createPackage: 'Helios-KeyBindings'!
+Smalltalk createPackage: 'Helios-KeyBindings'!
 Object subclass: #HLBinding
 	instanceVariableNames: 'key label'
 	package: 'Helios-KeyBindings'!

+ 1 - 1
st/Helios-Layout.st

@@ -1,4 +1,4 @@
-Smalltalk current createPackage: 'Helios-Layout'!
+Smalltalk createPackage: 'Helios-Layout'!
 HLWidget subclass: #HLContainer
 	instanceVariableNames: 'splitter'
 	package: 'Helios-Layout'!

+ 1 - 1
st/Helios-References.st

@@ -1,4 +1,4 @@
-Smalltalk current createPackage: 'Helios-References'!
+Smalltalk createPackage: 'Helios-References'!
 Object subclass: #HLMethodReference
 	instanceVariableNames: 'selector methodClass'
 	package: 'Helios-References'!

+ 1 - 1
st/Helios-Transcript.st

@@ -1,4 +1,4 @@
-Smalltalk current createPackage: 'Helios-Transcript'!
+Smalltalk createPackage: 'Helios-Transcript'!
 HLWidget subclass: #HLTranscript
 	instanceVariableNames: 'textarea'
 	package: 'Helios-Transcript'!

+ 1 - 1
st/Helios-Workspace-Tests.st

@@ -1,4 +1,4 @@
-Smalltalk current createPackage: 'Helios-Workspace-Tests'!
+Smalltalk createPackage: 'Helios-Workspace-Tests'!
 TestCase subclass: #HLCodeWidgetTest
 	instanceVariableNames: ''
 	package: 'Helios-Workspace-Tests'!

+ 4 - 4
st/Helios-Workspace.st

@@ -1,4 +1,4 @@
-Smalltalk current createPackage: 'Helios-Workspace'!
+Smalltalk createPackage: 'Helios-Workspace'!
 Object subclass: #HLCodeModel
 	instanceVariableNames: 'announcer environment receiver'
 	package: 'Helios-Workspace'!
@@ -207,7 +207,7 @@ setEditorOn: aTextarea
 !HLCodeWidget methodsFor: 'hints'!
 
 messageHintFor: anEditor token: aToken
-	^ ((Smalltalk current at: 'allSelectors') value asArray 
+	^ (Smalltalk vm allSelectors asArray 
 		select: [ :each | each includesSubString: aToken string ])
 		reject: [ :each | each = aToken string ]
 !
@@ -218,8 +218,8 @@ variableHintFor: anEditor token: aToken
 	variables := (anEditor display wrapper asJQuery find: 'span.cm-variable') get
 		collect: [ :each | each asJQuery html ].
 	
-	classNames := Smalltalk current classes collect: [ :each | each name ].
-	pseudoVariables := Smalltalk current pseudoVariableNames.
+	classNames := Smalltalk classes collect: [ :each | each name ].
+	pseudoVariables := Smalltalk pseudoVariableNames.
 	
 	^ ((variables, classNames, pseudoVariables) asSet asArray 
 		select: [ :each | each includesSubString: aToken string ])

+ 12 - 12
st/IDE.st

@@ -1,4 +1,4 @@
-Smalltalk current createPackage: 'IDE'!
+Smalltalk createPackage: 'IDE'!
 Widget subclass: #ClassesList
 	instanceVariableNames: 'browser ul nodes'
 	package: 'IDE'!
@@ -407,7 +407,7 @@ removeBodyMargin
 
 search: aString
 	| searchedClass |
-	searchedClass := Smalltalk current at: aString.
+	searchedClass := Smalltalk globals at: aString.
 		searchedClass isClass
 			ifTrue: [ Browser openOn: searchedClass ]
 			ifFalse: [ ReferencesBrowser search: aString ]
@@ -668,7 +668,7 @@ classDeclarationTemplate
 !
 
 classes
-	^ ((Smalltalk current classes
+	^ ((Smalltalk classes
 	select: [ :each | each category = selectedPackage ])
 	sort: [ :a :b | a name < b name ]) asSet
 !
@@ -734,7 +734,7 @@ methods
 packages
 	| packages |
 	packages := Array new.
-	Smalltalk current classes do: [ :each |
+	Smalltalk classes do: [ :each |
 	(packages includes: each category) ifFalse: [
 		packages add: each category ]].
 	^ packages sort
@@ -789,7 +789,7 @@ addNewClass
 			self
 			resetClassesList;
 			updateClassesList.
-		self selectClass: (Smalltalk current at: className) ]
+		self selectClass: (Smalltalk globals at: className) ]
 !
 
 addNewProtocol
@@ -878,7 +878,7 @@ copyClass
 			self
 			resetClassesList;
 			updateClassesList.
-		self selectClass: (Smalltalk current at: className) ]
+		self selectClass: (Smalltalk globals at: className) ]
 !
 
 disableSaveButton
@@ -909,7 +909,7 @@ hideMethodButtons
 removeClass
 	(self confirm: 'Do you really want to remove ', selectedClass name, '?')
 	ifTrue: [
-		Smalltalk current removeClass: selectedClass.
+		Smalltalk removeClass: selectedClass.
 		self resetClassesList.
 		self selectClass: nil ]
 !
@@ -928,7 +928,7 @@ removePackage
 
 	(self confirm: 'Do you really want to remove the whole package ', selectedPackage, ' with all its classes?')
 	ifTrue: [
-		Smalltalk current removePackage: selectedPackage.
+		Smalltalk removePackage: selectedPackage.
 		self updateCategoriesList ]
 !
 
@@ -948,13 +948,13 @@ renamePackage
 	newName := self prompt: 'Rename package ', selectedPackage.
 	newName ifNotNil: [
 	newName notEmpty ifTrue: [
-	Smalltalk current renamePackage: selectedPackage to: newName.
+	Smalltalk renamePackage: selectedPackage to: newName.
 	self updateCategoriesList ]]
 !
 
 search: aString
 	self cancelChanges ifTrue: [ | searchedClass |
-		searchedClass := Smalltalk current at: aString.
+		searchedClass := Smalltalk globals at: aString.
 		searchedClass isClass
 			ifTrue: [ self class openOn: searchedClass ]
 			ifFalse: [ self searchReferencesOf: aString ]]
@@ -1788,7 +1788,7 @@ TabWidget subclass: #ReferencesBrowser
 !ReferencesBrowser methodsFor: 'accessing'!
 
 classesAndMetaclasses
-	^ Smalltalk current classes, (Smalltalk current classes collect: [ :each | each class ])
+	^ Smalltalk classes, (Smalltalk classes collect: [ :each | each class ])
 !
 
 implementors
@@ -2376,7 +2376,7 @@ inspectOn: anInspector
 !Set methodsFor: '*IDE'!
 
 inspectOn: anInspector
-	| variables i |
+	| variables |
 	variables := Dictionary new.
 	variables at: '#self' put: self.
 	i := 1.

+ 3 - 3
st/Kernel-Announcements.st

@@ -1,4 +1,4 @@
-Smalltalk current createPackage: 'Kernel-Announcements'!
+Smalltalk createPackage: 'Kernel-Announcements'!
 Object subclass: #AnnouncementSubscription
 	instanceVariableNames: 'valuable announcementClass'
 	package: 'Kernel-Announcements'!
@@ -52,10 +52,10 @@ deliver: anAnnouncement
 handlesAnnouncement: anAnnouncement
 	"anAnnouncement might be announced from within another Amber environment"
 	
-	^ (Smalltalk current at: self announcementClass name)
+	^ (Smalltalk globals at: self announcementClass name)
 		ifNil: [ ^ false ]
 		ifNotNil: [ :class |
-		(Smalltalk current at: anAnnouncement class theNonMetaClass name) includesBehavior: class ]
+		(Smalltalk globals at: anAnnouncement class theNonMetaClass name) includesBehavior: class ]
 ! !
 
 Object subclass: #Announcer

+ 4 - 9
st/Kernel-Classes.st

@@ -1,4 +1,4 @@
-Smalltalk current createPackage: 'Kernel-Classes'!
+Smalltalk createPackage: 'Kernel-Classes'!
 Object subclass: #Behavior
 	instanceVariableNames: ''
 	package: 'Kernel-Classes'!
@@ -524,8 +524,8 @@ instanceVariableNamesFor: aString
 addSubclassOf: aClass named: className instanceVariableNames: aCollection package: packageName
 	| theClass thePackage |
 	
-	theClass := Smalltalk current at: className.
-	thePackage := self createPackageNamed: packageName.
+	theClass := Smalltalk globals at: className.
+	thePackage := Package named: packageName.
 	
 	theClass ifNotNil: [
 		theClass package: thePackage.
@@ -587,7 +587,7 @@ migrateClassNamed: className superclass: aClass instanceVariableNames: aCollecti
 	| oldClass newClass tmp |
 	
 	tmp := 'new*', className.
-	oldClass := Smalltalk current at: className.
+	oldClass := Smalltalk globals at: className.
 	
 	newClass := self
 		addSubclassOf: aClass
@@ -719,11 +719,6 @@ basicSwapClassNames: aClass with: anotherClass
 	>
 !
 
-createPackageNamed: aString
-	^ Package named: aString ifAbsent: [
-		Smalltalk current createPackage: aString ]
-!
-
 rawRenameClass: aClass to: aString
 	<
 		smalltalk[aString] = aClass;

+ 1 - 1
st/Kernel-Collections.st

@@ -1,4 +1,4 @@
-Smalltalk current createPackage: 'Kernel-Collections'!
+Smalltalk createPackage: 'Kernel-Collections'!
 Object subclass: #Association
 	instanceVariableNames: 'key value'
 	package: 'Kernel-Collections'!

+ 1 - 1
st/Kernel-Exceptions.st

@@ -1,4 +1,4 @@
-Smalltalk current createPackage: 'Kernel-Exceptions'!
+Smalltalk createPackage: 'Kernel-Exceptions'!
 Object subclass: #Error
 	instanceVariableNames: 'messageText'
 	package: 'Kernel-Exceptions'!

+ 9 - 9
st/Kernel-ImportExport.st

@@ -1,4 +1,4 @@
-Smalltalk current createPackage: 'Kernel-ImportExport'!
+Smalltalk createPackage: 'Kernel-ImportExport'!
 Object subclass: #AbstractExporter
 	instanceVariableNames: ''
 	package: 'Kernel-ImportExport'!
@@ -32,7 +32,7 @@ extensionProtocolsOfPackage: aPackage
 	Therefore sorting (dependency resolution) does not matter here.
 	Not sorting improves the speed by a number of magnitude."
 	
-	Smalltalk current classes do: [ :each |
+	Smalltalk classes do: [ :each |
 		{each. each class} do: [ :behavior |
 			(behavior protocols includes: extensionName) ifTrue: [
 				result add: (ExportMethodProtocol name: extensionName theClass: behavior) ] ] ].
@@ -79,7 +79,7 @@ extensionCategoriesOfPackage: aPackage
 	| name map result |
 	name := aPackage name.
 	result := OrderedCollection new.
-	(Package sortedClasses: Smalltalk current classes) do: [ :each |
+	(Package sortedClasses: Smalltalk classes) do: [ :each |
 		{each. each class} do: [ :aClass |
 			map := Dictionary new.
 			aClass protocolsDo: [ :category :methods |
@@ -190,7 +190,7 @@ exportPackage: aPackage on: aStream
 
 exportPackageDefinitionOf: aPackage on: aStream
 	aStream
-		nextPutAll: 'Smalltalk current createPackage: ''', aPackage name, '''!!';
+		nextPutAll: 'Smalltalk createPackage: ''', aPackage name, '''!!';
 		lf
 !
 
@@ -660,7 +660,7 @@ namespaceFor: aPackage
 !AmdPackageHandler methodsFor: 'loading'!
 
 load: aPackage
-	Smalltalk current amdRequire
+	Smalltalk amdRequire
 		ifNil: [ self error: 'AMD loader not present' ]
 		ifNotNil: [ :require |
 			require value: (Array new: (self namespaceFor: aPackage), '/', aPackage name ) ]
@@ -669,7 +669,7 @@ load: aPackage
 !AmdPackageHandler methodsFor: 'private'!
 
 toUrl: aString
-	^ Smalltalk current amdRequire
+	^ Smalltalk amdRequire
 		ifNil: [ self error: 'AMD loader not present' ]
 		ifNotNil: [ :require | (require basicAt: 'toUrl') value: aString ]
 ! !
@@ -677,11 +677,11 @@ toUrl: aString
 !AmdPackageHandler class methodsFor: 'commit paths'!
 
 defaultNamespace
-	^ Smalltalk current defaultAmdNamespace
+	^ Smalltalk defaultAmdNamespace
 !
 
 defaultNamespace: aString
-	Smalltalk current defaultAmdNamespace: aString
+	Smalltalk defaultAmdNamespace: aString
 ! !
 
 Object subclass: #PackageTransport
@@ -835,7 +835,7 @@ asJSON
 !AmdPackageTransport methodsFor: 'defaults'!
 
 defaultNamespace
-	^ Smalltalk current defaultAmdNamespace
+	^ Smalltalk defaultAmdNamespace
 ! !
 
 !AmdPackageTransport methodsFor: 'initialization'!

+ 54 - 32
st/Kernel-Infrastructure.st

@@ -1,4 +1,4 @@
-Smalltalk current createPackage: 'Kernel-Infrastructure'!
+Smalltalk createPackage: 'Kernel-Infrastructure'!
 Object subclass: #InspectorHandler
 	instanceVariableNames: ''
 	package: 'Kernel-Infrastructure'!
@@ -72,16 +72,16 @@ Typical use cases include IDEs, remote access and restricting browsing.!
 !Environment methodsFor: 'accessing'!
 
 allSelectors
-	^ (Smalltalk current at: 'allSelectors') value
+	^ Smalltalk vm allSelectors
 !
 
 availableClassNames
-	^ Smalltalk current classes 
+	^ Smalltalk classes 
 		collect: [ :each | each name ]
 !
 
 availablePackageNames
-	^ Smalltalk current packages 
+	^ Smalltalk packages 
 		collect: [ :each | each name ]
 !
 
@@ -98,12 +98,12 @@ classBuilder
 !
 
 classNamed: aString
-	^ (Smalltalk current at: aString asSymbol)
+	^ (Smalltalk globals at: aString asSymbol)
 		ifNil: [ self error: 'Invalid class name' ]
 !
 
 classes
-	^ Smalltalk current classes
+	^ Smalltalk classes
 !
 
 doItReceiver
@@ -111,11 +111,11 @@ doItReceiver
 !
 
 packages
-	^ Smalltalk current packages
+	^ Smalltalk packages
 !
 
 systemAnnouncer
-	^ (Smalltalk current at: #SystemAnnouncer) current
+	^ (Smalltalk globals at: #SystemAnnouncer) current
 ! !
 
 !Environment methodsFor: 'actions'!
@@ -125,7 +125,7 @@ commitPackage: aPackage
 !
 
 copyClass: aClass to: aClassName
-	(Smalltalk current at: aClassName)
+	(Smalltalk globals at: aClassName)
 		ifNotNil: [ self error: 'A class named ', aClassName, ' already exists' ].
 		
 	ClassBuilder new copyClass: aClass named: aClassName
@@ -156,8 +156,7 @@ moveClass: aClass toPackage: aPackageName
 moveMethod: aMethod toClass: aClassName
 	| destinationClass |
 	
-	destinationClass := Smalltalk current at: aClassName asSymbol.
-	destinationClass ifNil: [ self error: 'Invalid class name' ].
+	destinationClass := self classNamed: aClassName.
 	destinationClass == aMethod methodClass ifTrue: [ ^ self ].
 	
 	destinationClass 
@@ -184,7 +183,7 @@ registerProgressHandler: aProgressHandler
 !
 
 removeClass: aClass
-	Smalltalk current removeClass: aClass
+	Smalltalk removeClass: aClass
 !
 
 removeMethod: aMethod
@@ -197,7 +196,7 @@ removeProtocol: aString from: aClass
 !
 
 renameClass: aClass to: aClassName
-	(Smalltalk current at: aClassName)
+	(Smalltalk globals at: aClassName)
 		ifNotNil: [ self error: 'A class named ', aClassName, ' already exists' ].
 		
 	ClassBuilder new renameClass: aClass to: aClassName
@@ -566,7 +565,7 @@ loadDependencyClasses
 	starCategoryName := '*', self name.
 	^ (self classes collect: [ :each | each superclass ]) asSet
 		remove: nil ifAbsent: [];
-		addAll: (Smalltalk current classes select: [ :each | each protocols, each class protocols includes: starCategoryName ]);
+		addAll: (Smalltalk classes select: [ :each | each protocols, each class protocols includes: starCategoryName ]);
 		yourself
 ! !
 
@@ -591,14 +590,14 @@ Package class instanceVariableNames: 'defaultCommitPathJs defaultCommitPathSt'!
 !Package class methodsFor: 'accessing'!
 
 named: aPackageName
-	^ Smalltalk current 
+	^ Smalltalk 
 		packageAt: aPackageName
 		ifAbsent: [ 
-			Smalltalk current createPackage: aPackageName ]
+			Smalltalk createPackage: aPackageName ]
 !
 
 named: aPackageName ifAbsent: aBlock
-	^ Smalltalk current packageAt: aPackageName ifAbsent: aBlock
+	^ Smalltalk packageAt: aPackageName ifAbsent: aBlock
 !
 
 named: aPackageName transport: aTransport
@@ -745,15 +744,16 @@ register
 	ProgressHandler setCurrent: self new
 ! !
 
-Object subclass: #Smalltalk
+Object subclass: #SmalltalkImage
 	instanceVariableNames: ''
 	package: 'Kernel-Infrastructure'!
-!Smalltalk commentStamp!
-I represent the global JavaScript variable `smalltalk` declared in `js/boot.js`.
+!SmalltalkImage commentStamp!
+I represent the Smalltalk system, wrapping
+operations of variable `smalltalk` declared in `js/boot.js`.
 
 ## API
 
-I have only one instance, accessed with class-side method `#current`.
+I have only one instance, accessed with global variable `Smalltalk`.
 
 The `smalltalk` object holds all class and packages defined in the system.
 
@@ -776,7 +776,7 @@ Packages can be accessed using the following methods:
 The `#parse:` method is used to parse Amber source code.
 It requires the `Compiler` package and the `js/parser.js` parser file in order to work.!
 
-!Smalltalk methodsFor: 'accessing'!
+!SmalltalkImage methodsFor: 'accessing'!
 
 at: aString
 	<return smalltalk[aString]>
@@ -792,6 +792,17 @@ at: aString put: anObject
 	<return smalltalk[aString]=anObject>
 !
 
+current
+	"Backward compatibility for Smalltalk current ..."
+	self deprecatedAPI.
+	^ self
+!
+
+globals
+	"Future compatibility to be able to use Smalltalk globals at: ..."
+	^ self
+!
+
 includesKey: aKey
 	<return smalltalk.hasOwnProperty(aKey)>
 !
@@ -825,9 +836,14 @@ version
 	"Answer the version string of Amber"
 	
 	^ '0.13.0-pre'
+!
+
+vm
+	"Future compatibility to be able to use Smalltalk vm ..."
+	<return smalltalk>
 ! !
 
-!Smalltalk methodsFor: 'accessing amd'!
+!SmalltalkImage methodsFor: 'accessing amd'!
 
 amdRequire
 	^ self at: 'amdRequire'
@@ -841,7 +857,7 @@ defaultAmdNamespace: aString
 	self at: 'defaultAmdNamespace' put: aString
 ! !
 
-!Smalltalk methodsFor: 'classes'!
+!SmalltalkImage methodsFor: 'classes'!
 
 classes
 	<return smalltalk.classes()>
@@ -858,7 +874,7 @@ removeClass: aClass
 			yourself)
 ! !
 
-!Smalltalk methodsFor: 'error handling'!
+!SmalltalkImage methodsFor: 'error handling'!
 
 asSmalltalkException: anObject
 	"A JavaScript exception may be thrown.
@@ -873,7 +889,7 @@ parseError: anException parsing: aString
 	^ ParseError new messageText: 'Parse error on line ', (anException basicAt: 'line') ,' column ' , (anException basicAt: 'column') ,' : Unexpected character ', (anException basicAt: 'found')
 ! !
 
-!Smalltalk methodsFor: 'globals'!
+!SmalltalkImage methodsFor: 'globals'!
 
 addGlobalJsVariable: aString
 	self globalJsVariables add: aString
@@ -888,7 +904,7 @@ globalJsVariables
 	<return smalltalk.globalJsVariables>
 ! !
 
-!Smalltalk methodsFor: 'packages'!
+!SmalltalkImage methodsFor: 'packages'!
 
 createPackage: packageName
 	| package announcement |
@@ -942,7 +958,7 @@ renamePackage: packageName to: newName
 	self deletePackage: packageName.
 ! !
 
-!Smalltalk methodsFor: 'private'!
+!SmalltalkImage methodsFor: 'private'!
 
 basicCreatePackage: packageName
 	"Create and bind a new bare package with given name and return it."
@@ -974,7 +990,7 @@ deletePackage: packageName
 	<delete smalltalk.packages[packageName]>
 ! !
 
-!Smalltalk methodsFor: 'testing'!
+!SmalltalkImage methodsFor: 'testing'!
 
 isSmalltalkObject: anObject
 	"Consider anObject a Smalltalk object if it has a 'klass' property.
@@ -983,12 +999,18 @@ isSmalltalkObject: anObject
 	<return typeof anObject.klass !!== 'undefined'>
 ! !
 
-Smalltalk class instanceVariableNames: 'current'!
+SmalltalkImage class instanceVariableNames: 'current'!
+
+!SmalltalkImage class methodsFor: 'initialization'!
+
+initialize
+	smalltalk at: 'Smalltalk' put: self current
+! !
 
-!Smalltalk class methodsFor: 'instance creation'!
+!SmalltalkImage class methodsFor: 'instance creation'!
 
 current
-	^ current ifNil: [ current := super new ]
+	^ current ifNil: [ current := super new ] ifNotNil: [ self deprecatedAPI. current ]
 !
 
 new

+ 2 - 2
st/Kernel-Methods.st

@@ -1,4 +1,4 @@
-Smalltalk current createPackage: 'Kernel-Methods'!
+Smalltalk createPackage: 'Kernel-Methods'!
 Object subclass: #BlockClosure
 	instanceVariableNames: ''
 	package: 'Kernel-Methods'!
@@ -86,7 +86,7 @@ on: anErrorClass do: aBlock
 	Convert all JS exceptions to JavaScriptException instances."
 	
 	^ self try: self catch: [ :error | | smalltalkError |
-		smalltalkError := Smalltalk current asSmalltalkException: error.
+		smalltalkError := Smalltalk asSmalltalkException: error.
 		(smalltalkError isKindOf: anErrorClass)
 		ifTrue: [ aBlock value: smalltalkError ]
 		ifFalse: [ smalltalkError resignal ] ]

+ 1 - 1
st/Kernel-Objects.st

@@ -1,4 +1,4 @@
-Smalltalk current createPackage: 'Kernel-Objects'!
+Smalltalk createPackage: 'Kernel-Objects'!
 nil subclass: #ProtoObject
 	instanceVariableNames: ''
 	package: 'Kernel-Objects'!

+ 13 - 13
st/Kernel-Tests.st

@@ -1,4 +1,4 @@
-Smalltalk current createPackage: 'Kernel-Tests'!
+Smalltalk createPackage: 'Kernel-Tests'!
 TestCase subclass: #AnnouncementSubscriptionTest
 	instanceVariableNames: ''
 	package: 'Kernel-Tests'!
@@ -299,7 +299,7 @@ setUp
 !
 
 tearDown
-	theClass ifNotNil: [ Smalltalk current removeClass: theClass. theClass := nil ]
+	theClass ifNotNil: [ Smalltalk removeClass: theClass. theClass := nil ]
 ! !
 
 !ClassBuilderTest methodsFor: 'tests'!
@@ -317,10 +317,10 @@ testClassMigration
 	| instance oldClass |
 	
 	oldClass := builder copyClass: ObjectMock named: 'ObjectMock2'.
-	instance := (Smalltalk current at: 'ObjectMock2') new.
+	instance := (Smalltalk globals at: 'ObjectMock2') new.
 	
 	"Change the superclass of ObjectMock2"
-	ObjectMock subclass: (Smalltalk current at: 'ObjectMock2')
+	ObjectMock subclass: (Smalltalk globals at: 'ObjectMock2')
 		instanceVariableNames: ''
 		package: 'Kernel-Tests'.
 	
@@ -336,9 +336,9 @@ testClassMigration
 	"Commeting this out. Tests implementation detail."
 	"self assert: instance class name equals: 'OldObjectMock2'."
 	
-	self assert: (Smalltalk current at: instance class name) isNil.
+	self assert: (Smalltalk globals at: instance class name) isNil.
 	
-	Smalltalk current removeClass: ObjectMock2
+	Smalltalk removeClass: ObjectMock2
 !
 
 testClassMigrationWithClassInstanceVariables
@@ -347,13 +347,13 @@ testClassMigrationWithClassInstanceVariables
 	ObjectMock2 class instanceVariableNames: 'foo bar'.
 	
 	"Change the superclass of ObjectMock2"
-	ObjectMock subclass: (Smalltalk current at: 'ObjectMock2')
+	ObjectMock subclass: (Smalltalk globals at: 'ObjectMock2')
 		instanceVariableNames: ''
 		package: 'Kernel-Tests'.
 	
 	self assert: ObjectMock2 class instanceVariableNames equals: #('foo' 'bar').
 	
-	Smalltalk current removeClass: ObjectMock2
+	Smalltalk removeClass: ObjectMock2
 !
 
 testClassMigrationWithSubclasses
@@ -363,7 +363,7 @@ testClassMigrationWithSubclasses
 	ObjectMock3 subclass: 'ObjectMock4' instanceVariableNames: '' package: 'Kernel-Tests'.
 	
 	"Change the superclass of ObjectMock2"
-	ObjectMock subclass: (Smalltalk current at: 'ObjectMock2')
+	ObjectMock subclass: (Smalltalk globals at: 'ObjectMock2')
 		instanceVariableNames: ''
 		package: 'Kernel-Tests'.
 	
@@ -371,7 +371,7 @@ testClassMigrationWithSubclasses
 	self assert: (ObjectMock2 subclasses includes: ObjectMock3).
 	self assert: (ObjectMock3 subclasses includes: ObjectMock4).
 	
-	ObjectMock allSubclasses do: [ :each | Smalltalk current removeClass: each ]
+	ObjectMock allSubclasses do: [ :each | Smalltalk removeClass: each ]
 !
 
 testInstanceVariableNames
@@ -1496,7 +1496,7 @@ CollectionTest subclass: #SetTest
 
 collection
 	^ Set new
-		add: Smalltalk current;
+		add: Smalltalk;
 		add: nil;
 		add: 3@3;
 		add: false;
@@ -1505,7 +1505,7 @@ collection
 
 collectionOfPrintStrings
 	^ Set new
-		add: 'a Smalltalk';
+		add: 'a SmalltalkImage';
 		add: 'nil';
 		add: '3@3';
 		add: 'false';
@@ -1523,7 +1523,7 @@ collectionWithDuplicates
 
 collectionWithNewValue
 	^ Set new
-		add: Smalltalk current;
+		add: Smalltalk;
 		add: nil;
 		add: 3@3;
 		add: 'N';

+ 1 - 1
st/Kernel-Transcript.st

@@ -1,4 +1,4 @@
-Smalltalk current createPackage: 'Kernel-Transcript'!
+Smalltalk createPackage: 'Kernel-Transcript'!
 Object subclass: #ConsoleTranscript
 	instanceVariableNames: 'textarea'
 	package: 'Kernel-Transcript'!

+ 1 - 1
st/SUnit-Tests.st

@@ -1,4 +1,4 @@
-Smalltalk current createPackage: 'SUnit-Tests'!
+Smalltalk createPackage: 'SUnit-Tests'!
 TestCase subclass: #ExampleSetTest
 	instanceVariableNames: 'empty full'
 	package: 'SUnit-Tests'!

+ 1 - 1
st/SUnit.st

@@ -1,4 +1,4 @@
-Smalltalk current createPackage: 'SUnit'!
+Smalltalk createPackage: 'SUnit'!
 Object subclass: #ResultAnnouncement
 	instanceVariableNames: 'result'
 	package: 'SUnit'!

+ 1 - 1
st/Spaces.st

@@ -1,4 +1,4 @@
-Smalltalk current createPackage: 'Spaces'!
+Smalltalk createPackage: 'Spaces'!
 Object subclass: #ObjectSpace
 	instanceVariableNames: 'frame'
 	package: 'Spaces'!

+ 1 - 1
support/boot.js

@@ -1132,5 +1132,5 @@ function runnable () {
 	brikz.rebuild();
 };
 
-return { smalltalk: api, nil: brikz.root.nil };
+return { smalltalk: api, nil: brikz.root.nil, globals: api };
 });

+ 1 - 1
test/Test.st

@@ -1,4 +1,4 @@
-Smalltalk current createPackage: 'Test'!
+Smalltalk createPackage: 'Test'!
 Object subclass: #NodeTestRunner
 	instanceVariableNames: ''
 	package: 'Test'!