浏览代码

- Mostly working AST interpreter
- Fixed '\\' selector in parser.pegjs
- improved method contexts and fixed the current debugger
- Recompiled all .js files

Nicolas Petton 11 年之前
父节点
当前提交
6fb89d7252
共有 55 个文件被更改,包括 8440 次插入9939 次删除
  1. 1 0
      .gitignore
  2. 70 70
      js/Benchfib.deploy.js
  3. 70 70
      js/Benchfib.js
  4. 215 215
      js/Canvas.deploy.js
  5. 215 215
      js/Canvas.js
  6. 191 191
      js/Compiler-AST.deploy.js
  7. 191 191
      js/Compiler-AST.js
  8. 175 950
      js/Compiler-Core.deploy.js
  9. 175 385
      js/Compiler-Core.js
  10. 18 18
      js/Compiler-Exceptions.deploy.js
  11. 18 18
      js/Compiler-Exceptions.js
  12. 263 262
      js/Compiler-IR.deploy.js
  13. 263 262
      js/Compiler-IR.js
  14. 266 266
      js/Compiler-Inlining.deploy.js
  15. 266 266
      js/Compiler-Inlining.js
  16. 79 48
      js/Compiler-Interpreter.deploy.js
  17. 91 50
      js/Compiler-Interpreter.js
  18. 334 327
      js/Compiler-Semantic.deploy.js
  19. 334 327
      js/Compiler-Semantic.js
  20. 85 161
      js/Compiler-Tests.deploy.js
  21. 85 191
      js/Compiler-Tests.js
  22. 29 29
      js/Examples.deploy.js
  23. 29 29
      js/Examples.js
  24. 359 337
      js/IDE.deploy.js
  25. 359 337
      js/IDE.js
  26. 296 296
      js/Importer-Exporter.deploy.js
  27. 296 296
      js/Importer-Exporter.js
  28. 42 42
      js/Kernel-Announcements.deploy.js
  29. 42 42
      js/Kernel-Announcements.js
  30. 243 243
      js/Kernel-Classes.deploy.js
  31. 243 243
      js/Kernel-Classes.js
  32. 247 247
      js/Kernel-Collections.deploy.js
  33. 247 247
      js/Kernel-Collections.js
  34. 63 63
      js/Kernel-Exceptions.deploy.js
  35. 63 63
      js/Kernel-Exceptions.js
  36. 319 280
      js/Kernel-Methods.deploy.js
  37. 331 282
      js/Kernel-Methods.js
  38. 314 318
      js/Kernel-Objects.deploy.js
  39. 314 318
      js/Kernel-Objects.js
  40. 310 310
      js/Kernel-Tests.deploy.js
  41. 310 310
      js/Kernel-Tests.js
  42. 22 22
      js/Kernel-Transcript.deploy.js
  43. 22 22
      js/Kernel-Transcript.js
  44. 234 235
      js/SUnit.deploy.js
  45. 234 235
      js/SUnit.js
  46. 11 4
      js/boot.js
  47. 1 1
      js/parser.js
  48. 1 1
      js/parser.pegjs
  49. 0 539
      st/Compiler-Core.st
  50. 19 5
      st/Compiler-IR.st
  51. 21 4
      st/Compiler-Interpreter.st
  52. 0 36
      st/Compiler-Tests.st
  53. 1 19
      st/IDE.st
  54. 9 1
      st/Kernel-Methods.st
  55. 4 0
      st/Kernel-Objects.st

+ 1 - 0
.gitignore

@@ -14,3 +14,4 @@ test/run.js
 
 # In case amber is also saved in a local Subversion
 .svn
+/node_modules/*

+ 70 - 70
js/Benchfib.deploy.js

@@ -7,10 +7,10 @@ smalltalk.method({
 selector: "main",
 fn: function (){
 var self=this;
-var result;
-result=smalltalk.send((0),"_tinyBenchmarks",[]);
-smalltalk.send(console,"_log_",[smalltalk.send("0 tinyBenchmarks => ","__comma",[result])]);
-return self}
+return smalltalk.withContext(function($ctx) { var result;
+result=_st((0))._tinyBenchmarks();
+_st(console)._log_(_st("0 tinyBenchmarks => ").__comma(result));
+return self}, self, "main", [], smalltalk.Benchfib.klass)}
 }),
 smalltalk.Benchfib.klass);
 
@@ -21,15 +21,15 @@ smalltalk.method({
 selector: "benchFib",
 fn: function (){
 var self=this;
-var $2,$1;
-$2=smalltalk.send(self,"__lt",[(2)]);
+return smalltalk.withContext(function($ctx) { var $2,$1;
+$2=_st(self).__lt((2));
 if(smalltalk.assert($2)){
 $1=(1);
 } else {
-$1=smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self,"__minus",[(1)]),"_benchFib",[]),"__plus",[smalltalk.send(smalltalk.send(self,"__minus",[(2)]),"_benchFib",[])]),"__plus",[(1)]);
+$1=_st(_st(_st(_st(self).__minus((1)))._benchFib()).__plus(_st(_st(self).__minus((2)))._benchFib())).__plus((1));
 };
 return $1;
-}
+}, self, "benchFib", [], smalltalk.Number)}
 }),
 smalltalk.Number);
 
@@ -39,42 +39,42 @@ smalltalk.method({
 selector: "benchmark",
 fn: function (){
 var self=this;
-var $1;
+return smalltalk.withContext(function($ctx) { var $1;
 var size;
 var flags;
 var prime;
 var k;
 var count;
 size=(8190);
-smalltalk.send((1),"_to_do_",[self,(function(iter){
+_st((1))._to_do_(self,(function(iter){
 count=(0);
 count;
-flags=smalltalk.send((smalltalk.Array || Array),"_new",[]);
+flags=_st((smalltalk.Array || Array))._new();
 flags;
-smalltalk.send(size,"_timesRepeat_",[(function(){
-return smalltalk.send(flags,"_add_",[true]);
-})]);
-return smalltalk.send((1),"_to_do_",[size,(function(i){
-$1=smalltalk.send(flags,"_at_",[i]);
+_st(size)._timesRepeat_((function(){
+return _st(flags)._add_(true);
+}));
+return _st((1))._to_do_(size,(function(i){
+$1=_st(flags)._at_(i);
 if(smalltalk.assert($1)){
-prime=smalltalk.send(i,"__plus",[(1)]);
+prime=_st(i).__plus((1));
 prime;
-k=smalltalk.send(i,"__plus",[prime]);
+k=_st(i).__plus(prime);
 k;
-smalltalk.send((function(){
-return smalltalk.send(k,"__lt_eq",[size]);
-}),"_whileTrue_",[(function(){
-smalltalk.send(flags,"_at_put_",[k,false]);
-k=smalltalk.send(k,"__plus",[prime]);
+_st((function(){
+return _st(k).__lt_eq(size);
+}))._whileTrue_((function(){
+_st(flags)._at_put_(k,false);
+k=_st(k).__plus(prime);
 return k;
-})]);
-count=smalltalk.send(count,"__plus",[(1)]);
+}));
+count=_st(count).__plus((1));
 return count;
 };
-})]);
-})]);
+}));
+}));
 return count;
-}
+}, self, "benchmark", [], smalltalk.Number)}
 }),
 smalltalk.Number);
 
@@ -84,12 +84,12 @@ smalltalk.method({
 selector: "jsbenchFib",
 fn: function (){
 var self=this;
-if (this < 2) {
+return smalltalk.withContext(function($ctx) { if (this < 2) {
 return 1;
 } else {
 return (this-1)._jsbenchFib() + (this-2)._jsbenchFib() + 1;};
 ;
-return self}
+return self}, self, "jsbenchFib", [], smalltalk.Number)}
 }),
 smalltalk.Number);
 
@@ -99,7 +99,7 @@ smalltalk.method({
 selector: "jsbenchmark",
 fn: function (){
 var self=this;
-
+return smalltalk.withContext(function($ctx) { 
 var size = 8190;
 var count;
 for (var z=0;z<this;z++) {
@@ -122,7 +122,7 @@ for (var z=0;z<this;z++) {
 }
 return count;
 ;
-return self}
+return self}, self, "jsbenchmark", [], smalltalk.Number)}
 }),
 smalltalk.Number);
 
@@ -132,38 +132,38 @@ smalltalk.method({
 selector: "jstinyBenchmarks",
 fn: function (){
 var self=this;
-var $1;
+return smalltalk.withContext(function($ctx) { var $1;
 var t1;
 var t2;
 var r;
 var n1;
 var n2;
 n1=(1);
-smalltalk.send((function(){
-t1=smalltalk.send((smalltalk.Date || Date),"_millisecondsToRun_",[(function(){
-return smalltalk.send(n1,"_jsbenchmark",[]);
-})]);
+_st((function(){
+t1=_st((smalltalk.Date || Date))._millisecondsToRun_((function(){
+return _st(n1)._jsbenchmark();
+}));
 t1;
-return smalltalk.send(t1,"__lt",[(1000)]);
-}),"_whileTrue_",[(function(){
-n1=smalltalk.send(n1,"__star",[(2)]);
+return _st(t1).__lt((1000));
+}))._whileTrue_((function(){
+n1=_st(n1).__star((2));
 return n1;
-})]);
+}));
 n2=(28);
-smalltalk.send((function(){
-t2=smalltalk.send((smalltalk.Date || Date),"_millisecondsToRun_",[(function(){
-r=smalltalk.send(n2,"_jsbenchFib",[]);
+_st((function(){
+t2=_st((smalltalk.Date || Date))._millisecondsToRun_((function(){
+r=_st(n2)._jsbenchFib();
 return r;
-})]);
+}));
 t2;
-return smalltalk.send(t2,"__lt",[(1000)]);
-}),"_whileTrue_",[(function(){
-n2=smalltalk.send(n2,"__plus",[(1)]);
+return _st(t2).__lt((1000));
+}))._whileTrue_((function(){
+n2=_st(n2).__plus((1));
 return n2;
-})]);
-$1=smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(n1,"__star",[(500000)]),"__star",[(1000)]),"__slash",[t1]),"_printString",[]),"__comma",[" bytecodes/sec; "]),"__comma",[smalltalk.send(smalltalk.send(smalltalk.send(r,"__star",[(1000)]),"__slash",[t2]),"_printString",[])]),"__comma",[" sends/sec"]);
+}));
+$1=_st(_st(_st(_st(_st(_st(_st(n1).__star((500000))).__star((1000))).__slash(t1))._printString()).__comma(" bytecodes/sec; ")).__comma(_st(_st(_st(r).__star((1000))).__slash(t2))._printString())).__comma(" sends/sec");
 return $1;
-}
+}, self, "jstinyBenchmarks", [], smalltalk.Number)}
 }),
 smalltalk.Number);
 
@@ -173,38 +173,38 @@ smalltalk.method({
 selector: "tinyBenchmarks",
 fn: function (){
 var self=this;
-var $1;
+return smalltalk.withContext(function($ctx) { var $1;
 var t1;
 var t2;
 var r;
 var n1;
 var n2;
 n1=(1);
-smalltalk.send((function(){
-t1=smalltalk.send((smalltalk.Date || Date),"_millisecondsToRun_",[(function(){
-return smalltalk.send(n1,"_benchmark",[]);
-})]);
+_st((function(){
+t1=_st((smalltalk.Date || Date))._millisecondsToRun_((function(){
+return _st(n1)._benchmark();
+}));
 t1;
-return smalltalk.send(t1,"__lt",[(1000)]);
-}),"_whileTrue_",[(function(){
-n1=smalltalk.send(n1,"__star",[(2)]);
+return _st(t1).__lt((1000));
+}))._whileTrue_((function(){
+n1=_st(n1).__star((2));
 return n1;
-})]);
+}));
 n2=(16);
-smalltalk.send((function(){
-t2=smalltalk.send((smalltalk.Date || Date),"_millisecondsToRun_",[(function(){
-r=smalltalk.send(n2,"_benchFib",[]);
+_st((function(){
+t2=_st((smalltalk.Date || Date))._millisecondsToRun_((function(){
+r=_st(n2)._benchFib();
 return r;
-})]);
+}));
 t2;
-return smalltalk.send(t2,"__lt",[(1000)]);
-}),"_whileTrue_",[(function(){
-n2=smalltalk.send(n2,"__plus",[(1)]);
+return _st(t2).__lt((1000));
+}))._whileTrue_((function(){
+n2=_st(n2).__plus((1));
 return n2;
-})]);
-$1=smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(n1,"__star",[(500000)]),"__star",[(1000)]),"__slash",[t1]),"_printString",[]),"__comma",[" bytecodes/sec; "]),"__comma",[smalltalk.send(smalltalk.send(smalltalk.send(r,"__star",[(1000)]),"__slash",[t2]),"_printString",[])]),"__comma",[" sends/sec"]);
+}));
+$1=_st(_st(_st(_st(_st(_st(_st(n1).__star((500000))).__star((1000))).__slash(t1))._printString()).__comma(" bytecodes/sec; ")).__comma(_st(_st(_st(r).__star((1000))).__slash(t2))._printString())).__comma(" sends/sec");
 return $1;
-}
+}, self, "tinyBenchmarks", [], smalltalk.Number)}
 }),
 smalltalk.Number);
 

+ 70 - 70
js/Benchfib.js

@@ -8,10 +8,10 @@ selector: "main",
 category: 'not yet classified',
 fn: function (){
 var self=this;
-var result;
-result=smalltalk.send((0),"_tinyBenchmarks",[]);
-smalltalk.send(console,"_log_",[smalltalk.send("0 tinyBenchmarks => ","__comma",[result])]);
-return self},
+return smalltalk.withContext(function($ctx) { var result;
+result=_st((0))._tinyBenchmarks();
+_st(console)._log_(_st("0 tinyBenchmarks => ").__comma(result));
+return self}, self, "main", [], smalltalk.Benchfib.klass)},
 args: [],
 source: "main\x0a\x0a\x09| result |\x0a\x09result := 0 tinyBenchmarks.\x0a\x09console log: '0 tinyBenchmarks => ' , result",
 messageSends: ["tinyBenchmarks", "log:", ","],
@@ -27,15 +27,15 @@ selector: "benchFib",
 category: '*Benchfib',
 fn: function (){
 var self=this;
-var $2,$1;
-$2=smalltalk.send(self,"__lt",[(2)]);
+return smalltalk.withContext(function($ctx) { var $2,$1;
+$2=_st(self).__lt((2));
 if(smalltalk.assert($2)){
 $1=(1);
 } else {
-$1=smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self,"__minus",[(1)]),"_benchFib",[]),"__plus",[smalltalk.send(smalltalk.send(self,"__minus",[(2)]),"_benchFib",[])]),"__plus",[(1)]);
+$1=_st(_st(_st(_st(self).__minus((1)))._benchFib()).__plus(_st(_st(self).__minus((2)))._benchFib())).__plus((1));
 };
 return $1;
-},
+}, self, "benchFib", [], smalltalk.Number)},
 args: [],
 source: "benchFib \x0a\x09\x22Handy send-heavy benchmark\x22\x0a\x09\x22(result // seconds to run) = approx calls per second\x22\x0a\x09\x22 | r t |\x0a\x09  t := Time millisecondsToRun: [r := 26 benchFib].\x0a\x09  (r * 1000) // t\x22\x0a\x09\x22138000 on a Mac 8100/100\x22\x0a\x09^ self < 2 \x0a\x09\x09ifTrue: [1] \x0a\x09\x09ifFalse: [(self-1) benchFib + (self-2) benchFib + 1]",
 messageSends: ["ifTrue:ifFalse:", "+", "benchFib", "-", "<"],
@@ -50,42 +50,42 @@ selector: "benchmark",
 category: '*Benchfib',
 fn: function (){
 var self=this;
-var $1;
+return smalltalk.withContext(function($ctx) { var $1;
 var size;
 var flags;
 var prime;
 var k;
 var count;
 size=(8190);
-smalltalk.send((1),"_to_do_",[self,(function(iter){
+_st((1))._to_do_(self,(function(iter){
 count=(0);
 count;
-flags=smalltalk.send((smalltalk.Array || Array),"_new",[]);
+flags=_st((smalltalk.Array || Array))._new();
 flags;
-smalltalk.send(size,"_timesRepeat_",[(function(){
-return smalltalk.send(flags,"_add_",[true]);
-})]);
-return smalltalk.send((1),"_to_do_",[size,(function(i){
-$1=smalltalk.send(flags,"_at_",[i]);
+_st(size)._timesRepeat_((function(){
+return _st(flags)._add_(true);
+}));
+return _st((1))._to_do_(size,(function(i){
+$1=_st(flags)._at_(i);
 if(smalltalk.assert($1)){
-prime=smalltalk.send(i,"__plus",[(1)]);
+prime=_st(i).__plus((1));
 prime;
-k=smalltalk.send(i,"__plus",[prime]);
+k=_st(i).__plus(prime);
 k;
-smalltalk.send((function(){
-return smalltalk.send(k,"__lt_eq",[size]);
-}),"_whileTrue_",[(function(){
-smalltalk.send(flags,"_at_put_",[k,false]);
-k=smalltalk.send(k,"__plus",[prime]);
+_st((function(){
+return _st(k).__lt_eq(size);
+}))._whileTrue_((function(){
+_st(flags)._at_put_(k,false);
+k=_st(k).__plus(prime);
 return k;
-})]);
-count=smalltalk.send(count,"__plus",[(1)]);
+}));
+count=_st(count).__plus((1));
 return count;
 };
-})]);
-})]);
+}));
+}));
 return count;
-},
+}, self, "benchmark", [], smalltalk.Number)},
 args: [],
 source: "benchmark \x0a\x09\x22Handy bytecode-heavy benchmark\x22\x0a\x09\x22(500000 // time to run) = approx bytecodes per second\x22\x0a\x09\x225000000 // (Time millisecondsToRun: [10 benchmark]) * 1000\x22\x0a\x09\x223059000 on a Mac 8100/100\x22\x0a    | size flags prime k count |\x0a    size := 8190.\x0a    1 to: self do:\x0a        [:iter |\x0a        count := 0.\x0a        flags := Array new.\x0a        size timesRepeat: [ flags add: true].\x0a        1 to: size do:\x0a            [:i | (flags at: i) ifTrue:\x0a                [prime := i+1.\x0a                k := i + prime.\x0a                [k <= size] whileTrue:\x0a                    [flags at: k put: false.\x0a                    k := k + prime].\x0a                count := count + 1]]].\x0a    ^ count",
 messageSends: ["to:do:", "new", "timesRepeat:", "add:", "ifTrue:", "+", "whileTrue:", "at:put:", "<=", "at:"],
@@ -100,12 +100,12 @@ selector: "jsbenchFib",
 category: '*Benchfib',
 fn: function (){
 var self=this;
-if (this < 2) {
+return smalltalk.withContext(function($ctx) { if (this < 2) {
 return 1;
 } else {
 return (this-1)._jsbenchFib() + (this-2)._jsbenchFib() + 1;};
 ;
-return self},
+return self}, self, "jsbenchFib", [], smalltalk.Number)},
 args: [],
 source: "jsbenchFib\x0a \x0a\x09<if (this < 2) {\x0areturn 1;\x0a} else {\x0areturn (this-1)._jsbenchFib() + (this-2)._jsbenchFib() + 1;}>",
 messageSends: [],
@@ -120,7 +120,7 @@ selector: "jsbenchmark",
 category: '*Benchfib',
 fn: function (){
 var self=this;
-
+return smalltalk.withContext(function($ctx) { 
 var size = 8190;
 var count;
 for (var z=0;z<this;z++) {
@@ -143,7 +143,7 @@ for (var z=0;z<this;z++) {
 }
 return count;
 ;
-return self},
+return self}, self, "jsbenchmark", [], smalltalk.Number)},
 args: [],
 source: "jsbenchmark\x0a\x0a<\x0avar size = 8190;\x0avar count;\x0afor (var z=0;z<this;z++) {\x0a  count = 0;\x0a  var flags = new Array();\x0a  for (var p=0; p<size; p++) {\x0a    flags[p] = true;\x0a  }\x0a  for (var i=1;i<=size;i++) {\x0a    if (flags[i-1]) {\x0a      var prime = i+1;\x0a      var k = i + prime;\x0a      while (k <= size) {\x0a        flags[k-1] = false;\x0a        k = k + prime;\x0a      }\x0a      count = count + 1;\x0a    }\x0a  }\x0a}\x0areturn count>",
 messageSends: [],
@@ -158,38 +158,38 @@ selector: "jstinyBenchmarks",
 category: '*Benchfib',
 fn: function (){
 var self=this;
-var $1;
+return smalltalk.withContext(function($ctx) { var $1;
 var t1;
 var t2;
 var r;
 var n1;
 var n2;
 n1=(1);
-smalltalk.send((function(){
-t1=smalltalk.send((smalltalk.Date || Date),"_millisecondsToRun_",[(function(){
-return smalltalk.send(n1,"_jsbenchmark",[]);
-})]);
+_st((function(){
+t1=_st((smalltalk.Date || Date))._millisecondsToRun_((function(){
+return _st(n1)._jsbenchmark();
+}));
 t1;
-return smalltalk.send(t1,"__lt",[(1000)]);
-}),"_whileTrue_",[(function(){
-n1=smalltalk.send(n1,"__star",[(2)]);
+return _st(t1).__lt((1000));
+}))._whileTrue_((function(){
+n1=_st(n1).__star((2));
 return n1;
-})]);
+}));
 n2=(28);
-smalltalk.send((function(){
-t2=smalltalk.send((smalltalk.Date || Date),"_millisecondsToRun_",[(function(){
-r=smalltalk.send(n2,"_jsbenchFib",[]);
+_st((function(){
+t2=_st((smalltalk.Date || Date))._millisecondsToRun_((function(){
+r=_st(n2)._jsbenchFib();
 return r;
-})]);
+}));
 t2;
-return smalltalk.send(t2,"__lt",[(1000)]);
-}),"_whileTrue_",[(function(){
-n2=smalltalk.send(n2,"__plus",[(1)]);
+return _st(t2).__lt((1000));
+}))._whileTrue_((function(){
+n2=_st(n2).__plus((1));
 return n2;
-})]);
-$1=smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(n1,"__star",[(500000)]),"__star",[(1000)]),"__slash",[t1]),"_printString",[]),"__comma",[" bytecodes/sec; "]),"__comma",[smalltalk.send(smalltalk.send(smalltalk.send(r,"__star",[(1000)]),"__slash",[t2]),"_printString",[])]),"__comma",[" sends/sec"]);
+}));
+$1=_st(_st(_st(_st(_st(_st(_st(n1).__star((500000))).__star((1000))).__slash(t1))._printString()).__comma(" bytecodes/sec; ")).__comma(_st(_st(_st(r).__star((1000))).__slash(t2))._printString())).__comma(" sends/sec");
 return $1;
-},
+}, self, "jstinyBenchmarks", [], smalltalk.Number)},
 args: [],
 source: "jstinyBenchmarks\x0a\x09\x220 jstinyBenchmarks\x22\x0a\x0a\x09| t1 t2 r n1 n2 |\x0a\x09n1 := 1.\x0a\x09[t1 := Date millisecondsToRun: [n1 jsbenchmark].\x0a\x09t1 < 1000] whileTrue:[n1 := n1 * 2]. \x22Note: #benchmark's runtime is about O(n)\x22\x0a\x0a\x09n2 := 28.\x0a\x09[t2 := Date millisecondsToRun: [r := n2 jsbenchFib].\x0a\x09t2 < 1000] whileTrue:[n2 := n2 + 1]. \x0a\x09\x22Note: #jsbenchFib's runtime is about O(k^n),\x0a\x09\x09where k is the golden number = (1 + 5 sqrt) / 2 = 1.618....\x22\x0a\x0a\x09^ ((n1 * 500000 * 1000) / t1) printString, ' bytecodes/sec; ',\x0a\x09  ((r * 1000) / t2) printString, ' sends/sec'",
 messageSends: ["whileTrue:", "*", "millisecondsToRun:", "jsbenchmark", "<", "+", "jsbenchFib", ",", "printString", "/"],
@@ -204,38 +204,38 @@ selector: "tinyBenchmarks",
 category: '*Benchfib',
 fn: function (){
 var self=this;
-var $1;
+return smalltalk.withContext(function($ctx) { var $1;
 var t1;
 var t2;
 var r;
 var n1;
 var n2;
 n1=(1);
-smalltalk.send((function(){
-t1=smalltalk.send((smalltalk.Date || Date),"_millisecondsToRun_",[(function(){
-return smalltalk.send(n1,"_benchmark",[]);
-})]);
+_st((function(){
+t1=_st((smalltalk.Date || Date))._millisecondsToRun_((function(){
+return _st(n1)._benchmark();
+}));
 t1;
-return smalltalk.send(t1,"__lt",[(1000)]);
-}),"_whileTrue_",[(function(){
-n1=smalltalk.send(n1,"__star",[(2)]);
+return _st(t1).__lt((1000));
+}))._whileTrue_((function(){
+n1=_st(n1).__star((2));
 return n1;
-})]);
+}));
 n2=(16);
-smalltalk.send((function(){
-t2=smalltalk.send((smalltalk.Date || Date),"_millisecondsToRun_",[(function(){
-r=smalltalk.send(n2,"_benchFib",[]);
+_st((function(){
+t2=_st((smalltalk.Date || Date))._millisecondsToRun_((function(){
+r=_st(n2)._benchFib();
 return r;
-})]);
+}));
 t2;
-return smalltalk.send(t2,"__lt",[(1000)]);
-}),"_whileTrue_",[(function(){
-n2=smalltalk.send(n2,"__plus",[(1)]);
+return _st(t2).__lt((1000));
+}))._whileTrue_((function(){
+n2=_st(n2).__plus((1));
 return n2;
-})]);
-$1=smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(n1,"__star",[(500000)]),"__star",[(1000)]),"__slash",[t1]),"_printString",[]),"__comma",[" bytecodes/sec; "]),"__comma",[smalltalk.send(smalltalk.send(smalltalk.send(r,"__star",[(1000)]),"__slash",[t2]),"_printString",[])]),"__comma",[" sends/sec"]);
+}));
+$1=_st(_st(_st(_st(_st(_st(_st(n1).__star((500000))).__star((1000))).__slash(t1))._printString()).__comma(" bytecodes/sec; ")).__comma(_st(_st(_st(r).__star((1000))).__slash(t2))._printString())).__comma(" sends/sec");
 return $1;
-},
+}, self, "tinyBenchmarks", [], smalltalk.Number)},
 args: [],
 source: "tinyBenchmarks \x0a\x09\x22Report the results of running the two tiny Squeak benchmarks.\x0a\x09ar 9/10/1999: Adjusted to run at least 1 sec to get more stable results\x22\x0a\x09\x220 tinyBenchmarks\x22\x0a\x09\x22On a 292 MHz G3 Mac: 22727272 bytecodes/sec; 984169 sends/sec\x22\x0a\x09\x22On a 400 MHz PII/Win98:  18028169 bytecodes/sec; 1081272 sends/sec\x22\x0a\x09| t1 t2 r n1 n2 |\x0a\x09n1 := 1.\x0a\x09[t1 := Date millisecondsToRun: [n1 benchmark].\x0a\x09t1 < 1000] whileTrue:[n1 := n1 * 2]. \x22Note: #benchmark's runtime is about O(n)\x22\x0a\x0a\x09n2 := 16.\x0a\x09[t2 := Date millisecondsToRun: [r := n2 benchFib].\x0a\x09t2 < 1000] whileTrue:[n2 := n2 + 1]. \x0a\x09\x22Note: #benchFib's runtime is about O(k^n),\x0a\x09\x09where k is the golden number = (1 + 5 sqrt) / 2 = 1.618....\x22\x0a\x0a\x09^ ((n1 * 500000 * 1000) / t1) printString, ' bytecodes/sec; ',\x0a\x09  ((r * 1000) / t2) printString, ' sends/sec'",
 messageSends: ["whileTrue:", "*", "millisecondsToRun:", "benchmark", "<", "+", "benchFib", ",", "printString", "/"],

文件差异内容过多而无法显示
+ 215 - 215
js/Canvas.deploy.js


文件差异内容过多而无法显示
+ 215 - 215
js/Canvas.js


文件差异内容过多而无法显示
+ 191 - 191
js/Compiler-AST.deploy.js


文件差异内容过多而无法显示
+ 191 - 191
js/Compiler-AST.js


文件差异内容过多而无法显示
+ 175 - 950
js/Compiler-Core.deploy.js


文件差异内容过多而无法显示
+ 175 - 385
js/Compiler-Core.js


+ 18 - 18
js/Compiler-Exceptions.deploy.js

@@ -18,10 +18,10 @@ smalltalk.method({
 selector: "messageText",
 fn: function (){
 var self=this;
-var $1;
-$1=smalltalk.send(" Invalid assignment to variable: ","__comma",[smalltalk.send(self,"_variableName",[])]);
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st(" Invalid assignment to variable: ").__comma(_st(self)._variableName());
 return $1;
-}
+}, self, "messageText", [], smalltalk.InvalidAssignmentError)}
 }),
 smalltalk.InvalidAssignmentError);
 
@@ -31,8 +31,8 @@ smalltalk.method({
 selector: "variableName",
 fn: function (){
 var self=this;
-return self["@variableName"];
-}
+return smalltalk.withContext(function($ctx) { return self["@variableName"];
+}, self, "variableName", [], smalltalk.InvalidAssignmentError)}
 }),
 smalltalk.InvalidAssignmentError);
 
@@ -42,8 +42,8 @@ smalltalk.method({
 selector: "variableName:",
 fn: function (aString){
 var self=this;
-self["@variableName"]=aString;
-return self}
+return smalltalk.withContext(function($ctx) { self["@variableName"]=aString;
+return self}, self, "variableName:", [aString], smalltalk.InvalidAssignmentError)}
 }),
 smalltalk.InvalidAssignmentError);
 
@@ -56,10 +56,10 @@ smalltalk.method({
 selector: "messageText",
 fn: function (){
 var self=this;
-var $1;
-$1=smalltalk.send(smalltalk.send("Variable shadowing error: ","__comma",[smalltalk.send(self,"_variableName",[])]),"__comma",[" is already defined"]);
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st(_st("Variable shadowing error: ").__comma(_st(self)._variableName())).__comma(" is already defined");
 return $1;
-}
+}, self, "messageText", [], smalltalk.ShadowingVariableError)}
 }),
 smalltalk.ShadowingVariableError);
 
@@ -69,8 +69,8 @@ smalltalk.method({
 selector: "variableName",
 fn: function (){
 var self=this;
-return self["@variableName"];
-}
+return smalltalk.withContext(function($ctx) { return self["@variableName"];
+}, self, "variableName", [], smalltalk.ShadowingVariableError)}
 }),
 smalltalk.ShadowingVariableError);
 
@@ -80,8 +80,8 @@ smalltalk.method({
 selector: "variableName:",
 fn: function (aString){
 var self=this;
-self["@variableName"]=aString;
-return self}
+return smalltalk.withContext(function($ctx) { self["@variableName"]=aString;
+return self}, self, "variableName:", [aString], smalltalk.ShadowingVariableError)}
 }),
 smalltalk.ShadowingVariableError);
 
@@ -94,8 +94,8 @@ smalltalk.method({
 selector: "variableName",
 fn: function (){
 var self=this;
-return self["@variableName"];
-}
+return smalltalk.withContext(function($ctx) { return self["@variableName"];
+}, self, "variableName", [], smalltalk.UnknownVariableError)}
 }),
 smalltalk.UnknownVariableError);
 
@@ -105,8 +105,8 @@ smalltalk.method({
 selector: "variableName:",
 fn: function (aString){
 var self=this;
-self["@variableName"]=aString;
-return self}
+return smalltalk.withContext(function($ctx) { self["@variableName"]=aString;
+return self}, self, "variableName:", [aString], smalltalk.UnknownVariableError)}
 }),
 smalltalk.UnknownVariableError);
 

+ 18 - 18
js/Compiler-Exceptions.js

@@ -24,10 +24,10 @@ selector: "messageText",
 category: 'accessing',
 fn: function (){
 var self=this;
-var $1;
-$1=smalltalk.send(" Invalid assignment to variable: ","__comma",[smalltalk.send(self,"_variableName",[])]);
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st(" Invalid assignment to variable: ").__comma(_st(self)._variableName());
 return $1;
-},
+}, self, "messageText", [], smalltalk.InvalidAssignmentError)},
 args: [],
 source: "messageText\x0a\x09^ ' Invalid assignment to variable: ', self variableName",
 messageSends: [",", "variableName"],
@@ -42,8 +42,8 @@ selector: "variableName",
 category: 'accessing',
 fn: function (){
 var self=this;
-return self["@variableName"];
-},
+return smalltalk.withContext(function($ctx) { return self["@variableName"];
+}, self, "variableName", [], smalltalk.InvalidAssignmentError)},
 args: [],
 source: "variableName\x0a\x09^ variableName",
 messageSends: [],
@@ -58,8 +58,8 @@ selector: "variableName:",
 category: 'accessing',
 fn: function (aString){
 var self=this;
-self["@variableName"]=aString;
-return self},
+return smalltalk.withContext(function($ctx) { self["@variableName"]=aString;
+return self}, self, "variableName:", [aString], smalltalk.InvalidAssignmentError)},
 args: ["aString"],
 source: "variableName: aString\x0a\x09variableName := aString",
 messageSends: [],
@@ -78,10 +78,10 @@ selector: "messageText",
 category: 'accessing',
 fn: function (){
 var self=this;
-var $1;
-$1=smalltalk.send(smalltalk.send("Variable shadowing error: ","__comma",[smalltalk.send(self,"_variableName",[])]),"__comma",[" is already defined"]);
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st(_st("Variable shadowing error: ").__comma(_st(self)._variableName())).__comma(" is already defined");
 return $1;
-},
+}, self, "messageText", [], smalltalk.ShadowingVariableError)},
 args: [],
 source: "messageText\x0a\x09^ 'Variable shadowing error: ', self variableName, ' is already defined'",
 messageSends: [",", "variableName"],
@@ -96,8 +96,8 @@ selector: "variableName",
 category: 'accessing',
 fn: function (){
 var self=this;
-return self["@variableName"];
-},
+return smalltalk.withContext(function($ctx) { return self["@variableName"];
+}, self, "variableName", [], smalltalk.ShadowingVariableError)},
 args: [],
 source: "variableName\x0a\x09^ variableName",
 messageSends: [],
@@ -112,8 +112,8 @@ selector: "variableName:",
 category: 'accessing',
 fn: function (aString){
 var self=this;
-self["@variableName"]=aString;
-return self},
+return smalltalk.withContext(function($ctx) { self["@variableName"]=aString;
+return self}, self, "variableName:", [aString], smalltalk.ShadowingVariableError)},
 args: ["aString"],
 source: "variableName: aString\x0a\x09variableName := aString",
 messageSends: [],
@@ -132,8 +132,8 @@ selector: "variableName",
 category: 'accessing',
 fn: function (){
 var self=this;
-return self["@variableName"];
-},
+return smalltalk.withContext(function($ctx) { return self["@variableName"];
+}, self, "variableName", [], smalltalk.UnknownVariableError)},
 args: [],
 source: "variableName\x0a\x09^ variableName",
 messageSends: [],
@@ -148,8 +148,8 @@ selector: "variableName:",
 category: 'accessing',
 fn: function (aString){
 var self=this;
-self["@variableName"]=aString;
-return self},
+return smalltalk.withContext(function($ctx) { self["@variableName"]=aString;
+return self}, self, "variableName:", [aString], smalltalk.UnknownVariableError)},
 args: ["aString"],
 source: "variableName: aString\x0a\x09variableName := aString",
 messageSends: [],

文件差异内容过多而无法显示
+ 263 - 262
js/Compiler-IR.deploy.js


文件差异内容过多而无法显示
+ 263 - 262
js/Compiler-IR.js


文件差异内容过多而无法显示
+ 266 - 266
js/Compiler-Inlining.deploy.js


文件差异内容过多而无法显示
+ 266 - 266
js/Compiler-Inlining.js


+ 79 - 48
js/Compiler-Interpreter.deploy.js

@@ -6,10 +6,10 @@ smalltalk.method({
 selector: "blockValue:",
 fn: function (anASTBlockClosure){
 var self=this;
-var $1;
-$1=smalltalk.send(self,"_interpret_",[smalltalk.send(smalltalk.send(smalltalk.send(anASTBlockClosure,"_astNode",[]),"_nodes",[]),"_first",[])]);
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st(self)._interpret_(_st(_st(_st(anASTBlockClosure)._astNode())._nodes())._first());
 return $1;
-}
+}, self, "blockValue:", [anASTBlockClosure], smalltalk.ASTInterpreter)}
 }),
 smalltalk.ASTInterpreter);
 
@@ -19,8 +19,8 @@ smalltalk.method({
 selector: "context",
 fn: function (){
 var self=this;
-return self["@context"];
-}
+return smalltalk.withContext(function($ctx) { return self["@context"];
+}, self, "context", [], smalltalk.ASTInterpreter)}
 }),
 smalltalk.ASTInterpreter);
 
@@ -30,8 +30,8 @@ smalltalk.method({
 selector: "context:",
 fn: function (aMethodContext){
 var self=this;
-self["@context"]=aMethodContext;
-return self}
+return smalltalk.withContext(function($ctx) { self["@context"]=aMethodContext;
+return self}, self, "context:", [aMethodContext], smalltalk.ASTInterpreter)}
 }),
 smalltalk.ASTInterpreter);
 
@@ -41,9 +41,9 @@ smalltalk.method({
 selector: "initialize",
 fn: function (){
 var self=this;
-smalltalk.send(self,"_initialize",[],smalltalk.NodeVisitor);
+return smalltalk.withContext(function($ctx) { smalltalk.NodeVisitor.fn.prototype._initialize.apply(_st(self), []);
 self["@shouldReturn"]=false;
-return self}
+return self}, self, "initialize", [], smalltalk.ASTInterpreter)}
 }),
 smalltalk.ASTInterpreter);
 
@@ -53,11 +53,11 @@ smalltalk.method({
 selector: "interpret:",
 fn: function (aNode){
 var self=this;
-var $1;
+return smalltalk.withContext(function($ctx) { var $1;
 self["@shouldReturn"]=false;
-$1=smalltalk.send(self,"_interpretNode_",[aNode]);
+$1=_st(self)._interpretNode_(aNode);
 return $1;
-}
+}, self, "interpret:", [aNode], smalltalk.ASTInterpreter)}
 }),
 smalltalk.ASTInterpreter);
 
@@ -67,11 +67,11 @@ smalltalk.method({
 selector: "interpretNode:",
 fn: function (aNode){
 var self=this;
-var $1;
+return smalltalk.withContext(function($ctx) { var $1;
 self["@currentNode"]=aNode;
-$1=smalltalk.send(self,"_visit_",[aNode]);
+$1=_st(self)._visit_(aNode);
 return $1;
-}
+}, self, "interpretNode:", [aNode], smalltalk.ASTInterpreter)}
 }),
 smalltalk.ASTInterpreter);
 
@@ -81,10 +81,10 @@ smalltalk.method({
 selector: "send:to:arguments:",
 fn: function (aSelector,anObject,aCollection){
 var self=this;
-var $1;
-$1=smalltalk.send(anObject,"_perform_withArguments_",[aSelector,aCollection]);
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st(anObject)._perform_withArguments_(aSelector,aCollection);
 return $1;
-}
+}, self, "send:to:arguments:", [aSelector,anObject,aCollection], smalltalk.ASTInterpreter)}
 }),
 smalltalk.ASTInterpreter);
 
@@ -94,12 +94,41 @@ smalltalk.method({
 selector: "visitBlockNode:",
 fn: function (aNode){
 var self=this;
-var $1;
+return smalltalk.withContext(function($ctx) { var $1;
 $1=(function(){
 return _st(self)._interpretNode_(_st(_st(aNode)._nodes())._first());
 });
 return $1;
-}
+}, self, "visitBlockNode:", [aNode], smalltalk.ASTInterpreter)}
+}),
+smalltalk.ASTInterpreter);
+
+smalltalk.addMethod(
+"_visitCascadeNode_",
+smalltalk.method({
+selector: "visitCascadeNode:",
+fn: function (aNode){
+var self=this;
+return smalltalk.withContext(function($ctx) { var $1;
+_st(_st(_st(aNode)._nodes())._allButLast())._do_((function(each){
+_st(each)._receiver_(_st(aNode)._receiver());
+return _st(self)._interpretNode_(each);
+}));
+_st(_st(_st(aNode)._nodes())._last())._receiver_(_st(aNode)._receiver());
+$1=_st(self)._interpretNode_(_st(_st(aNode)._nodes())._last());
+return $1;
+}, self, "visitCascadeNode:", [aNode], smalltalk.ASTInterpreter)}
+}),
+smalltalk.ASTInterpreter);
+
+smalltalk.addMethod(
+"_visitJSStatementNode_",
+smalltalk.method({
+selector: "visitJSStatementNode:",
+fn: function (aNode){
+var self=this;
+return smalltalk.withContext(function($ctx) { _st(self)._halt();
+return self}, self, "visitJSStatementNode:", [aNode], smalltalk.ASTInterpreter)}
 }),
 smalltalk.ASTInterpreter);
 
@@ -109,11 +138,11 @@ smalltalk.method({
 selector: "visitReturnNode:",
 fn: function (aNode){
 var self=this;
-var $1;
+return smalltalk.withContext(function($ctx) { var $1;
 self["@shouldReturn"]=true;
 $1=_st(self)._interpretNode_(_st(_st(aNode)._nodes())._first());
 return $1;
-}
+}, self, "visitReturnNode:", [aNode], smalltalk.ASTInterpreter)}
 }),
 smalltalk.ASTInterpreter);
 
@@ -123,7 +152,7 @@ smalltalk.method({
 selector: "visitSendNode:",
 fn: function (aNode){
 var self=this;
-var $1;
+return smalltalk.withContext(function($ctx) { var $1;
 var receiver;
 var arguments;
 receiver=_st(self)._interpretNode_(_st(aNode)._receiver());
@@ -132,7 +161,7 @@ return _st(self)._interpretNode_(each);
 }));
 $1=_st(self)._send_to_arguments_(_st(aNode)._selector(),receiver,arguments);
 return $1;
-}
+}, self, "visitSendNode:", [aNode], smalltalk.ASTInterpreter)}
 }),
 smalltalk.ASTInterpreter);
 
@@ -142,7 +171,7 @@ smalltalk.method({
 selector: "visitSequenceNode:",
 fn: function (aNode){
 var self=this;
-var $1;
+return smalltalk.withContext(function($ctx) { var $1;
 var $early={};
 try {
 _st(_st(_st(aNode)._nodes())._allButLast())._do_((function(each){
@@ -157,7 +186,7 @@ $1=_st(self)._interpretNode_(_st(_st(aNode)._nodes())._last());
 return $1;
 }
 catch(e) {if(e===$early)return e[0]; throw e}
-}
+}, self, "visitSequenceNode:", [aNode], smalltalk.ASTInterpreter)}
 }),
 smalltalk.ASTInterpreter);
 
@@ -167,27 +196,27 @@ smalltalk.method({
 selector: "visitValueNode:",
 fn: function (aNode){
 var self=this;
-var $1;
-$1=smalltalk.send(aNode,"_value",[]);
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st(aNode)._value();
 return $1;
-}
+}, self, "visitValueNode:", [aNode], smalltalk.ASTInterpreter)}
 }),
 smalltalk.ASTInterpreter);
 
 
 
-smalltalk.addClass('ASTInterpretorTest', smalltalk.TestCase, [], 'Compiler-Interpreter');
+smalltalk.addClass('ASTInterpreterTest', smalltalk.TestCase, [], 'Compiler-Interpreter');
 smalltalk.addMethod(
 "_analyze_forClass_",
 smalltalk.method({
 selector: "analyze:forClass:",
 fn: function (aNode,aClass){
 var self=this;
-_st(_st((smalltalk.SemanticAnalyzer || SemanticAnalyzer))._on_(aClass))._visit_(aNode);
+return smalltalk.withContext(function($ctx) { _st(_st((smalltalk.SemanticAnalyzer || SemanticAnalyzer))._on_(aClass))._visit_(aNode);
 return aNode;
-}
+}, self, "analyze:forClass:", [aNode,aClass], smalltalk.ASTInterpreterTest)}
 }),
-smalltalk.ASTInterpretorTest);
+smalltalk.ASTInterpreterTest);
 
 smalltalk.addMethod(
 "_interpret_",
@@ -195,12 +224,12 @@ smalltalk.method({
 selector: "interpret:",
 fn: function (aString){
 var self=this;
-var $1;
+return smalltalk.withContext(function($ctx) { var $1;
 $1=_st(_st((smalltalk.ASTInterpreter || ASTInterpreter))._new())._interpret_(_st(_st(_st(self)._parse_forClass_(aString,(smalltalk.Object || Object)))._nodes())._first());
 return $1;
-}
+}, self, "interpret:", [aString], smalltalk.ASTInterpreterTest)}
 }),
-smalltalk.ASTInterpretorTest);
+smalltalk.ASTInterpreterTest);
 
 smalltalk.addMethod(
 "_parse_",
@@ -208,12 +237,12 @@ smalltalk.method({
 selector: "parse:",
 fn: function (aString){
 var self=this;
-var $1;
+return smalltalk.withContext(function($ctx) { var $1;
 $1=_st(_st((smalltalk.Smalltalk || Smalltalk))._current())._parse_(aString);
 return $1;
-}
+}, self, "parse:", [aString], smalltalk.ASTInterpreterTest)}
 }),
-smalltalk.ASTInterpretorTest);
+smalltalk.ASTInterpreterTest);
 
 smalltalk.addMethod(
 "_parse_forClass_",
@@ -221,12 +250,12 @@ smalltalk.method({
 selector: "parse:forClass:",
 fn: function (aString,aClass){
 var self=this;
-var $1;
+return smalltalk.withContext(function($ctx) { var $1;
 $1=_st(self)._analyze_forClass_(_st(self)._parse_(aString),aClass);
 return $1;
-}
+}, self, "parse:forClass:", [aString,aClass], smalltalk.ASTInterpreterTest)}
 }),
-smalltalk.ASTInterpretorTest);
+smalltalk.ASTInterpreterTest);
 
 smalltalk.addMethod(
 "_testBinarySend",
@@ -234,10 +263,10 @@ smalltalk.method({
 selector: "testBinarySend",
 fn: function (){
 var self=this;
-_st(self)._assert_equals_(_st(self)._interpret_("foo 2+3+4"),(9));
-return self}
+return smalltalk.withContext(function($ctx) { _st(self)._assert_equals_(_st(self)._interpret_("foo 2+3+4"),(9));
+return self}, self, "testBinarySend", [], smalltalk.ASTInterpreterTest)}
 }),
-smalltalk.ASTInterpretorTest);
+smalltalk.ASTInterpreterTest);
 
 smalltalk.addMethod(
 "_testBlockLiteral",
@@ -245,10 +274,12 @@ smalltalk.method({
 selector: "testBlockLiteral",
 fn: function (){
 var self=this;
-_st(self)._assert_(false);
-return self}
+return smalltalk.withContext(function($ctx) { _st(self)._assert_equals_(_st(self)._interpret_("foo ^ true ifTrue: [ 1 ] ifFalse: [ 2 ]"),(1));
+_st(self)._assert_equals_(_st(self)._interpret_("foo true ifTrue: [ ^ 1 ] ifFalse: [ 2 ]"),(1));
+_st(self)._assert_equals_(_st(self)._interpret_("foo ^ false ifTrue: [ 1 ] ifFalse: [ 2 ]"),(2));
+return self}, self, "testBlockLiteral", [], smalltalk.ASTInterpreterTest)}
 }),
-smalltalk.ASTInterpretorTest);
+smalltalk.ASTInterpreterTest);
 
 
 

+ 91 - 50
js/Compiler-Interpreter.js

@@ -7,10 +7,10 @@ selector: "blockValue:",
 category: 'interpreting',
 fn: function (anASTBlockClosure){
 var self=this;
-var $1;
-$1=smalltalk.send(self,"_interpret_",[smalltalk.send(smalltalk.send(smalltalk.send(anASTBlockClosure,"_astNode",[]),"_nodes",[]),"_first",[])]);
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st(self)._interpret_(_st(_st(_st(anASTBlockClosure)._astNode())._nodes())._first());
 return $1;
-},
+}, self, "blockValue:", [anASTBlockClosure], smalltalk.ASTInterpreter)},
 args: ["anASTBlockClosure"],
 source: "blockValue: anASTBlockClosure\x0a\x09^ self interpret: anASTBlockClosure astNode nodes first",
 messageSends: ["interpret:", "first", "nodes", "astNode"],
@@ -25,8 +25,8 @@ selector: "context",
 category: 'accessing',
 fn: function (){
 var self=this;
-return self["@context"];
-},
+return smalltalk.withContext(function($ctx) { return self["@context"];
+}, self, "context", [], smalltalk.ASTInterpreter)},
 args: [],
 source: "context\x0a\x09^ context",
 messageSends: [],
@@ -41,8 +41,8 @@ selector: "context:",
 category: 'accessing',
 fn: function (aMethodContext){
 var self=this;
-self["@context"]=aMethodContext;
-return self},
+return smalltalk.withContext(function($ctx) { self["@context"]=aMethodContext;
+return self}, self, "context:", [aMethodContext], smalltalk.ASTInterpreter)},
 args: ["aMethodContext"],
 source: "context: aMethodContext\x0a\x09context := aMethodContext",
 messageSends: [],
@@ -57,9 +57,9 @@ selector: "initialize",
 category: 'initialization',
 fn: function (){
 var self=this;
-smalltalk.send(self,"_initialize",[],smalltalk.NodeVisitor);
+return smalltalk.withContext(function($ctx) { smalltalk.NodeVisitor.fn.prototype._initialize.apply(_st(self), []);
 self["@shouldReturn"]=false;
-return self},
+return self}, self, "initialize", [], smalltalk.ASTInterpreter)},
 args: [],
 source: "initialize\x0a\x09super initialize.\x0a    shouldReturn := false",
 messageSends: ["initialize"],
@@ -74,11 +74,11 @@ selector: "interpret:",
 category: 'interpreting',
 fn: function (aNode){
 var self=this;
-var $1;
+return smalltalk.withContext(function($ctx) { var $1;
 self["@shouldReturn"]=false;
-$1=smalltalk.send(self,"_interpretNode_",[aNode]);
+$1=_st(self)._interpretNode_(aNode);
 return $1;
-},
+}, self, "interpret:", [aNode], smalltalk.ASTInterpreter)},
 args: ["aNode"],
 source: "interpret: aNode\x0a\x09shouldReturn := false.\x0a    ^ self interpretNode: aNode",
 messageSends: ["interpretNode:"],
@@ -93,11 +93,11 @@ selector: "interpretNode:",
 category: 'interpreting',
 fn: function (aNode){
 var self=this;
-var $1;
+return smalltalk.withContext(function($ctx) { var $1;
 self["@currentNode"]=aNode;
-$1=smalltalk.send(self,"_visit_",[aNode]);
+$1=_st(self)._visit_(aNode);
 return $1;
-},
+}, self, "interpretNode:", [aNode], smalltalk.ASTInterpreter)},
 args: ["aNode"],
 source: "interpretNode: aNode\x0a\x09currentNode := aNode.\x0a    ^ self visit: aNode",
 messageSends: ["visit:"],
@@ -112,10 +112,10 @@ selector: "send:to:arguments:",
 category: 'interpreting',
 fn: function (aSelector,anObject,aCollection){
 var self=this;
-var $1;
-$1=smalltalk.send(anObject,"_perform_withArguments_",[aSelector,aCollection]);
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st(anObject)._perform_withArguments_(aSelector,aCollection);
 return $1;
-},
+}, self, "send:to:arguments:", [aSelector,anObject,aCollection], smalltalk.ASTInterpreter)},
 args: ["aSelector", "anObject", "aCollection"],
 source: "send: aSelector to: anObject arguments: aCollection\x0a\x09^ anObject perform: aSelector withArguments: aCollection",
 messageSends: ["perform:withArguments:"],
@@ -130,12 +130,12 @@ selector: "visitBlockNode:",
 category: 'visiting',
 fn: function (aNode){
 var self=this;
-var $1;
+return smalltalk.withContext(function($ctx) { var $1;
 $1=(function(){
 return _st(self)._interpretNode_(_st(_st(aNode)._nodes())._first());
 });
 return $1;
-},
+}, self, "visitBlockNode:", [aNode], smalltalk.ASTInterpreter)},
 args: ["aNode"],
 source: "visitBlockNode: aNode\x0a    ^ [ self interpretNode: aNode nodes first ]",
 messageSends: ["interpretNode:", "first", "nodes"],
@@ -143,6 +143,45 @@ referencedClasses: []
 }),
 smalltalk.ASTInterpreter);
 
+smalltalk.addMethod(
+"_visitCascadeNode_",
+smalltalk.method({
+selector: "visitCascadeNode:",
+category: 'visiting',
+fn: function (aNode){
+var self=this;
+return smalltalk.withContext(function($ctx) { var $1;
+_st(_st(_st(aNode)._nodes())._allButLast())._do_((function(each){
+_st(each)._receiver_(_st(aNode)._receiver());
+return _st(self)._interpretNode_(each);
+}));
+_st(_st(_st(aNode)._nodes())._last())._receiver_(_st(aNode)._receiver());
+$1=_st(self)._interpretNode_(_st(_st(aNode)._nodes())._last());
+return $1;
+}, self, "visitCascadeNode:", [aNode], smalltalk.ASTInterpreter)},
+args: ["aNode"],
+source: "visitCascadeNode: aNode\x0a\x0a    aNode nodes allButLast\x0a    \x09do: [ :each | \x0a        \x09each receiver: aNode receiver.\x0a\x09\x09\x09self interpretNode: each ].\x0a            \x0a\x09aNode nodes last receiver: aNode receiver.\x0a    ^ self interpretNode: aNode nodes last",
+messageSends: ["do:", "receiver:", "receiver", "interpretNode:", "allButLast", "nodes", "last"],
+referencedClasses: []
+}),
+smalltalk.ASTInterpreter);
+
+smalltalk.addMethod(
+"_visitJSStatementNode_",
+smalltalk.method({
+selector: "visitJSStatementNode:",
+category: 'visiting',
+fn: function (aNode){
+var self=this;
+return smalltalk.withContext(function($ctx) { _st(self)._halt();
+return self}, self, "visitJSStatementNode:", [aNode], smalltalk.ASTInterpreter)},
+args: ["aNode"],
+source: "visitJSStatementNode: aNode\x0a\x09self halt",
+messageSends: ["halt"],
+referencedClasses: []
+}),
+smalltalk.ASTInterpreter);
+
 smalltalk.addMethod(
 "_visitReturnNode_",
 smalltalk.method({
@@ -150,11 +189,11 @@ selector: "visitReturnNode:",
 category: 'visiting',
 fn: function (aNode){
 var self=this;
-var $1;
+return smalltalk.withContext(function($ctx) { var $1;
 self["@shouldReturn"]=true;
 $1=_st(self)._interpretNode_(_st(_st(aNode)._nodes())._first());
 return $1;
-},
+}, self, "visitReturnNode:", [aNode], smalltalk.ASTInterpreter)},
 args: ["aNode"],
 source: "visitReturnNode: aNode\x0a\x09shouldReturn := true.\x0a    ^ self interpretNode: aNode nodes first",
 messageSends: ["interpretNode:", "first", "nodes"],
@@ -169,7 +208,7 @@ selector: "visitSendNode:",
 category: 'visiting',
 fn: function (aNode){
 var self=this;
-var $1;
+return smalltalk.withContext(function($ctx) { var $1;
 var receiver;
 var arguments;
 receiver=_st(self)._interpretNode_(_st(aNode)._receiver());
@@ -178,7 +217,7 @@ return _st(self)._interpretNode_(each);
 }));
 $1=_st(self)._send_to_arguments_(_st(aNode)._selector(),receiver,arguments);
 return $1;
-},
+}, self, "visitSendNode:", [aNode], smalltalk.ASTInterpreter)},
 args: ["aNode"],
 source: "visitSendNode: aNode\x0a\x09\x22TODO: Handle super sends\x22\x0a\x09| receiver arguments |\x0a    \x0a    receiver := self interpretNode: aNode receiver.\x0a    arguments := aNode arguments collect: [ :each |\x0a\x09\x09self interpretNode: each ].\x0a    \x0a    ^ self send: aNode selector to: receiver arguments: arguments",
 messageSends: ["interpretNode:", "receiver", "collect:", "arguments", "send:to:arguments:", "selector"],
@@ -193,7 +232,7 @@ selector: "visitSequenceNode:",
 category: 'visiting',
 fn: function (aNode){
 var self=this;
-var $1;
+return smalltalk.withContext(function($ctx) { var $1;
 var $early={};
 try {
 _st(_st(_st(aNode)._nodes())._allButLast())._do_((function(each){
@@ -208,7 +247,7 @@ $1=_st(self)._interpretNode_(_st(_st(aNode)._nodes())._last());
 return $1;
 }
 catch(e) {if(e===$early)return e[0]; throw e}
-},
+}, self, "visitSequenceNode:", [aNode], smalltalk.ASTInterpreter)},
 args: ["aNode"],
 source: "visitSequenceNode: aNode\x0a\x09aNode nodes allButLast do: [ :each | | value |\x0a        value := self interpretNode: each.\x0a\x09\x09shouldReturn ifTrue: [ ^ value ] ].\x0a    ^ self interpretNode: aNode nodes last",
 messageSends: ["do:", "interpretNode:", "ifTrue:", "allButLast", "nodes", "last"],
@@ -223,10 +262,10 @@ selector: "visitValueNode:",
 category: 'visiting',
 fn: function (aNode){
 var self=this;
-var $1;
-$1=smalltalk.send(aNode,"_value",[]);
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st(aNode)._value();
 return $1;
-},
+}, self, "visitValueNode:", [aNode], smalltalk.ASTInterpreter)},
 args: ["aNode"],
 source: "visitValueNode: aNode\x0a\x09^ aNode value",
 messageSends: ["value"],
@@ -236,7 +275,7 @@ smalltalk.ASTInterpreter);
 
 
 
-smalltalk.addClass('ASTInterpretorTest', smalltalk.TestCase, [], 'Compiler-Interpreter');
+smalltalk.addClass('ASTInterpreterTest', smalltalk.TestCase, [], 'Compiler-Interpreter');
 smalltalk.addMethod(
 "_analyze_forClass_",
 smalltalk.method({
@@ -244,15 +283,15 @@ selector: "analyze:forClass:",
 category: 'accessing',
 fn: function (aNode,aClass){
 var self=this;
-_st(_st((smalltalk.SemanticAnalyzer || SemanticAnalyzer))._on_(aClass))._visit_(aNode);
+return smalltalk.withContext(function($ctx) { _st(_st((smalltalk.SemanticAnalyzer || SemanticAnalyzer))._on_(aClass))._visit_(aNode);
 return aNode;
-},
+}, self, "analyze:forClass:", [aNode,aClass], smalltalk.ASTInterpreterTest)},
 args: ["aNode", "aClass"],
 source: "analyze: aNode forClass: aClass\x0a\x09(SemanticAnalyzer on: aClass) visit: aNode.\x0a    ^ aNode",
 messageSends: ["visit:", "on:"],
 referencedClasses: ["SemanticAnalyzer"]
 }),
-smalltalk.ASTInterpretorTest);
+smalltalk.ASTInterpreterTest);
 
 smalltalk.addMethod(
 "_interpret_",
@@ -261,16 +300,16 @@ selector: "interpret:",
 category: 'accessing',
 fn: function (aString){
 var self=this;
-var $1;
+return smalltalk.withContext(function($ctx) { var $1;
 $1=_st(_st((smalltalk.ASTInterpreter || ASTInterpreter))._new())._interpret_(_st(_st(_st(self)._parse_forClass_(aString,(smalltalk.Object || Object)))._nodes())._first());
 return $1;
-},
+}, self, "interpret:", [aString], smalltalk.ASTInterpreterTest)},
 args: ["aString"],
 source: "interpret: aString\x0a\x09\x22the food is a methodNode. Interpret the sequenceNode only\x22\x0a    ^ ASTInterpreter new\x0a    \x09interpret: (self parse: aString forClass: Object) \x0a        \x09nodes first",
 messageSends: ["interpret:", "first", "nodes", "parse:forClass:", "new"],
 referencedClasses: ["Object", "ASTInterpreter"]
 }),
-smalltalk.ASTInterpretorTest);
+smalltalk.ASTInterpreterTest);
 
 smalltalk.addMethod(
 "_parse_",
@@ -279,16 +318,16 @@ selector: "parse:",
 category: 'accessing',
 fn: function (aString){
 var self=this;
-var $1;
+return smalltalk.withContext(function($ctx) { var $1;
 $1=_st(_st((smalltalk.Smalltalk || Smalltalk))._current())._parse_(aString);
 return $1;
-},
+}, self, "parse:", [aString], smalltalk.ASTInterpreterTest)},
 args: ["aString"],
 source: "parse: aString\x0a\x09^ Smalltalk current parse: aString",
 messageSends: ["parse:", "current"],
 referencedClasses: ["Smalltalk"]
 }),
-smalltalk.ASTInterpretorTest);
+smalltalk.ASTInterpreterTest);
 
 smalltalk.addMethod(
 "_parse_forClass_",
@@ -297,16 +336,16 @@ selector: "parse:forClass:",
 category: 'accessing',
 fn: function (aString,aClass){
 var self=this;
-var $1;
+return smalltalk.withContext(function($ctx) { var $1;
 $1=_st(self)._analyze_forClass_(_st(self)._parse_(aString),aClass);
 return $1;
-},
+}, self, "parse:forClass:", [aString,aClass], smalltalk.ASTInterpreterTest)},
 args: ["aString", "aClass"],
 source: "parse: aString forClass: aClass\x0a\x09^ self analyze: (self parse: aString) forClass: aClass",
 messageSends: ["analyze:forClass:", "parse:"],
 referencedClasses: []
 }),
-smalltalk.ASTInterpretorTest);
+smalltalk.ASTInterpreterTest);
 
 smalltalk.addMethod(
 "_testBinarySend",
@@ -315,14 +354,14 @@ selector: "testBinarySend",
 category: 'tests',
 fn: function (){
 var self=this;
-_st(self)._assert_equals_(_st(self)._interpret_("foo 2+3+4"),(9));
-return self},
+return smalltalk.withContext(function($ctx) { _st(self)._assert_equals_(_st(self)._interpret_("foo 2+3+4"),(9));
+return self}, self, "testBinarySend", [], smalltalk.ASTInterpreterTest)},
 args: [],
 source: "testBinarySend\x0a\x09self assert: (self interpret: 'foo 2+3+4') equals: 9",
 messageSends: ["assert:equals:", "interpret:"],
 referencedClasses: []
 }),
-smalltalk.ASTInterpretorTest);
+smalltalk.ASTInterpreterTest);
 
 smalltalk.addMethod(
 "_testBlockLiteral",
@@ -331,14 +370,16 @@ selector: "testBlockLiteral",
 category: 'tests',
 fn: function (){
 var self=this;
-_st(self)._assert_(false);
-return self},
+return smalltalk.withContext(function($ctx) { _st(self)._assert_equals_(_st(self)._interpret_("foo ^ true ifTrue: [ 1 ] ifFalse: [ 2 ]"),(1));
+_st(self)._assert_equals_(_st(self)._interpret_("foo true ifTrue: [ ^ 1 ] ifFalse: [ 2 ]"),(1));
+_st(self)._assert_equals_(_st(self)._interpret_("foo ^ false ifTrue: [ 1 ] ifFalse: [ 2 ]"),(2));
+return self}, self, "testBlockLiteral", [], smalltalk.ASTInterpreterTest)},
 args: [],
-source: "testBlockLiteral\x0a\x09self assert: false",
-messageSends: ["assert:"],
+source: "testBlockLiteral\x0a\x09self assert: (self interpret: 'foo ^ true ifTrue: [ 1 ] ifFalse: [ 2 ]') equals: 1.\x0a    self assert: (self interpret: 'foo true ifTrue: [ ^ 1 ] ifFalse: [ 2 ]') equals: 1.\x0a    self assert: (self interpret: 'foo ^ false ifTrue: [ 1 ] ifFalse: [ 2 ]') equals: 2",
+messageSends: ["assert:equals:", "interpret:"],
 referencedClasses: []
 }),
-smalltalk.ASTInterpretorTest);
+smalltalk.ASTInterpreterTest);
 
 
 

文件差异内容过多而无法显示
+ 334 - 327
js/Compiler-Semantic.deploy.js


文件差异内容过多而无法显示
+ 334 - 327
js/Compiler-Semantic.js


+ 85 - 161
js/Compiler-Tests.deploy.js

@@ -1,80 +1,4 @@
 smalltalk.addPackage('Compiler-Tests', {});
-smalltalk.addClass('ASTInterpretorTest', smalltalk.TestCase, [], 'Compiler-Interpreter');
-smalltalk.addMethod(
-"_analyze_forClass_",
-smalltalk.method({
-selector: "analyze:forClass:",
-fn: function (aNode,aClass){
-var self=this;
-_st(_st((smalltalk.SemanticAnalyzer || SemanticAnalyzer))._on_(aClass))._visit_(aNode);
-return aNode;
-}
-}),
-smalltalk.ASTInterpretorTest);
-
-smalltalk.addMethod(
-"_interpret_",
-smalltalk.method({
-selector: "interpret:",
-fn: function (aString){
-var self=this;
-var $1;
-$1=_st(_st((smalltalk.ASTInterpreter || ASTInterpreter))._new())._interpret_(_st(_st(_st(self)._parse_forClass_(aString,(smalltalk.Object || Object)))._nodes())._first());
-return $1;
-}
-}),
-smalltalk.ASTInterpretorTest);
-
-smalltalk.addMethod(
-"_parse_",
-smalltalk.method({
-selector: "parse:",
-fn: function (aString){
-var self=this;
-var $1;
-$1=_st(_st((smalltalk.Smalltalk || Smalltalk))._current())._parse_(aString);
-return $1;
-}
-}),
-smalltalk.ASTInterpretorTest);
-
-smalltalk.addMethod(
-"_parse_forClass_",
-smalltalk.method({
-selector: "parse:forClass:",
-fn: function (aString,aClass){
-var self=this;
-var $1;
-$1=_st(self)._analyze_forClass_(_st(self)._parse_(aString),aClass);
-return $1;
-}
-}),
-smalltalk.ASTInterpretorTest);
-
-smalltalk.addMethod(
-"_testBinarySend",
-smalltalk.method({
-selector: "testBinarySend",
-fn: function (){
-var self=this;
-_st(self)._assert_equals_(_st(self)._interpret_("foo 2+3+4"),(9));
-return self}
-}),
-smalltalk.ASTInterpretorTest);
-
-smalltalk.addMethod(
-"_testBlockLiteral",
-smalltalk.method({
-selector: "testBlockLiteral",
-fn: function (){
-var self=this;
-_st(self)._assert_(false);
-return self}
-}),
-smalltalk.ASTInterpretorTest);
-
-
-
 smalltalk.addClass('CodeGeneratorTest', smalltalk.TestCase, ['receiver'], 'Compiler-Tests');
 smalltalk.addMethod(
 "_codeGeneratorClass",
@@ -82,8 +6,8 @@ smalltalk.method({
 selector: "codeGeneratorClass",
 fn: function (){
 var self=this;
-return (smalltalk.CodeGenerator || CodeGenerator);
-}
+return smalltalk.withContext(function($ctx) { return (smalltalk.CodeGenerator || CodeGenerator);
+}, self, "codeGeneratorClass", [], smalltalk.CodeGeneratorTest)}
 }),
 smalltalk.CodeGeneratorTest);
 
@@ -93,13 +17,13 @@ smalltalk.method({
 selector: "compiler",
 fn: function (){
 var self=this;
-var $2,$3,$1;
+return smalltalk.withContext(function($ctx) { var $2,$3,$1;
 $2=_st((smalltalk.Compiler || Compiler))._new();
 _st($2)._codeGeneratorClass_(_st(self)._codeGeneratorClass());
 $3=_st($2)._yourself();
 $1=$3;
 return $1;
-}
+}, self, "compiler", [], smalltalk.CodeGeneratorTest)}
 }),
 smalltalk.CodeGeneratorTest);
 
@@ -109,8 +33,8 @@ smalltalk.method({
 selector: "setUp",
 fn: function (){
 var self=this;
-self["@receiver"]=_st(_st(self)._targetClass())._new();
-return self}
+return smalltalk.withContext(function($ctx) { self["@receiver"]=_st(_st(self)._targetClass())._new();
+return self}, self, "setUp", [], smalltalk.CodeGeneratorTest)}
 }),
 smalltalk.CodeGeneratorTest);
 
@@ -120,13 +44,13 @@ smalltalk.method({
 selector: "should:return:",
 fn: function (aString,anObject){
 var self=this;
-var method;
+return smalltalk.withContext(function($ctx) { var method;
 var result;
 method=_st(_st(self)._compiler())._install_forClass_category_(aString,_st(self)._targetClass(),"tests");
 result=_st(self["@receiver"])._perform_(_st(method)._selector());
 _st(_st(self)._targetClass())._removeCompiledMethod_(method);
 _st(self)._assert_equals_(anObject,result);
-return self}
+return self}, self, "should:return:", [aString,anObject], smalltalk.CodeGeneratorTest)}
 }),
 smalltalk.CodeGeneratorTest);
 
@@ -136,8 +60,8 @@ smalltalk.method({
 selector: "targetClass",
 fn: function (){
 var self=this;
-return (smalltalk.DoIt || DoIt);
-}
+return smalltalk.withContext(function($ctx) { return (smalltalk.DoIt || DoIt);
+}, self, "targetClass", [], smalltalk.CodeGeneratorTest)}
 }),
 smalltalk.CodeGeneratorTest);
 
@@ -147,7 +71,7 @@ smalltalk.method({
 selector: "tearDown",
 fn: function (){
 var self=this;
-return self}
+return smalltalk.withContext(function($ctx) { return self}, self, "tearDown", [], smalltalk.CodeGeneratorTest)}
 }),
 smalltalk.CodeGeneratorTest);
 
@@ -157,10 +81,10 @@ smalltalk.method({
 selector: "testAssignment",
 fn: function (){
 var self=this;
-_st(self)._should_return_("foo | a | a := true ifTrue: [ 1 ]. ^ a",(1));
+return smalltalk.withContext(function($ctx) { _st(self)._should_return_("foo | a | a := true ifTrue: [ 1 ]. ^ a",(1));
 _st(self)._should_return_("foo | a | a := false ifTrue: [ 1 ]. ^ a",nil);
 _st(self)._should_return_("foo | a | ^ a := true ifTrue: [ 1 ]",(1));
-return self}
+return self}, self, "testAssignment", [], smalltalk.CodeGeneratorTest)}
 }),
 smalltalk.CodeGeneratorTest);
 
@@ -170,10 +94,10 @@ smalltalk.method({
 selector: "testBlockReturn",
 fn: function (){
 var self=this;
-_st(self)._should_return_("foo ^ #(1 2 3) collect: [ :each | true ifTrue: [ each + 1 ] ]",[(2), (3), (4)]);
+return smalltalk.withContext(function($ctx) { _st(self)._should_return_("foo ^ #(1 2 3) collect: [ :each | true ifTrue: [ each + 1 ] ]",[(2), (3), (4)]);
 _st(self)._should_return_("foo ^ #(1 2 3) collect: [ :each | false ifFalse: [ each + 1 ] ]",[(2), (3), (4)]);
 _st(self)._should_return_("foo ^ #(1 2 3) collect: [ :each | each odd ifTrue: [ each + 1 ] ifFalse: [ each - 1 ] ]",[(2), (1), (4)]);
-return self}
+return self}, self, "testBlockReturn", [], smalltalk.CodeGeneratorTest)}
 }),
 smalltalk.CodeGeneratorTest);
 
@@ -183,8 +107,8 @@ smalltalk.method({
 selector: "testCascades",
 fn: function (){
 var self=this;
-_st(self)._should_return_("foo ^ Array new add: 3; add: 4; yourself",[(3), (4)]);
-return self}
+return smalltalk.withContext(function($ctx) { _st(self)._should_return_("foo ^ Array new add: 3; add: 4; yourself",[(3), (4)]);
+return self}, self, "testCascades", [], smalltalk.CodeGeneratorTest)}
 }),
 smalltalk.CodeGeneratorTest);
 
@@ -194,7 +118,7 @@ smalltalk.method({
 selector: "testLiterals",
 fn: function (){
 var self=this;
-_st(self)._should_return_("foo ^ 1",(1));
+return smalltalk.withContext(function($ctx) { _st(self)._should_return_("foo ^ 1",(1));
 _st(self)._should_return_("foo ^ 'hello'","hello");
 _st(self)._should_return_("foo ^ #(1 2 3 4)",[(1), (2), (3), (4)]);
 _st(self)._should_return_("foo ^ {1. [:x | x ] value: 2. 3. [4] value}",[(1), (2), (3), (4)]);
@@ -203,7 +127,7 @@ _st(self)._should_return_("foo ^ false",false);
 _st(self)._should_return_("foo ^ #{1->2. 3->4}",smalltalk.HashedCollection._fromPairs_([_st((1)).__minus_gt((2)),_st((3)).__minus_gt((4))]));
 _st(self)._should_return_("foo ^ #hello",smalltalk.symbolFor("hello"));
 _st(self)._should_return_("foo ^ -123.456",(-123.456));
-return self}
+return self}, self, "testLiterals", [], smalltalk.CodeGeneratorTest)}
 }),
 smalltalk.CodeGeneratorTest);
 
@@ -213,12 +137,12 @@ smalltalk.method({
 selector: "testLocalReturn",
 fn: function (){
 var self=this;
-_st(self)._should_return_("foo ^ 1",(1));
+return smalltalk.withContext(function($ctx) { _st(self)._should_return_("foo ^ 1",(1));
 _st(self)._should_return_("foo ^ 1 + 1",(2));
 _st(self)._should_return_("foo ",self["@receiver"]);
 _st(self)._should_return_("foo self asString",self["@receiver"]);
 _st(self)._should_return_("foo | a b | a := 1. b := 2. ^ a + b",(3));
-return self}
+return self}, self, "testLocalReturn", [], smalltalk.CodeGeneratorTest)}
 }),
 smalltalk.CodeGeneratorTest);
 
@@ -228,12 +152,12 @@ smalltalk.method({
 selector: "testMessageSends",
 fn: function (){
 var self=this;
-_st(self)._should_return_("foo ^ 1 asString","1");
+return smalltalk.withContext(function($ctx) { _st(self)._should_return_("foo ^ 1 asString","1");
 _st(self)._should_return_("foo ^ 1 + 1",(2));
 _st(self)._should_return_("foo ^ 1 + 2 * 3",(9));
 _st(self)._should_return_("foo ^ 1 to: 3",[(1), (2), (3)]);
 _st(self)._should_return_("foo ^ 1 to: 5 by: 2",[(1), (3), (5)]);
-return self}
+return self}, self, "testMessageSends", [], smalltalk.CodeGeneratorTest)}
 }),
 smalltalk.CodeGeneratorTest);
 
@@ -243,11 +167,11 @@ smalltalk.method({
 selector: "testNestedIfTrue",
 fn: function (){
 var self=this;
-_st(self)._should_return_("foo ^ true ifTrue: [ false ifFalse: [ 1 ] ]",(1));
+return smalltalk.withContext(function($ctx) { _st(self)._should_return_("foo ^ true ifTrue: [ false ifFalse: [ 1 ] ]",(1));
 _st(self)._should_return_("foo ^ true ifTrue: [ false ifTrue: [ 1 ] ]",nil);
 _st(self)._should_return_("foo true ifTrue: [ false ifFalse: [ ^ 1 ] ]",(1));
 _st(self)._should_return_("foo true ifTrue: [ false ifTrue: [ ^ 1 ] ]",self["@receiver"]);
-return self}
+return self}, self, "testNestedIfTrue", [], smalltalk.CodeGeneratorTest)}
 }),
 smalltalk.CodeGeneratorTest);
 
@@ -257,11 +181,11 @@ smalltalk.method({
 selector: "testNonLocalReturn",
 fn: function (){
 var self=this;
-_st(self)._should_return_("foo [ ^ 1 ] value",(1));
+return smalltalk.withContext(function($ctx) { _st(self)._should_return_("foo [ ^ 1 ] value",(1));
 _st(self)._should_return_("foo [ ^ 1 + 1 ] value",(2));
 _st(self)._should_return_("foo | a b | a := 1. b := 2. [ ^ a + b ] value. self halt",(3));
 _st(self)._should_return_("foo [ :x | ^ x + x ] value: 4. ^ 2",(8));
-return self}
+return self}, self, "testNonLocalReturn", [], smalltalk.CodeGeneratorTest)}
 }),
 smalltalk.CodeGeneratorTest);
 
@@ -271,11 +195,11 @@ smalltalk.method({
 selector: "testifFalse",
 fn: function (){
 var self=this;
-_st(self)._should_return_("foo true ifFalse: [ ^ 1 ]",self["@receiver"]);
+return smalltalk.withContext(function($ctx) { _st(self)._should_return_("foo true ifFalse: [ ^ 1 ]",self["@receiver"]);
 _st(self)._should_return_("foo false ifFalse: [ ^ 2 ]",(2));
 _st(self)._should_return_("foo ^ true ifFalse: [ 1 ]",nil);
 _st(self)._should_return_("foo ^ false ifFalse: [ 2 ]",(2));
-return self}
+return self}, self, "testifFalse", [], smalltalk.CodeGeneratorTest)}
 }),
 smalltalk.CodeGeneratorTest);
 
@@ -285,11 +209,11 @@ smalltalk.method({
 selector: "testifFalseIfTrue",
 fn: function (){
 var self=this;
-_st(self)._should_return_("foo true ifFalse: [ ^ 1 ] ifTrue: [ ^ 2 ]",(2));
+return smalltalk.withContext(function($ctx) { _st(self)._should_return_("foo true ifFalse: [ ^ 1 ] ifTrue: [ ^ 2 ]",(2));
 _st(self)._should_return_("foo false ifFalse: [ ^ 2 ] ifTrue: [ ^1 ]",(2));
 _st(self)._should_return_("foo ^ true ifFalse: [ 1 ] ifTrue: [ 2 ]",(2));
 _st(self)._should_return_("foo ^ false ifFalse: [ 2 ] ifTrue: [ 1 ]",(2));
-return self}
+return self}, self, "testifFalseIfTrue", [], smalltalk.CodeGeneratorTest)}
 }),
 smalltalk.CodeGeneratorTest);
 
@@ -299,11 +223,11 @@ smalltalk.method({
 selector: "testifNil",
 fn: function (){
 var self=this;
-_st(self)._should_return_("foo ^ 1 ifNil: [ 2 ]",(1));
+return smalltalk.withContext(function($ctx) { _st(self)._should_return_("foo ^ 1 ifNil: [ 2 ]",(1));
 _st(self)._should_return_("foo ^ nil ifNil: [ 2 ]",(2));
 _st(self)._should_return_("foo 1 ifNil: [ ^ 2 ]",self["@receiver"]);
 _st(self)._should_return_("foo nil ifNil: [ ^ 2 ]",(2));
-return self}
+return self}, self, "testifNil", [], smalltalk.CodeGeneratorTest)}
 }),
 smalltalk.CodeGeneratorTest);
 
@@ -313,11 +237,11 @@ smalltalk.method({
 selector: "testifNilIfNotNil",
 fn: function (){
 var self=this;
-_st(self)._should_return_("foo ^ 1 ifNil: [ 2 ] ifNotNil: [ 3 ]",(3));
+return smalltalk.withContext(function($ctx) { _st(self)._should_return_("foo ^ 1 ifNil: [ 2 ] ifNotNil: [ 3 ]",(3));
 _st(self)._should_return_("foo ^ nil ifNil: [ 2 ] ifNotNil: [ 3 ]",(2));
 _st(self)._should_return_("foo 1 ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(3));
 _st(self)._should_return_("foo nil ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(2));
-return self}
+return self}, self, "testifNilIfNotNil", [], smalltalk.CodeGeneratorTest)}
 }),
 smalltalk.CodeGeneratorTest);
 
@@ -327,11 +251,11 @@ smalltalk.method({
 selector: "testifNotNil",
 fn: function (){
 var self=this;
-_st(self)._should_return_("foo ^ 1 ifNotNil: [ 2 ]",(2));
+return smalltalk.withContext(function($ctx) { _st(self)._should_return_("foo ^ 1 ifNotNil: [ 2 ]",(2));
 _st(self)._should_return_("foo ^ nil ifNotNil: [ 2 ]",nil);
 _st(self)._should_return_("foo 1 ifNotNil: [ ^ 2 ]",(2));
 _st(self)._should_return_("foo nil ifNotNil: [ ^ 2 ]",self["@receiver"]);
-return self}
+return self}, self, "testifNotNil", [], smalltalk.CodeGeneratorTest)}
 }),
 smalltalk.CodeGeneratorTest);
 
@@ -341,11 +265,11 @@ smalltalk.method({
 selector: "testifTrue",
 fn: function (){
 var self=this;
-_st(self)._should_return_("foo false ifTrue: [ ^ 1 ]",self["@receiver"]);
+return smalltalk.withContext(function($ctx) { _st(self)._should_return_("foo false ifTrue: [ ^ 1 ]",self["@receiver"]);
 _st(self)._should_return_("foo true ifTrue: [ ^ 2 ]",(2));
 _st(self)._should_return_("foo ^ false ifTrue: [ 1 ]",nil);
 _st(self)._should_return_("foo ^ true ifTrue: [ 2 ]",(2));
-return self}
+return self}, self, "testifTrue", [], smalltalk.CodeGeneratorTest)}
 }),
 smalltalk.CodeGeneratorTest);
 
@@ -355,11 +279,11 @@ smalltalk.method({
 selector: "testifTrueIfFalse",
 fn: function (){
 var self=this;
-_st(self)._should_return_("foo false ifTrue: [ ^ 1 ] ifFalse: [ ^2 ]",(2));
+return smalltalk.withContext(function($ctx) { _st(self)._should_return_("foo false ifTrue: [ ^ 1 ] ifFalse: [ ^2 ]",(2));
 _st(self)._should_return_("foo true ifTrue: [ ^ 1 ] ifFalse: [ ^ 2 ]",(1));
 _st(self)._should_return_("foo ^ false ifTrue: [ 2 ] ifFalse: [ 1 ]",(1));
 _st(self)._should_return_("foo ^ true ifTrue: [ 2 ] ifFalse: [ 1 ]",(2));
-return self}
+return self}, self, "testifTrueIfFalse", [], smalltalk.CodeGeneratorTest)}
 }),
 smalltalk.CodeGeneratorTest);
 
@@ -372,8 +296,8 @@ smalltalk.method({
 selector: "codeGeneratorClass",
 fn: function (){
 var self=this;
-return (smalltalk.InliningCodeGenerator || InliningCodeGenerator);
-}
+return smalltalk.withContext(function($ctx) { return (smalltalk.InliningCodeGenerator || InliningCodeGenerator);
+}, self, "codeGeneratorClass", [], smalltalk.InliningCodeGeneratorTest)}
 }),
 smalltalk.InliningCodeGeneratorTest);
 
@@ -386,7 +310,7 @@ smalltalk.method({
 selector: "testClassRefVar",
 fn: function (){
 var self=this;
-var $1,$2;
+return smalltalk.withContext(function($ctx) { var $1,$2;
 var node;
 $1=_st((smalltalk.ClassReferenceNode || ClassReferenceNode))._new();
 _st($1)._value_("Object");
@@ -394,7 +318,7 @@ $2=_st($1)._yourself();
 node=$2;
 _st(_st((smalltalk.SemanticAnalyzer || SemanticAnalyzer))._new())._visit_(node);
 _st(self)._assert_(_st(_st(node)._binding())._isClassRefVar());
-return self}
+return self}, self, "testClassRefVar", [], smalltalk.ScopeVarTest)}
 }),
 smalltalk.ScopeVarTest);
 
@@ -404,7 +328,7 @@ smalltalk.method({
 selector: "testInstanceVar",
 fn: function (){
 var self=this;
-var $1,$2;
+return smalltalk.withContext(function($ctx) { var $1,$2;
 var node;
 var scope;
 $1=_st((smalltalk.VariableNode || VariableNode))._new();
@@ -414,7 +338,7 @@ node=$2;
 scope=_st((smalltalk.MethodLexicalScope || MethodLexicalScope))._new();
 _st(scope)._addIVar_("bzzz");
 _st(self)._assert_(_st(_st(scope)._bindingFor_(node))._isInstanceVar());
-return self}
+return self}, self, "testInstanceVar", [], smalltalk.ScopeVarTest)}
 }),
 smalltalk.ScopeVarTest);
 
@@ -424,7 +348,7 @@ smalltalk.method({
 selector: "testPseudoVar",
 fn: function (){
 var self=this;
-var $1,$2;
+return smalltalk.withContext(function($ctx) { var $1,$2;
 var node;
 var pseudoVars;
 pseudoVars=["self", "super", "true", "false", "nil"];
@@ -436,7 +360,7 @@ node=$2;
 node;
 return _st(self)._assert_(_st(_st(_st((smalltalk.MethodLexicalScope || MethodLexicalScope))._new())._bindingFor_(node))._isPseudoVar());
 }));
-return self}
+return self}, self, "testPseudoVar", [], smalltalk.ScopeVarTest)}
 }),
 smalltalk.ScopeVarTest);
 
@@ -446,7 +370,7 @@ smalltalk.method({
 selector: "testTempVar",
 fn: function (){
 var self=this;
-var $1,$2;
+return smalltalk.withContext(function($ctx) { var $1,$2;
 var node;
 var scope;
 $1=_st((smalltalk.VariableNode || VariableNode))._new();
@@ -456,7 +380,7 @@ node=$2;
 scope=_st((smalltalk.MethodLexicalScope || MethodLexicalScope))._new();
 _st(scope)._addTemp_("bzzz");
 _st(self)._assert_(_st(_st(scope)._bindingFor_(node))._isTempVar());
-return self}
+return self}, self, "testTempVar", [], smalltalk.ScopeVarTest)}
 }),
 smalltalk.ScopeVarTest);
 
@@ -466,14 +390,14 @@ smalltalk.method({
 selector: "testUnknownVar",
 fn: function (){
 var self=this;
-var $1,$2;
+return smalltalk.withContext(function($ctx) { var $1,$2;
 var node;
 $1=_st((smalltalk.VariableNode || VariableNode))._new();
 _st($1)._value_("bzzz");
 $2=_st($1)._yourself();
 node=$2;
 _st(self)._assert_(_st(_st(_st((smalltalk.MethodLexicalScope || MethodLexicalScope))._new())._bindingFor_(node))._isNil());
-return self}
+return self}, self, "testUnknownVar", [], smalltalk.ScopeVarTest)}
 }),
 smalltalk.ScopeVarTest);
 
@@ -486,8 +410,8 @@ smalltalk.method({
 selector: "setUp",
 fn: function (){
 var self=this;
-self["@analyzer"]=_st((smalltalk.SemanticAnalyzer || SemanticAnalyzer))._on_((smalltalk.Object || Object));
-return self}
+return smalltalk.withContext(function($ctx) { self["@analyzer"]=_st((smalltalk.SemanticAnalyzer || SemanticAnalyzer))._on_((smalltalk.Object || Object));
+return self}, self, "setUp", [], smalltalk.SemanticAnalyzerTest)}
 }),
 smalltalk.SemanticAnalyzerTest);
 
@@ -497,14 +421,14 @@ smalltalk.method({
 selector: "testAssignment",
 fn: function (){
 var self=this;
-var src;
+return smalltalk.withContext(function($ctx) { var src;
 var ast;
 src="foo self := 1";
 ast=_st(smalltalk)._parse_(src);
 _st(self)._should_raise_((function(){
 return _st(self["@analyzer"])._visit_(ast);
 }),(smalltalk.InvalidAssignmentError || InvalidAssignmentError));
-return self}
+return self}, self, "testAssignment", [], smalltalk.SemanticAnalyzerTest)}
 }),
 smalltalk.SemanticAnalyzerTest);
 
@@ -514,13 +438,13 @@ smalltalk.method({
 selector: "testNonLocalReturn",
 fn: function (){
 var self=this;
-var src;
+return smalltalk.withContext(function($ctx) { var src;
 var ast;
 src="foo | a | a + 1. ^ a";
 ast=_st(smalltalk)._parse_(src);
 _st(self["@analyzer"])._visit_(ast);
 _st(self)._deny_(_st(_st(ast)._scope())._hasNonLocalReturn());
-return self}
+return self}, self, "testNonLocalReturn", [], smalltalk.SemanticAnalyzerTest)}
 }),
 smalltalk.SemanticAnalyzerTest);
 
@@ -530,13 +454,13 @@ smalltalk.method({
 selector: "testNonLocalReturn2",
 fn: function (){
 var self=this;
-var src;
+return smalltalk.withContext(function($ctx) { var src;
 var ast;
 src="foo | a | a + 1. [ [ ^ a] ]";
 ast=_st(smalltalk)._parse_(src);
 _st(self["@analyzer"])._visit_(ast);
 _st(self)._assert_(_st(_st(ast)._scope())._hasNonLocalReturn());
-return self}
+return self}, self, "testNonLocalReturn2", [], smalltalk.SemanticAnalyzerTest)}
 }),
 smalltalk.SemanticAnalyzerTest);
 
@@ -546,13 +470,13 @@ smalltalk.method({
 selector: "testScope",
 fn: function (){
 var self=this;
-var src;
+return smalltalk.withContext(function($ctx) { var src;
 var ast;
 src="foo | a | a + 1. [ | b | b := a ]";
 ast=_st(smalltalk)._parse_(src);
 _st(self["@analyzer"])._visit_(ast);
 _st(self)._deny_(_st(_st(_st(_st(_st(_st(ast)._nodes())._first())._nodes())._last())._scope()).__eq_eq(_st(ast)._scope()));
-return self}
+return self}, self, "testScope", [], smalltalk.SemanticAnalyzerTest)}
 }),
 smalltalk.SemanticAnalyzerTest);
 
@@ -562,13 +486,13 @@ smalltalk.method({
 selector: "testScope2",
 fn: function (){
 var self=this;
-var src;
+return smalltalk.withContext(function($ctx) { var src;
 var ast;
 src="foo | a | a + 1. [ [ | b | b := a ] ]";
 ast=_st(smalltalk)._parse_(src);
 _st(self["@analyzer"])._visit_(ast);
 _st(self)._deny_(_st(_st(_st(_st(_st(_st(_st(_st(_st(_st(ast)._nodes())._first())._nodes())._last())._nodes())._first())._nodes())._first())._scope()).__eq_eq(_st(ast)._scope()));
-return self}
+return self}, self, "testScope2", [], smalltalk.SemanticAnalyzerTest)}
 }),
 smalltalk.SemanticAnalyzerTest);
 
@@ -578,14 +502,14 @@ smalltalk.method({
 selector: "testScopeLevel",
 fn: function (){
 var self=this;
-var src;
+return smalltalk.withContext(function($ctx) { var src;
 var ast;
 src="foo | a | a + 1. [ [ | b | b := a ] ]";
 ast=_st(smalltalk)._parse_(src);
 _st(self["@analyzer"])._visit_(ast);
 _st(self)._assert_(_st(_st(_st(ast)._scope())._scopeLevel()).__eq((1)));
 _st(self)._assert_(_st(_st(_st(_st(_st(_st(_st(_st(_st(_st(_st(ast)._nodes())._first())._nodes())._last())._nodes())._first())._nodes())._first())._scope())._scopeLevel()).__eq((3)));
-return self}
+return self}, self, "testScopeLevel", [], smalltalk.SemanticAnalyzerTest)}
 }),
 smalltalk.SemanticAnalyzerTest);
 
@@ -595,14 +519,14 @@ smalltalk.method({
 selector: "testUnknownVariables",
 fn: function (){
 var self=this;
-var src;
+return smalltalk.withContext(function($ctx) { var src;
 var ast;
 src="foo | a | b + a";
 ast=_st(smalltalk)._parse_(src);
 _st(self)._should_raise_((function(){
 return _st(self["@analyzer"])._visit_(ast);
 }),(smalltalk.UnknownVariableError || UnknownVariableError));
-return self}
+return self}, self, "testUnknownVariables", [], smalltalk.SemanticAnalyzerTest)}
 }),
 smalltalk.SemanticAnalyzerTest);
 
@@ -612,12 +536,12 @@ smalltalk.method({
 selector: "testUnknownVariablesDefinedInJS",
 fn: function (){
 var self=this;
- var someVariable = 1 ;
+return smalltalk.withContext(function($ctx) {  var someVariable = 1 ;
 ;
 _st(self)._shouldnt_raise_((function(){
 return _st(smalltalk)._parse_("foo someVariable");
 }),(smalltalk.UnknownVariableError || UnknownVariableError));
-return self}
+return self}, self, "testUnknownVariablesDefinedInJS", [], smalltalk.SemanticAnalyzerTest)}
 }),
 smalltalk.SemanticAnalyzerTest);
 
@@ -627,14 +551,14 @@ smalltalk.method({
 selector: "testUnknownVariablesWithScope",
 fn: function (){
 var self=this;
-var src;
+return smalltalk.withContext(function($ctx) { var src;
 var ast;
 src="foo | a b | [ c + 1. [ a + 1. d + 1 ]]";
 ast=_st(smalltalk)._parse_(src);
 _st(self)._should_raise_((function(){
 return _st(self["@analyzer"])._visit_(ast);
 }),(smalltalk.UnknownVariableError || UnknownVariableError));
-return self}
+return self}, self, "testUnknownVariablesWithScope", [], smalltalk.SemanticAnalyzerTest)}
 }),
 smalltalk.SemanticAnalyzerTest);
 
@@ -644,12 +568,12 @@ smalltalk.method({
 selector: "testVariableShadowing",
 fn: function (){
 var self=this;
-var src;
+return smalltalk.withContext(function($ctx) { var src;
 var ast;
 src="foo | a | a + 1";
 ast=_st(smalltalk)._parse_(src);
 _st(self["@analyzer"])._visit_(ast);
-return self}
+return self}, self, "testVariableShadowing", [], smalltalk.SemanticAnalyzerTest)}
 }),
 smalltalk.SemanticAnalyzerTest);
 
@@ -659,14 +583,14 @@ smalltalk.method({
 selector: "testVariableShadowing2",
 fn: function (){
 var self=this;
-var src;
+return smalltalk.withContext(function($ctx) { var src;
 var ast;
 src="foo | a | a + 1. [ | a | a := 2 ]";
 ast=_st(smalltalk)._parse_(src);
 _st(self)._should_raise_((function(){
 return _st(self["@analyzer"])._visit_(ast);
 }),(smalltalk.ShadowingVariableError || ShadowingVariableError));
-return self}
+return self}, self, "testVariableShadowing2", [], smalltalk.SemanticAnalyzerTest)}
 }),
 smalltalk.SemanticAnalyzerTest);
 
@@ -676,12 +600,12 @@ smalltalk.method({
 selector: "testVariableShadowing3",
 fn: function (){
 var self=this;
-var src;
+return smalltalk.withContext(function($ctx) { var src;
 var ast;
 src="foo | a | a + 1. [ | b | b := 2 ]";
 ast=_st(smalltalk)._parse_(src);
 _st(self["@analyzer"])._visit_(ast);
-return self}
+return self}, self, "testVariableShadowing3", [], smalltalk.SemanticAnalyzerTest)}
 }),
 smalltalk.SemanticAnalyzerTest);
 
@@ -691,12 +615,12 @@ smalltalk.method({
 selector: "testVariableShadowing4",
 fn: function (){
 var self=this;
-var src;
+return smalltalk.withContext(function($ctx) { var src;
 var ast;
 src="foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]";
 ast=_st(smalltalk)._parse_(src);
 _st(self["@analyzer"])._visit_(ast);
-return self}
+return self}, self, "testVariableShadowing4", [], smalltalk.SemanticAnalyzerTest)}
 }),
 smalltalk.SemanticAnalyzerTest);
 
@@ -706,14 +630,14 @@ smalltalk.method({
 selector: "testVariableShadowing5",
 fn: function (){
 var self=this;
-var src;
+return smalltalk.withContext(function($ctx) { var src;
 var ast;
 src="foo | a | a + 1. [ [ [ | a | a := 2 ] ] ]";
 ast=_st(smalltalk)._parse_(src);
 _st(self)._should_raise_((function(){
 return _st(self["@analyzer"])._visit_(ast);
 }),(smalltalk.ShadowingVariableError || ShadowingVariableError));
-return self}
+return self}, self, "testVariableShadowing5", [], smalltalk.SemanticAnalyzerTest)}
 }),
 smalltalk.SemanticAnalyzerTest);
 
@@ -723,7 +647,7 @@ smalltalk.method({
 selector: "testVariablesLookup",
 fn: function (){
 var self=this;
-var src;
+return smalltalk.withContext(function($ctx) { var src;
 var ast;
 src="foo | a | a + 1. [ | b | b := a ]";
 ast=_st(smalltalk)._parse_(src);
@@ -732,7 +656,7 @@ _st(self)._assert_(_st(_st(_st(_st(_st(_st(_st(ast)._nodes())._first())._nodes()
 _st(self)._assert_(_st(_st(_st(_st(_st(_st(_st(_st(ast)._nodes())._first())._nodes())._first())._receiver())._binding())._scope()).__eq_eq(_st(ast)._scope()));
 _st(self)._assert_(_st(_st(_st(_st(_st(_st(_st(_st(_st(_st(_st(ast)._nodes())._first())._nodes())._last())._nodes())._first())._nodes())._first())._left())._binding())._isTempVar());
 _st(self)._assert_(_st(_st(_st(_st(_st(_st(_st(_st(_st(_st(_st(_st(ast)._nodes())._first())._nodes())._last())._nodes())._first())._nodes())._first())._left())._binding())._scope()).__eq_eq(_st(_st(_st(_st(_st(ast)._nodes())._first())._nodes())._last())._scope()));
-return self}
+return self}, self, "testVariablesLookup", [], smalltalk.SemanticAnalyzerTest)}
 }),
 smalltalk.SemanticAnalyzerTest);
 

+ 85 - 191
js/Compiler-Tests.js

@@ -1,110 +1,4 @@
 smalltalk.addPackage('Compiler-Tests', {});
-smalltalk.addClass('ASTInterpretorTest', smalltalk.TestCase, [], 'Compiler-Interpreter');
-smalltalk.addMethod(
-"_analyze_forClass_",
-smalltalk.method({
-selector: "analyze:forClass:",
-category: 'accessing',
-fn: function (aNode,aClass){
-var self=this;
-_st(_st((smalltalk.SemanticAnalyzer || SemanticAnalyzer))._on_(aClass))._visit_(aNode);
-return aNode;
-},
-args: ["aNode", "aClass"],
-source: "analyze: aNode forClass: aClass\x0a\x09(SemanticAnalyzer on: aClass) visit: aNode.\x0a    ^ aNode",
-messageSends: ["visit:", "on:"],
-referencedClasses: ["SemanticAnalyzer"]
-}),
-smalltalk.ASTInterpretorTest);
-
-smalltalk.addMethod(
-"_interpret_",
-smalltalk.method({
-selector: "interpret:",
-category: 'accessing',
-fn: function (aString){
-var self=this;
-var $1;
-$1=_st(_st((smalltalk.ASTInterpreter || ASTInterpreter))._new())._interpret_(_st(_st(_st(self)._parse_forClass_(aString,(smalltalk.Object || Object)))._nodes())._first());
-return $1;
-},
-args: ["aString"],
-source: "interpret: aString\x0a\x09\x22the food is a methodNode. Interpret the sequenceNode only\x22\x0a    ^ ASTInterpreter new\x0a    \x09interpret: (self parse: aString forClass: Object) \x0a        \x09nodes first",
-messageSends: ["interpret:", "first", "nodes", "parse:forClass:", "new"],
-referencedClasses: ["Object", "ASTInterpreter"]
-}),
-smalltalk.ASTInterpretorTest);
-
-smalltalk.addMethod(
-"_parse_",
-smalltalk.method({
-selector: "parse:",
-category: 'accessing',
-fn: function (aString){
-var self=this;
-var $1;
-$1=_st(_st((smalltalk.Smalltalk || Smalltalk))._current())._parse_(aString);
-return $1;
-},
-args: ["aString"],
-source: "parse: aString\x0a\x09^ Smalltalk current parse: aString",
-messageSends: ["parse:", "current"],
-referencedClasses: ["Smalltalk"]
-}),
-smalltalk.ASTInterpretorTest);
-
-smalltalk.addMethod(
-"_parse_forClass_",
-smalltalk.method({
-selector: "parse:forClass:",
-category: 'accessing',
-fn: function (aString,aClass){
-var self=this;
-var $1;
-$1=_st(self)._analyze_forClass_(_st(self)._parse_(aString),aClass);
-return $1;
-},
-args: ["aString", "aClass"],
-source: "parse: aString forClass: aClass\x0a\x09^ self analyze: (self parse: aString) forClass: aClass",
-messageSends: ["analyze:forClass:", "parse:"],
-referencedClasses: []
-}),
-smalltalk.ASTInterpretorTest);
-
-smalltalk.addMethod(
-"_testBinarySend",
-smalltalk.method({
-selector: "testBinarySend",
-category: 'tests',
-fn: function (){
-var self=this;
-_st(self)._assert_equals_(_st(self)._interpret_("foo 2+3+4"),(9));
-return self},
-args: [],
-source: "testBinarySend\x0a\x09self assert: (self interpret: 'foo 2+3+4') equals: 9",
-messageSends: ["assert:equals:", "interpret:"],
-referencedClasses: []
-}),
-smalltalk.ASTInterpretorTest);
-
-smalltalk.addMethod(
-"_testBlockLiteral",
-smalltalk.method({
-selector: "testBlockLiteral",
-category: 'tests',
-fn: function (){
-var self=this;
-_st(self)._assert_(false);
-return self},
-args: [],
-source: "testBlockLiteral\x0a\x09self assert: false",
-messageSends: ["assert:"],
-referencedClasses: []
-}),
-smalltalk.ASTInterpretorTest);
-
-
-
 smalltalk.addClass('CodeGeneratorTest', smalltalk.TestCase, ['receiver'], 'Compiler-Tests');
 smalltalk.addMethod(
 "_codeGeneratorClass",
@@ -113,8 +7,8 @@ selector: "codeGeneratorClass",
 category: 'accessing',
 fn: function (){
 var self=this;
-return (smalltalk.CodeGenerator || CodeGenerator);
-},
+return smalltalk.withContext(function($ctx) { return (smalltalk.CodeGenerator || CodeGenerator);
+}, self, "codeGeneratorClass", [], smalltalk.CodeGeneratorTest)},
 args: [],
 source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
 messageSends: [],
@@ -129,13 +23,13 @@ selector: "compiler",
 category: 'factory',
 fn: function (){
 var self=this;
-var $2,$3,$1;
+return smalltalk.withContext(function($ctx) { var $2,$3,$1;
 $2=_st((smalltalk.Compiler || Compiler))._new();
 _st($2)._codeGeneratorClass_(_st(self)._codeGeneratorClass());
 $3=_st($2)._yourself();
 $1=$3;
 return $1;
-},
+}, self, "compiler", [], smalltalk.CodeGeneratorTest)},
 args: [],
 source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
 messageSends: ["codeGeneratorClass:", "codeGeneratorClass", "new", "yourself"],
@@ -150,8 +44,8 @@ selector: "setUp",
 category: 'initialization',
 fn: function (){
 var self=this;
-self["@receiver"]=_st(_st(self)._targetClass())._new();
-return self},
+return smalltalk.withContext(function($ctx) { self["@receiver"]=_st(_st(self)._targetClass())._new();
+return self}, self, "setUp", [], smalltalk.CodeGeneratorTest)},
 args: [],
 source: "setUp\x0a\x09receiver := self targetClass new",
 messageSends: ["new", "targetClass"],
@@ -166,13 +60,13 @@ selector: "should:return:",
 category: 'testing',
 fn: function (aString,anObject){
 var self=this;
-var method;
+return smalltalk.withContext(function($ctx) { var method;
 var result;
 method=_st(_st(self)._compiler())._install_forClass_category_(aString,_st(self)._targetClass(),"tests");
 result=_st(self["@receiver"])._perform_(_st(method)._selector());
 _st(_st(self)._targetClass())._removeCompiledMethod_(method);
 _st(self)._assert_equals_(anObject,result);
-return self},
+return self}, self, "should:return:", [aString,anObject], smalltalk.CodeGeneratorTest)},
 args: ["aString", "anObject"],
 source: "should: aString return: anObject\x0a\x09| method result |\x0a\x0a\x09method := self compiler install: aString forClass: self targetClass category: 'tests'.\x0a\x09result := receiver perform: method selector.\x0a\x09self targetClass removeCompiledMethod: method.\x0a\x09self assert: anObject equals: result",
 messageSends: ["install:forClass:category:", "targetClass", "compiler", "perform:", "selector", "removeCompiledMethod:", "assert:equals:"],
@@ -187,8 +81,8 @@ selector: "targetClass",
 category: 'accessing',
 fn: function (){
 var self=this;
-return (smalltalk.DoIt || DoIt);
-},
+return smalltalk.withContext(function($ctx) { return (smalltalk.DoIt || DoIt);
+}, self, "targetClass", [], smalltalk.CodeGeneratorTest)},
 args: [],
 source: "targetClass\x0a\x09^ DoIt",
 messageSends: [],
@@ -203,7 +97,7 @@ selector: "tearDown",
 category: 'initialization',
 fn: function (){
 var self=this;
-return self},
+return smalltalk.withContext(function($ctx) { return self}, self, "tearDown", [], smalltalk.CodeGeneratorTest)},
 args: [],
 source: "tearDown\x0a\x09\x22receiver := nil\x22",
 messageSends: [],
@@ -218,10 +112,10 @@ selector: "testAssignment",
 category: 'tests',
 fn: function (){
 var self=this;
-_st(self)._should_return_("foo | a | a := true ifTrue: [ 1 ]. ^ a",(1));
+return smalltalk.withContext(function($ctx) { _st(self)._should_return_("foo | a | a := true ifTrue: [ 1 ]. ^ a",(1));
 _st(self)._should_return_("foo | a | a := false ifTrue: [ 1 ]. ^ a",nil);
 _st(self)._should_return_("foo | a | ^ a := true ifTrue: [ 1 ]",(1));
-return self},
+return self}, self, "testAssignment", [], smalltalk.CodeGeneratorTest)},
 args: [],
 source: "testAssignment\x0a\x09self should: 'foo | a | a := true ifTrue: [ 1 ]. ^ a' return: 1.\x0a\x09self should: 'foo | a | a := false ifTrue: [ 1 ]. ^ a' return: nil.\x0a\x0a\x09self should: 'foo | a | ^ a := true ifTrue: [ 1 ]' return: 1 ",
 messageSends: ["should:return:"],
@@ -236,10 +130,10 @@ selector: "testBlockReturn",
 category: 'tests',
 fn: function (){
 var self=this;
-_st(self)._should_return_("foo ^ #(1 2 3) collect: [ :each | true ifTrue: [ each + 1 ] ]",[(2), (3), (4)]);
+return smalltalk.withContext(function($ctx) { _st(self)._should_return_("foo ^ #(1 2 3) collect: [ :each | true ifTrue: [ each + 1 ] ]",[(2), (3), (4)]);
 _st(self)._should_return_("foo ^ #(1 2 3) collect: [ :each | false ifFalse: [ each + 1 ] ]",[(2), (3), (4)]);
 _st(self)._should_return_("foo ^ #(1 2 3) collect: [ :each | each odd ifTrue: [ each + 1 ] ifFalse: [ each - 1 ] ]",[(2), (1), (4)]);
-return self},
+return self}, self, "testBlockReturn", [], smalltalk.CodeGeneratorTest)},
 args: [],
 source: "testBlockReturn\x0a\x09self should: 'foo ^ #(1 2 3) collect: [ :each | true ifTrue: [ each + 1 ] ]' return: #(2 3 4).\x0a\x09self should: 'foo ^ #(1 2 3) collect: [ :each | false ifFalse: [ each + 1 ] ]' return: #(2 3 4).\x0a\x09self should: 'foo ^ #(1 2 3) collect: [ :each | each odd ifTrue: [ each + 1 ] ifFalse: [ each - 1 ] ]' return: #(2 1 4).",
 messageSends: ["should:return:"],
@@ -254,8 +148,8 @@ selector: "testCascades",
 category: 'tests',
 fn: function (){
 var self=this;
-_st(self)._should_return_("foo ^ Array new add: 3; add: 4; yourself",[(3), (4)]);
-return self},
+return smalltalk.withContext(function($ctx) { _st(self)._should_return_("foo ^ Array new add: 3; add: 4; yourself",[(3), (4)]);
+return self}, self, "testCascades", [], smalltalk.CodeGeneratorTest)},
 args: [],
 source: "testCascades\x0a\x09\x0a\x09self should: 'foo ^ Array new add: 3; add: 4; yourself' return: #(3 4)",
 messageSends: ["should:return:"],
@@ -270,7 +164,7 @@ selector: "testLiterals",
 category: 'tests',
 fn: function (){
 var self=this;
-_st(self)._should_return_("foo ^ 1",(1));
+return smalltalk.withContext(function($ctx) { _st(self)._should_return_("foo ^ 1",(1));
 _st(self)._should_return_("foo ^ 'hello'","hello");
 _st(self)._should_return_("foo ^ #(1 2 3 4)",[(1), (2), (3), (4)]);
 _st(self)._should_return_("foo ^ {1. [:x | x ] value: 2. 3. [4] value}",[(1), (2), (3), (4)]);
@@ -279,7 +173,7 @@ _st(self)._should_return_("foo ^ false",false);
 _st(self)._should_return_("foo ^ #{1->2. 3->4}",smalltalk.HashedCollection._fromPairs_([_st((1)).__minus_gt((2)),_st((3)).__minus_gt((4))]));
 _st(self)._should_return_("foo ^ #hello",smalltalk.symbolFor("hello"));
 _st(self)._should_return_("foo ^ -123.456",(-123.456));
-return self},
+return self}, self, "testLiterals", [], smalltalk.CodeGeneratorTest)},
 args: [],
 source: "testLiterals\x0a\x09self should: 'foo ^ 1' return: 1.\x0a\x09self should: 'foo ^ ''hello''' return: 'hello'.\x0a\x09self should: 'foo ^ #(1 2 3 4)' return: #(1 2 3 4).\x0a\x09self should: 'foo ^ {1. [:x | x ] value: 2. 3. [4] value}' return: #(1 2 3 4).\x0a\x09self should: 'foo ^ true' return: true.\x0a\x09self should: 'foo ^ false' return: false.\x0a\x09self should: 'foo ^ #{1->2. 3->4}' return: #{1->2. 3->4}.\x0a\x09self should: 'foo ^ #hello' return: #hello.\x0a\x09self should: 'foo ^ -123.456' return: -123.456",
 messageSends: ["should:return:", "->"],
@@ -294,12 +188,12 @@ selector: "testLocalReturn",
 category: 'tests',
 fn: function (){
 var self=this;
-_st(self)._should_return_("foo ^ 1",(1));
+return smalltalk.withContext(function($ctx) { _st(self)._should_return_("foo ^ 1",(1));
 _st(self)._should_return_("foo ^ 1 + 1",(2));
 _st(self)._should_return_("foo ",self["@receiver"]);
 _st(self)._should_return_("foo self asString",self["@receiver"]);
 _st(self)._should_return_("foo | a b | a := 1. b := 2. ^ a + b",(3));
-return self},
+return self}, self, "testLocalReturn", [], smalltalk.CodeGeneratorTest)},
 args: [],
 source: "testLocalReturn\x0a\x09self should: 'foo ^ 1' return: 1.\x0a\x09self should: 'foo ^ 1 + 1' return: 2.\x0a\x09self should: 'foo ' return: receiver.\x0a\x09self should: 'foo self asString' return: receiver.\x0a\x09self should: 'foo | a b | a := 1. b := 2. ^ a + b' return: 3",
 messageSends: ["should:return:"],
@@ -314,12 +208,12 @@ selector: "testMessageSends",
 category: 'tests',
 fn: function (){
 var self=this;
-_st(self)._should_return_("foo ^ 1 asString","1");
+return smalltalk.withContext(function($ctx) { _st(self)._should_return_("foo ^ 1 asString","1");
 _st(self)._should_return_("foo ^ 1 + 1",(2));
 _st(self)._should_return_("foo ^ 1 + 2 * 3",(9));
 _st(self)._should_return_("foo ^ 1 to: 3",[(1), (2), (3)]);
 _st(self)._should_return_("foo ^ 1 to: 5 by: 2",[(1), (3), (5)]);
-return self},
+return self}, self, "testMessageSends", [], smalltalk.CodeGeneratorTest)},
 args: [],
 source: "testMessageSends\x0a\x09self should: 'foo ^ 1 asString' return: '1'.\x0a\x0a\x09self should: 'foo ^ 1 + 1' return: 2.\x0a\x09self should: 'foo ^ 1 + 2 * 3' return: 9.\x0a\x0a\x09self should: 'foo ^ 1 to: 3' return: #(1 2 3).\x0a\x09self should: 'foo ^ 1 to: 5 by: 2' return: #(1 3 5)",
 messageSends: ["should:return:"],
@@ -334,11 +228,11 @@ selector: "testNestedIfTrue",
 category: 'tests',
 fn: function (){
 var self=this;
-_st(self)._should_return_("foo ^ true ifTrue: [ false ifFalse: [ 1 ] ]",(1));
+return smalltalk.withContext(function($ctx) { _st(self)._should_return_("foo ^ true ifTrue: [ false ifFalse: [ 1 ] ]",(1));
 _st(self)._should_return_("foo ^ true ifTrue: [ false ifTrue: [ 1 ] ]",nil);
 _st(self)._should_return_("foo true ifTrue: [ false ifFalse: [ ^ 1 ] ]",(1));
 _st(self)._should_return_("foo true ifTrue: [ false ifTrue: [ ^ 1 ] ]",self["@receiver"]);
-return self},
+return self}, self, "testNestedIfTrue", [], smalltalk.CodeGeneratorTest)},
 args: [],
 source: "testNestedIfTrue\x0a\x09self should: 'foo ^ true ifTrue: [ false ifFalse: [ 1 ] ]' return: 1.\x0a\x09self should: 'foo ^ true ifTrue: [ false ifTrue: [ 1 ] ]' return: nil.\x0a\x0a\x09self should: 'foo true ifTrue: [ false ifFalse: [ ^ 1 ] ]' return: 1.\x0a\x09self should: 'foo true ifTrue: [ false ifTrue: [ ^ 1 ] ]' return: receiver.",
 messageSends: ["should:return:"],
@@ -353,11 +247,11 @@ selector: "testNonLocalReturn",
 category: 'tests',
 fn: function (){
 var self=this;
-_st(self)._should_return_("foo [ ^ 1 ] value",(1));
+return smalltalk.withContext(function($ctx) { _st(self)._should_return_("foo [ ^ 1 ] value",(1));
 _st(self)._should_return_("foo [ ^ 1 + 1 ] value",(2));
 _st(self)._should_return_("foo | a b | a := 1. b := 2. [ ^ a + b ] value. self halt",(3));
 _st(self)._should_return_("foo [ :x | ^ x + x ] value: 4. ^ 2",(8));
-return self},
+return self}, self, "testNonLocalReturn", [], smalltalk.CodeGeneratorTest)},
 args: [],
 source: "testNonLocalReturn\x0a\x09self should: 'foo [ ^ 1 ] value' return: 1.\x0a\x09self should: 'foo [ ^ 1 + 1 ] value' return: 2.\x0a\x09self should: 'foo | a b | a := 1. b := 2. [ ^ a + b ] value. self halt' return: 3.\x0a\x09self should: 'foo [ :x | ^ x + x ] value: 4. ^ 2' return: 8",
 messageSends: ["should:return:"],
@@ -372,11 +266,11 @@ selector: "testifFalse",
 category: 'tests',
 fn: function (){
 var self=this;
-_st(self)._should_return_("foo true ifFalse: [ ^ 1 ]",self["@receiver"]);
+return smalltalk.withContext(function($ctx) { _st(self)._should_return_("foo true ifFalse: [ ^ 1 ]",self["@receiver"]);
 _st(self)._should_return_("foo false ifFalse: [ ^ 2 ]",(2));
 _st(self)._should_return_("foo ^ true ifFalse: [ 1 ]",nil);
 _st(self)._should_return_("foo ^ false ifFalse: [ 2 ]",(2));
-return self},
+return self}, self, "testifFalse", [], smalltalk.CodeGeneratorTest)},
 args: [],
 source: "testifFalse\x0a\x09self should: 'foo true ifFalse: [ ^ 1 ]' return: receiver.\x0a\x09self should: 'foo false ifFalse: [ ^ 2 ]' return: 2.\x0a\x09\x0a\x09self should: 'foo ^ true ifFalse: [ 1 ]' return: nil.\x0a\x09self should: 'foo ^ false ifFalse: [ 2 ]' return: 2.",
 messageSends: ["should:return:"],
@@ -391,11 +285,11 @@ selector: "testifFalseIfTrue",
 category: 'tests',
 fn: function (){
 var self=this;
-_st(self)._should_return_("foo true ifFalse: [ ^ 1 ] ifTrue: [ ^ 2 ]",(2));
+return smalltalk.withContext(function($ctx) { _st(self)._should_return_("foo true ifFalse: [ ^ 1 ] ifTrue: [ ^ 2 ]",(2));
 _st(self)._should_return_("foo false ifFalse: [ ^ 2 ] ifTrue: [ ^1 ]",(2));
 _st(self)._should_return_("foo ^ true ifFalse: [ 1 ] ifTrue: [ 2 ]",(2));
 _st(self)._should_return_("foo ^ false ifFalse: [ 2 ] ifTrue: [ 1 ]",(2));
-return self},
+return self}, self, "testifFalseIfTrue", [], smalltalk.CodeGeneratorTest)},
 args: [],
 source: "testifFalseIfTrue\x0a\x09self should: 'foo true ifFalse: [ ^ 1 ] ifTrue: [ ^ 2 ]' return: 2.\x0a\x09self should: 'foo false ifFalse: [ ^ 2 ] ifTrue: [ ^1 ]' return: 2.\x0a\x09\x0a\x09self should: 'foo ^ true ifFalse: [ 1 ] ifTrue: [ 2 ]' return: 2.\x0a\x09self should: 'foo ^ false ifFalse: [ 2 ] ifTrue: [ 1 ]' return: 2.",
 messageSends: ["should:return:"],
@@ -410,11 +304,11 @@ selector: "testifNil",
 category: 'tests',
 fn: function (){
 var self=this;
-_st(self)._should_return_("foo ^ 1 ifNil: [ 2 ]",(1));
+return smalltalk.withContext(function($ctx) { _st(self)._should_return_("foo ^ 1 ifNil: [ 2 ]",(1));
 _st(self)._should_return_("foo ^ nil ifNil: [ 2 ]",(2));
 _st(self)._should_return_("foo 1 ifNil: [ ^ 2 ]",self["@receiver"]);
 _st(self)._should_return_("foo nil ifNil: [ ^ 2 ]",(2));
-return self},
+return self}, self, "testifNil", [], smalltalk.CodeGeneratorTest)},
 args: [],
 source: "testifNil\x0a\x09self should: 'foo ^ 1 ifNil: [ 2 ]' return: 1.\x0a\x09self should: 'foo ^ nil ifNil: [ 2 ]' return: 2.\x0a\x0a\x09self should: 'foo 1 ifNil: [ ^ 2 ]' return: receiver.\x0a\x09self should: 'foo nil ifNil: [ ^ 2 ]' return: 2.",
 messageSends: ["should:return:"],
@@ -429,11 +323,11 @@ selector: "testifNilIfNotNil",
 category: 'tests',
 fn: function (){
 var self=this;
-_st(self)._should_return_("foo ^ 1 ifNil: [ 2 ] ifNotNil: [ 3 ]",(3));
+return smalltalk.withContext(function($ctx) { _st(self)._should_return_("foo ^ 1 ifNil: [ 2 ] ifNotNil: [ 3 ]",(3));
 _st(self)._should_return_("foo ^ nil ifNil: [ 2 ] ifNotNil: [ 3 ]",(2));
 _st(self)._should_return_("foo 1 ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(3));
 _st(self)._should_return_("foo nil ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(2));
-return self},
+return self}, self, "testifNilIfNotNil", [], smalltalk.CodeGeneratorTest)},
 args: [],
 source: "testifNilIfNotNil\x0a\x09self should: 'foo ^ 1 ifNil: [ 2 ] ifNotNil: [ 3 ]' return: 3.\x0a\x09self should: 'foo ^ nil ifNil: [ 2 ] ifNotNil: [ 3 ]' return: 2.\x0a\x0a\x09self should: 'foo 1 ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]' return: 3.\x0a\x09self should: 'foo nil ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]' return: 2.",
 messageSends: ["should:return:"],
@@ -448,11 +342,11 @@ selector: "testifNotNil",
 category: 'tests',
 fn: function (){
 var self=this;
-_st(self)._should_return_("foo ^ 1 ifNotNil: [ 2 ]",(2));
+return smalltalk.withContext(function($ctx) { _st(self)._should_return_("foo ^ 1 ifNotNil: [ 2 ]",(2));
 _st(self)._should_return_("foo ^ nil ifNotNil: [ 2 ]",nil);
 _st(self)._should_return_("foo 1 ifNotNil: [ ^ 2 ]",(2));
 _st(self)._should_return_("foo nil ifNotNil: [ ^ 2 ]",self["@receiver"]);
-return self},
+return self}, self, "testifNotNil", [], smalltalk.CodeGeneratorTest)},
 args: [],
 source: "testifNotNil\x0a\x09self should: 'foo ^ 1 ifNotNil: [ 2 ]' return: 2.\x0a\x09self should: 'foo ^ nil ifNotNil: [ 2 ]' return: nil.\x0a\x0a\x09self should: 'foo 1 ifNotNil: [ ^ 2 ]' return: 2.\x0a\x09self should: 'foo nil ifNotNil: [ ^ 2 ]' return: receiver.",
 messageSends: ["should:return:"],
@@ -467,11 +361,11 @@ selector: "testifTrue",
 category: 'tests',
 fn: function (){
 var self=this;
-_st(self)._should_return_("foo false ifTrue: [ ^ 1 ]",self["@receiver"]);
+return smalltalk.withContext(function($ctx) { _st(self)._should_return_("foo false ifTrue: [ ^ 1 ]",self["@receiver"]);
 _st(self)._should_return_("foo true ifTrue: [ ^ 2 ]",(2));
 _st(self)._should_return_("foo ^ false ifTrue: [ 1 ]",nil);
 _st(self)._should_return_("foo ^ true ifTrue: [ 2 ]",(2));
-return self},
+return self}, self, "testifTrue", [], smalltalk.CodeGeneratorTest)},
 args: [],
 source: "testifTrue\x0a\x09self should: 'foo false ifTrue: [ ^ 1 ]' return: receiver.\x0a\x09self should: 'foo true ifTrue: [ ^ 2 ]' return: 2.\x0a\x09\x0a\x09self should: 'foo ^ false ifTrue: [ 1 ]' return: nil.\x0a\x09self should: 'foo ^ true ifTrue: [ 2 ]' return: 2.",
 messageSends: ["should:return:"],
@@ -486,11 +380,11 @@ selector: "testifTrueIfFalse",
 category: 'tests',
 fn: function (){
 var self=this;
-_st(self)._should_return_("foo false ifTrue: [ ^ 1 ] ifFalse: [ ^2 ]",(2));
+return smalltalk.withContext(function($ctx) { _st(self)._should_return_("foo false ifTrue: [ ^ 1 ] ifFalse: [ ^2 ]",(2));
 _st(self)._should_return_("foo true ifTrue: [ ^ 1 ] ifFalse: [ ^ 2 ]",(1));
 _st(self)._should_return_("foo ^ false ifTrue: [ 2 ] ifFalse: [ 1 ]",(1));
 _st(self)._should_return_("foo ^ true ifTrue: [ 2 ] ifFalse: [ 1 ]",(2));
-return self},
+return self}, self, "testifTrueIfFalse", [], smalltalk.CodeGeneratorTest)},
 args: [],
 source: "testifTrueIfFalse\x0a\x09self should: 'foo false ifTrue: [ ^ 1 ] ifFalse: [ ^2 ]' return: 2.\x0a\x09self should: 'foo true ifTrue: [ ^ 1 ] ifFalse: [ ^ 2 ]' return: 1.\x0a\x09\x0a\x09self should: 'foo ^ false ifTrue: [ 2 ] ifFalse: [ 1 ]' return: 1.\x0a\x09self should: 'foo ^ true ifTrue: [ 2 ] ifFalse: [ 1 ]' return: 2.",
 messageSends: ["should:return:"],
@@ -508,8 +402,8 @@ selector: "codeGeneratorClass",
 category: 'accessing',
 fn: function (){
 var self=this;
-return (smalltalk.InliningCodeGenerator || InliningCodeGenerator);
-},
+return smalltalk.withContext(function($ctx) { return (smalltalk.InliningCodeGenerator || InliningCodeGenerator);
+}, self, "codeGeneratorClass", [], smalltalk.InliningCodeGeneratorTest)},
 args: [],
 source: "codeGeneratorClass\x0a\x09^ InliningCodeGenerator",
 messageSends: [],
@@ -527,7 +421,7 @@ selector: "testClassRefVar",
 category: 'tests',
 fn: function (){
 var self=this;
-var $1,$2;
+return smalltalk.withContext(function($ctx) { var $1,$2;
 var node;
 $1=_st((smalltalk.ClassReferenceNode || ClassReferenceNode))._new();
 _st($1)._value_("Object");
@@ -535,7 +429,7 @@ $2=_st($1)._yourself();
 node=$2;
 _st(_st((smalltalk.SemanticAnalyzer || SemanticAnalyzer))._new())._visit_(node);
 _st(self)._assert_(_st(_st(node)._binding())._isClassRefVar());
-return self},
+return self}, self, "testClassRefVar", [], smalltalk.ScopeVarTest)},
 args: [],
 source: "testClassRefVar\x0a\x09| node |\x0a\x09node := ClassReferenceNode new\x0a\x09\x09value: 'Object';\x0a\x09\x09yourself.\x0a\x09SemanticAnalyzer new visit: node.\x0a\x09self assert: node binding isClassRefVar",
 messageSends: ["value:", "new", "yourself", "visit:", "assert:", "isClassRefVar", "binding"],
@@ -550,7 +444,7 @@ selector: "testInstanceVar",
 category: 'tests',
 fn: function (){
 var self=this;
-var $1,$2;
+return smalltalk.withContext(function($ctx) { var $1,$2;
 var node;
 var scope;
 $1=_st((smalltalk.VariableNode || VariableNode))._new();
@@ -560,7 +454,7 @@ node=$2;
 scope=_st((smalltalk.MethodLexicalScope || MethodLexicalScope))._new();
 _st(scope)._addIVar_("bzzz");
 _st(self)._assert_(_st(_st(scope)._bindingFor_(node))._isInstanceVar());
-return self},
+return self}, self, "testInstanceVar", [], smalltalk.ScopeVarTest)},
 args: [],
 source: "testInstanceVar\x0a\x09| node scope |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'bzzz';\x0a\x09\x09yourself.\x0a\x09scope := MethodLexicalScope new.\x0a\x09scope addIVar: 'bzzz'.\x0a\x09self assert: (scope bindingFor: node) isInstanceVar",
 messageSends: ["value:", "new", "yourself", "addIVar:", "assert:", "isInstanceVar", "bindingFor:"],
@@ -575,7 +469,7 @@ selector: "testPseudoVar",
 category: 'tests',
 fn: function (){
 var self=this;
-var $1,$2;
+return smalltalk.withContext(function($ctx) { var $1,$2;
 var node;
 var pseudoVars;
 pseudoVars=["self", "super", "true", "false", "nil"];
@@ -587,7 +481,7 @@ node=$2;
 node;
 return _st(self)._assert_(_st(_st(_st((smalltalk.MethodLexicalScope || MethodLexicalScope))._new())._bindingFor_(node))._isPseudoVar());
 }));
-return self},
+return self}, self, "testPseudoVar", [], smalltalk.ScopeVarTest)},
 args: [],
 source: "testPseudoVar\x0a\x09| node pseudoVars |\x0a\x09pseudoVars := #('self' 'super' 'true' 'false' 'nil').\x0a\x09pseudoVars do: [:each |\x0a\x09\x09node := VariableNode new\x0a\x09\x09value: each;\x0a\x09\x09yourself.\x0a\x09\x09self assert: (MethodLexicalScope new bindingFor: node) isPseudoVar ]",
 messageSends: ["do:", "value:", "new", "yourself", "assert:", "isPseudoVar", "bindingFor:"],
@@ -602,7 +496,7 @@ selector: "testTempVar",
 category: 'tests',
 fn: function (){
 var self=this;
-var $1,$2;
+return smalltalk.withContext(function($ctx) { var $1,$2;
 var node;
 var scope;
 $1=_st((smalltalk.VariableNode || VariableNode))._new();
@@ -612,7 +506,7 @@ node=$2;
 scope=_st((smalltalk.MethodLexicalScope || MethodLexicalScope))._new();
 _st(scope)._addTemp_("bzzz");
 _st(self)._assert_(_st(_st(scope)._bindingFor_(node))._isTempVar());
-return self},
+return self}, self, "testTempVar", [], smalltalk.ScopeVarTest)},
 args: [],
 source: "testTempVar\x0a\x09| node scope |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'bzzz';\x0a\x09\x09yourself.\x0a\x09scope := MethodLexicalScope new.\x0a\x09scope addTemp: 'bzzz'.\x0a\x09self assert: (scope bindingFor: node) isTempVar",
 messageSends: ["value:", "new", "yourself", "addTemp:", "assert:", "isTempVar", "bindingFor:"],
@@ -627,14 +521,14 @@ selector: "testUnknownVar",
 category: 'tests',
 fn: function (){
 var self=this;
-var $1,$2;
+return smalltalk.withContext(function($ctx) { var $1,$2;
 var node;
 $1=_st((smalltalk.VariableNode || VariableNode))._new();
 _st($1)._value_("bzzz");
 $2=_st($1)._yourself();
 node=$2;
 _st(self)._assert_(_st(_st(_st((smalltalk.MethodLexicalScope || MethodLexicalScope))._new())._bindingFor_(node))._isNil());
-return self},
+return self}, self, "testUnknownVar", [], smalltalk.ScopeVarTest)},
 args: [],
 source: "testUnknownVar\x0a\x09| node |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'bzzz';\x0a\x09\x09yourself.\x0a\x09self assert: (MethodLexicalScope new bindingFor: node) isNil",
 messageSends: ["value:", "new", "yourself", "assert:", "isNil", "bindingFor:"],
@@ -652,8 +546,8 @@ selector: "setUp",
 category: 'running',
 fn: function (){
 var self=this;
-self["@analyzer"]=_st((smalltalk.SemanticAnalyzer || SemanticAnalyzer))._on_((smalltalk.Object || Object));
-return self},
+return smalltalk.withContext(function($ctx) { self["@analyzer"]=_st((smalltalk.SemanticAnalyzer || SemanticAnalyzer))._on_((smalltalk.Object || Object));
+return self}, self, "setUp", [], smalltalk.SemanticAnalyzerTest)},
 args: [],
 source: "setUp\x0a\x09analyzer := SemanticAnalyzer on: Object",
 messageSends: ["on:"],
@@ -668,14 +562,14 @@ selector: "testAssignment",
 category: 'tests',
 fn: function (){
 var self=this;
-var src;
+return smalltalk.withContext(function($ctx) { var src;
 var ast;
 src="foo self := 1";
 ast=_st(smalltalk)._parse_(src);
 _st(self)._should_raise_((function(){
 return _st(self["@analyzer"])._visit_(ast);
 }),(smalltalk.InvalidAssignmentError || InvalidAssignmentError));
-return self},
+return self}, self, "testAssignment", [], smalltalk.SemanticAnalyzerTest)},
 args: [],
 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:"],
@@ -690,13 +584,13 @@ selector: "testNonLocalReturn",
 category: 'tests',
 fn: function (){
 var self=this;
-var src;
+return smalltalk.withContext(function($ctx) { var src;
 var ast;
 src="foo | a | a + 1. ^ a";
 ast=_st(smalltalk)._parse_(src);
 _st(self["@analyzer"])._visit_(ast);
 _st(self)._deny_(_st(_st(ast)._scope())._hasNonLocalReturn());
-return self},
+return self}, self, "testNonLocalReturn", [], smalltalk.SemanticAnalyzerTest)},
 args: [],
 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"],
@@ -711,13 +605,13 @@ selector: "testNonLocalReturn2",
 category: 'tests',
 fn: function (){
 var self=this;
-var src;
+return smalltalk.withContext(function($ctx) { var src;
 var ast;
 src="foo | a | a + 1. [ [ ^ a] ]";
 ast=_st(smalltalk)._parse_(src);
 _st(self["@analyzer"])._visit_(ast);
 _st(self)._assert_(_st(_st(ast)._scope())._hasNonLocalReturn());
-return self},
+return self}, self, "testNonLocalReturn2", [], smalltalk.SemanticAnalyzerTest)},
 args: [],
 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"],
@@ -732,13 +626,13 @@ selector: "testScope",
 category: 'tests',
 fn: function (){
 var self=this;
-var src;
+return smalltalk.withContext(function($ctx) { var src;
 var ast;
 src="foo | a | a + 1. [ | b | b := a ]";
 ast=_st(smalltalk)._parse_(src);
 _st(self["@analyzer"])._visit_(ast);
 _st(self)._deny_(_st(_st(_st(_st(_st(_st(ast)._nodes())._first())._nodes())._last())._scope()).__eq_eq(_st(ast)._scope()));
-return self},
+return self}, self, "testScope", [], smalltalk.SemanticAnalyzerTest)},
 args: [],
 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"],
@@ -753,13 +647,13 @@ selector: "testScope2",
 category: 'tests',
 fn: function (){
 var self=this;
-var src;
+return smalltalk.withContext(function($ctx) { var src;
 var ast;
 src="foo | a | a + 1. [ [ | b | b := a ] ]";
 ast=_st(smalltalk)._parse_(src);
 _st(self["@analyzer"])._visit_(ast);
 _st(self)._deny_(_st(_st(_st(_st(_st(_st(_st(_st(_st(_st(ast)._nodes())._first())._nodes())._last())._nodes())._first())._nodes())._first())._scope()).__eq_eq(_st(ast)._scope()));
-return self},
+return self}, self, "testScope2", [], smalltalk.SemanticAnalyzerTest)},
 args: [],
 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"],
@@ -774,14 +668,14 @@ selector: "testScopeLevel",
 category: 'tests',
 fn: function (){
 var self=this;
-var src;
+return smalltalk.withContext(function($ctx) { var src;
 var ast;
 src="foo | a | a + 1. [ [ | b | b := a ] ]";
 ast=_st(smalltalk)._parse_(src);
 _st(self["@analyzer"])._visit_(ast);
 _st(self)._assert_(_st(_st(_st(ast)._scope())._scopeLevel()).__eq((1)));
 _st(self)._assert_(_st(_st(_st(_st(_st(_st(_st(_st(_st(_st(_st(ast)._nodes())._first())._nodes())._last())._nodes())._first())._nodes())._first())._scope())._scopeLevel()).__eq((3)));
-return self},
+return self}, self, "testScopeLevel", [], smalltalk.SemanticAnalyzerTest)},
 args: [],
 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 = 1.\x0a\x09self assert: ast nodes first nodes last nodes first nodes first scope scopeLevel = 3",
 messageSends: ["parse:", "visit:", "assert:", "=", "scopeLevel", "scope", "first", "nodes", "last"],
@@ -796,14 +690,14 @@ selector: "testUnknownVariables",
 category: 'tests',
 fn: function (){
 var self=this;
-var src;
+return smalltalk.withContext(function($ctx) { var src;
 var ast;
 src="foo | a | b + a";
 ast=_st(smalltalk)._parse_(src);
 _st(self)._should_raise_((function(){
 return _st(self["@analyzer"])._visit_(ast);
 }),(smalltalk.UnknownVariableError || UnknownVariableError));
-return self},
+return self}, self, "testUnknownVariables", [], smalltalk.SemanticAnalyzerTest)},
 args: [],
 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:"],
@@ -818,12 +712,12 @@ selector: "testUnknownVariablesDefinedInJS",
 category: 'tests',
 fn: function (){
 var self=this;
- var someVariable = 1 ;
+return smalltalk.withContext(function($ctx) {  var someVariable = 1 ;
 ;
 _st(self)._shouldnt_raise_((function(){
 return _st(smalltalk)._parse_("foo someVariable");
 }),(smalltalk.UnknownVariableError || UnknownVariableError));
-return self},
+return self}, self, "testUnknownVariablesDefinedInJS", [], smalltalk.SemanticAnalyzerTest)},
 args: [],
 source: "testUnknownVariablesDefinedInJS\x0a\x0a\x09< var someVariable = 1 >.\x0a\x0a\x09self shouldnt: [ smalltalk parse: 'foo someVariable' ] raise: UnknownVariableError",
 messageSends: ["shouldnt:raise:", "parse:"],
@@ -838,14 +732,14 @@ selector: "testUnknownVariablesWithScope",
 category: 'tests',
 fn: function (){
 var self=this;
-var src;
+return smalltalk.withContext(function($ctx) { var src;
 var ast;
 src="foo | a b | [ c + 1. [ a + 1. d + 1 ]]";
 ast=_st(smalltalk)._parse_(src);
 _st(self)._should_raise_((function(){
 return _st(self["@analyzer"])._visit_(ast);
 }),(smalltalk.UnknownVariableError || UnknownVariableError));
-return self},
+return self}, self, "testUnknownVariablesWithScope", [], smalltalk.SemanticAnalyzerTest)},
 args: [],
 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:"],
@@ -860,12 +754,12 @@ selector: "testVariableShadowing",
 category: 'tests',
 fn: function (){
 var self=this;
-var src;
+return smalltalk.withContext(function($ctx) { var src;
 var ast;
 src="foo | a | a + 1";
 ast=_st(smalltalk)._parse_(src);
 _st(self["@analyzer"])._visit_(ast);
-return self},
+return self}, self, "testVariableShadowing", [], smalltalk.SemanticAnalyzerTest)},
 args: [],
 source: "testVariableShadowing\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1'.\x0a\x09ast := smalltalk parse: src.\x0a\x09analyzer visit: ast",
 messageSends: ["parse:", "visit:"],
@@ -880,14 +774,14 @@ selector: "testVariableShadowing2",
 category: 'tests',
 fn: function (){
 var self=this;
-var src;
+return smalltalk.withContext(function($ctx) { var src;
 var ast;
 src="foo | a | a + 1. [ | a | a := 2 ]";
 ast=_st(smalltalk)._parse_(src);
 _st(self)._should_raise_((function(){
 return _st(self["@analyzer"])._visit_(ast);
 }),(smalltalk.ShadowingVariableError || ShadowingVariableError));
-return self},
+return self}, self, "testVariableShadowing2", [], smalltalk.SemanticAnalyzerTest)},
 args: [],
 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:"],
@@ -902,12 +796,12 @@ selector: "testVariableShadowing3",
 category: 'tests',
 fn: function (){
 var self=this;
-var src;
+return smalltalk.withContext(function($ctx) { var src;
 var ast;
 src="foo | a | a + 1. [ | b | b := 2 ]";
 ast=_st(smalltalk)._parse_(src);
 _st(self["@analyzer"])._visit_(ast);
-return self},
+return self}, self, "testVariableShadowing3", [], smalltalk.SemanticAnalyzerTest)},
 args: [],
 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:"],
@@ -922,12 +816,12 @@ selector: "testVariableShadowing4",
 category: 'tests',
 fn: function (){
 var self=this;
-var src;
+return smalltalk.withContext(function($ctx) { var src;
 var ast;
 src="foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]";
 ast=_st(smalltalk)._parse_(src);
 _st(self["@analyzer"])._visit_(ast);
-return self},
+return self}, self, "testVariableShadowing4", [], smalltalk.SemanticAnalyzerTest)},
 args: [],
 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:"],
@@ -942,14 +836,14 @@ selector: "testVariableShadowing5",
 category: 'tests',
 fn: function (){
 var self=this;
-var src;
+return smalltalk.withContext(function($ctx) { var src;
 var ast;
 src="foo | a | a + 1. [ [ [ | a | a := 2 ] ] ]";
 ast=_st(smalltalk)._parse_(src);
 _st(self)._should_raise_((function(){
 return _st(self["@analyzer"])._visit_(ast);
 }),(smalltalk.ShadowingVariableError || ShadowingVariableError));
-return self},
+return self}, self, "testVariableShadowing5", [], smalltalk.SemanticAnalyzerTest)},
 args: [],
 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:"],
@@ -964,7 +858,7 @@ selector: "testVariablesLookup",
 category: 'tests',
 fn: function (){
 var self=this;
-var src;
+return smalltalk.withContext(function($ctx) { var src;
 var ast;
 src="foo | a | a + 1. [ | b | b := a ]";
 ast=_st(smalltalk)._parse_(src);
@@ -973,7 +867,7 @@ _st(self)._assert_(_st(_st(_st(_st(_st(_st(_st(ast)._nodes())._first())._nodes()
 _st(self)._assert_(_st(_st(_st(_st(_st(_st(_st(_st(ast)._nodes())._first())._nodes())._first())._receiver())._binding())._scope()).__eq_eq(_st(ast)._scope()));
 _st(self)._assert_(_st(_st(_st(_st(_st(_st(_st(_st(_st(_st(_st(ast)._nodes())._first())._nodes())._last())._nodes())._first())._nodes())._first())._left())._binding())._isTempVar());
 _st(self)._assert_(_st(_st(_st(_st(_st(_st(_st(_st(_st(_st(_st(_st(ast)._nodes())._first())._nodes())._last())._nodes())._first())._nodes())._first())._left())._binding())._scope()).__eq_eq(_st(_st(_st(_st(_st(ast)._nodes())._first())._nodes())._last())._scope()));
-return self},
+return self}, self, "testVariablesLookup", [], smalltalk.SemanticAnalyzerTest)},
 args: [],
 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"],

+ 29 - 29
js/Examples.deploy.js

@@ -6,11 +6,11 @@ smalltalk.method({
 selector: "decrease",
 fn: function (){
 var self=this;
-self["@count"]=smalltalk.send(self["@count"],"__minus",[(1)]);
-smalltalk.send(self["@header"],"_contents_",[(function(html){
-return smalltalk.send(html,"_with_",[smalltalk.send(self["@count"],"_asString",[])]);
-})]);
-return self}
+return smalltalk.withContext(function($ctx) { self["@count"]=_st(self["@count"]).__minus((1));
+_st(self["@header"])._contents_((function(html){
+return _st(html)._with_(_st(self["@count"])._asString());
+}));
+return self}, self, "decrease", [], smalltalk.Counter)}
 }),
 smalltalk.Counter);
 
@@ -20,11 +20,11 @@ smalltalk.method({
 selector: "increase",
 fn: function (){
 var self=this;
-self["@count"]=smalltalk.send(self["@count"],"__plus",[(1)]);
-smalltalk.send(self["@header"],"_contents_",[(function(html){
-return smalltalk.send(html,"_with_",[smalltalk.send(self["@count"],"_asString",[])]);
-})]);
-return self}
+return smalltalk.withContext(function($ctx) { self["@count"]=_st(self["@count"]).__plus((1));
+_st(self["@header"])._contents_((function(html){
+return _st(html)._with_(_st(self["@count"])._asString());
+}));
+return self}, self, "increase", [], smalltalk.Counter)}
 }),
 smalltalk.Counter);
 
@@ -34,9 +34,9 @@ smalltalk.method({
 selector: "initialize",
 fn: function (){
 var self=this;
-smalltalk.send(self,"_initialize",[],smalltalk.Widget);
+return smalltalk.withContext(function($ctx) { smalltalk.Widget.fn.prototype._initialize.apply(_st(self), []);
 self["@count"]=(0);
-return self}
+return self}, self, "initialize", [], smalltalk.Counter)}
 }),
 smalltalk.Counter);
 
@@ -46,22 +46,22 @@ smalltalk.method({
 selector: "renderOn:",
 fn: function (html){
 var self=this;
-var $1,$2,$3,$4,$5,$6;
-$1=smalltalk.send(html,"_h1",[]);
-smalltalk.send($1,"_with_",[smalltalk.send(self["@count"],"_asString",[])]);
-$2=smalltalk.send($1,"_yourself",[]);
+return smalltalk.withContext(function($ctx) { var $1,$2,$3,$4,$5,$6;
+$1=_st(html)._h1();
+_st($1)._with_(_st(self["@count"])._asString());
+$2=_st($1)._yourself();
 self["@header"]=$2;
-$3=smalltalk.send(html,"_button",[]);
-smalltalk.send($3,"_with_",["++"]);
-$4=smalltalk.send($3,"_onClick_",[(function(){
-return smalltalk.send(self,"_increase",[]);
-})]);
-$5=smalltalk.send(html,"_button",[]);
-smalltalk.send($5,"_with_",["--"]);
-$6=smalltalk.send($5,"_onClick_",[(function(){
-return smalltalk.send(self,"_decrease",[]);
-})]);
-return self}
+$3=_st(html)._button();
+_st($3)._with_("++");
+$4=_st($3)._onClick_((function(){
+return _st(self)._increase();
+}));
+$5=_st(html)._button();
+_st($5)._with_("--");
+$6=_st($5)._onClick_((function(){
+return _st(self)._decrease();
+}));
+return self}, self, "renderOn:", [html], smalltalk.Counter)}
 }),
 smalltalk.Counter);
 
@@ -72,8 +72,8 @@ smalltalk.method({
 selector: "tryExample",
 fn: function (){
 var self=this;
-smalltalk.send(smalltalk.send(self,"_new",[]),"_appendToJQuery_",[smalltalk.send("body","_asJQuery",[])]);
-return self}
+return smalltalk.withContext(function($ctx) { _st(_st(self)._new())._appendToJQuery_(_st("body")._asJQuery());
+return self}, self, "tryExample", [], smalltalk.Counter.klass)}
 }),
 smalltalk.Counter.klass);
 

+ 29 - 29
js/Examples.js

@@ -8,11 +8,11 @@ selector: "decrease",
 category: 'actions',
 fn: function (){
 var self=this;
-self["@count"]=smalltalk.send(self["@count"],"__minus",[(1)]);
-smalltalk.send(self["@header"],"_contents_",[(function(html){
-return smalltalk.send(html,"_with_",[smalltalk.send(self["@count"],"_asString",[])]);
-})]);
-return self},
+return smalltalk.withContext(function($ctx) { self["@count"]=_st(self["@count"]).__minus((1));
+_st(self["@header"])._contents_((function(html){
+return _st(html)._with_(_st(self["@count"])._asString());
+}));
+return self}, self, "decrease", [], smalltalk.Counter)},
 args: [],
 source: "decrease\x0a    count := count - 1.\x0a    header contents: [:html | html with: count asString]",
 messageSends: ["-", "contents:", "with:", "asString"],
@@ -27,11 +27,11 @@ selector: "increase",
 category: 'actions',
 fn: function (){
 var self=this;
-self["@count"]=smalltalk.send(self["@count"],"__plus",[(1)]);
-smalltalk.send(self["@header"],"_contents_",[(function(html){
-return smalltalk.send(html,"_with_",[smalltalk.send(self["@count"],"_asString",[])]);
-})]);
-return self},
+return smalltalk.withContext(function($ctx) { self["@count"]=_st(self["@count"]).__plus((1));
+_st(self["@header"])._contents_((function(html){
+return _st(html)._with_(_st(self["@count"])._asString());
+}));
+return self}, self, "increase", [], smalltalk.Counter)},
 args: [],
 source: "increase\x0a    count := count + 1.\x0a    header contents: [:html | html with: count asString]",
 messageSends: ["+", "contents:", "with:", "asString"],
@@ -46,9 +46,9 @@ selector: "initialize",
 category: 'initialization',
 fn: function (){
 var self=this;
-smalltalk.send(self,"_initialize",[],smalltalk.Widget);
+return smalltalk.withContext(function($ctx) { smalltalk.Widget.fn.prototype._initialize.apply(_st(self), []);
 self["@count"]=(0);
-return self},
+return self}, self, "initialize", [], smalltalk.Counter)},
 args: [],
 source: "initialize\x0a    super initialize.\x0a    count := 0",
 messageSends: ["initialize"],
@@ -63,22 +63,22 @@ selector: "renderOn:",
 category: 'rendering',
 fn: function (html){
 var self=this;
-var $1,$2,$3,$4,$5,$6;
-$1=smalltalk.send(html,"_h1",[]);
-smalltalk.send($1,"_with_",[smalltalk.send(self["@count"],"_asString",[])]);
-$2=smalltalk.send($1,"_yourself",[]);
+return smalltalk.withContext(function($ctx) { var $1,$2,$3,$4,$5,$6;
+$1=_st(html)._h1();
+_st($1)._with_(_st(self["@count"])._asString());
+$2=_st($1)._yourself();
 self["@header"]=$2;
-$3=smalltalk.send(html,"_button",[]);
-smalltalk.send($3,"_with_",["++"]);
-$4=smalltalk.send($3,"_onClick_",[(function(){
-return smalltalk.send(self,"_increase",[]);
-})]);
-$5=smalltalk.send(html,"_button",[]);
-smalltalk.send($5,"_with_",["--"]);
-$6=smalltalk.send($5,"_onClick_",[(function(){
-return smalltalk.send(self,"_decrease",[]);
-})]);
-return self},
+$3=_st(html)._button();
+_st($3)._with_("++");
+$4=_st($3)._onClick_((function(){
+return _st(self)._increase();
+}));
+$5=_st(html)._button();
+_st($5)._with_("--");
+$6=_st($5)._onClick_((function(){
+return _st(self)._decrease();
+}));
+return self}, self, "renderOn:", [html], smalltalk.Counter)},
 args: ["html"],
 source: "renderOn: html\x0a    header := html h1 \x0a\x09with: count asString;\x0a\x09yourself.\x0a    html button\x0a\x09with: '++';\x0a\x09onClick: [self increase].\x0a    html button\x0a\x09with: '--';\x0a\x09onClick: [self decrease]",
 messageSends: ["with:", "asString", "h1", "yourself", "button", "onClick:", "increase", "decrease"],
@@ -94,8 +94,8 @@ selector: "tryExample",
 category: 'example',
 fn: function (){
 var self=this;
-smalltalk.send(smalltalk.send(self,"_new",[]),"_appendToJQuery_",[smalltalk.send("body","_asJQuery",[])]);
-return self},
+return smalltalk.withContext(function($ctx) { _st(_st(self)._new())._appendToJQuery_(_st("body")._asJQuery());
+return self}, self, "tryExample", [], smalltalk.Counter.klass)},
 args: [],
 source: "tryExample\x0a\x09\x22In order to play with the Counter, just select the\x0a\x09doit below and press the Do it button. Then take a\x0a\x09look in the HTML document above the IDE.\x22\x0a\x0a\x09\x22Counter tryExample\x22\x0a        self new appendToJQuery: 'body' asJQuery",
 messageSends: ["appendToJQuery:", "asJQuery", "new"],

文件差异内容过多而无法显示
+ 359 - 337
js/IDE.deploy.js


文件差异内容过多而无法显示
+ 359 - 337
js/IDE.js


+ 296 - 296
js/Importer-Exporter.deploy.js

@@ -6,34 +6,34 @@ smalltalk.method({
 selector: "nextChunk",
 fn: function (){
 var self=this;
-var $1,$2,$3;
+return smalltalk.withContext(function($ctx) { var $1,$2,$3;
 var $early={};
 try {
 var char_;
 var result;
 var chunk;
-result=smalltalk.send("","_writeStream",[]);
-smalltalk.send((function(){
-char_=smalltalk.send(self["@stream"],"_next",[]);
+result=_st("")._writeStream();
+_st((function(){
+char_=_st(self["@stream"])._next();
 char_;
-return smalltalk.send(char_,"_notNil",[]);
-}),"_whileTrue_",[(function(){
-$1=smalltalk.send(char_,"__eq",["!"]);
+return _st(char_)._notNil();
+}))._whileTrue_((function(){
+$1=_st(char_).__eq("!");
 if(smalltalk.assert($1)){
-$2=smalltalk.send(smalltalk.send(self["@stream"],"_peek",[]),"__eq",["!"]);
+$2=_st(_st(self["@stream"])._peek()).__eq("!");
 if(smalltalk.assert($2)){
-smalltalk.send(self["@stream"],"_next",[]);
+_st(self["@stream"])._next();
 } else {
-$3=smalltalk.send(smalltalk.send(result,"_contents",[]),"_trimBoth",[]);
+$3=_st(_st(result)._contents())._trimBoth();
 throw $early=[$3];
 };
 };
-return smalltalk.send(result,"_nextPut_",[char_]);
-})]);
+return _st(result)._nextPut_(char_);
+}));
 return nil;
 }
 catch(e) {if(e===$early)return e[0]; throw e}
-}
+}, self, "nextChunk", [], smalltalk.ChunkParser)}
 }),
 smalltalk.ChunkParser);
 
@@ -43,8 +43,8 @@ smalltalk.method({
 selector: "stream:",
 fn: function (aStream){
 var self=this;
-self["@stream"]=aStream;
-return self}
+return smalltalk.withContext(function($ctx) { self["@stream"]=aStream;
+return self}, self, "stream:", [aStream], smalltalk.ChunkParser)}
 }),
 smalltalk.ChunkParser);
 
@@ -55,10 +55,10 @@ smalltalk.method({
 selector: "on:",
 fn: function (aStream){
 var self=this;
-var $1;
-$1=smalltalk.send(smalltalk.send(self,"_new",[]),"_stream_",[aStream]);
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st(_st(self)._new())._stream_(aStream);
 return $1;
-}
+}, self, "on:", [aStream], smalltalk.ChunkParser.klass)}
 }),
 smalltalk.ChunkParser.klass);
 
@@ -70,20 +70,20 @@ smalltalk.method({
 selector: "classNameFor:",
 fn: function (aClass){
 var self=this;
-var $2,$3,$1;
-$2=smalltalk.send(aClass,"_isMetaclass",[]);
+return smalltalk.withContext(function($ctx) { var $2,$3,$1;
+$2=_st(aClass)._isMetaclass();
 if(smalltalk.assert($2)){
-$1=smalltalk.send(smalltalk.send(smalltalk.send(aClass,"_instanceClass",[]),"_name",[]),"__comma",[".klass"]);
+$1=_st(_st(_st(aClass)._instanceClass())._name()).__comma(".klass");
 } else {
-$3=smalltalk.send(aClass,"_isNil",[]);
+$3=_st(aClass)._isNil();
 if(smalltalk.assert($3)){
 $1="nil";
 } else {
-$1=smalltalk.send(aClass,"_name",[]);
+$1=_st(aClass)._name();
 };
 };
 return $1;
-}
+}, self, "classNameFor:", [aClass], smalltalk.Exporter)}
 }),
 smalltalk.Exporter);
 
@@ -93,14 +93,14 @@ smalltalk.method({
 selector: "exportAll",
 fn: function (){
 var self=this;
-var $1;
-$1=smalltalk.send((smalltalk.String || String),"_streamContents_",[(function(stream){
-return smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk),"_current",[]),"_packages",[]),"_do_",[(function(pkg){
-return smalltalk.send(stream,"_nextPutAll_",[smalltalk.send(self,"_exportPackage_",[smalltalk.send(pkg,"_name",[])])]);
-})]);
-})]);
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st((smalltalk.String || String))._streamContents_((function(stream){
+return _st(_st(_st((smalltalk.Smalltalk || Smalltalk))._current())._packages())._do_((function(pkg){
+return _st(stream)._nextPutAll_(_st(self)._exportPackage_(_st(pkg)._name()));
+}));
+}));
 return $1;
-}
+}, self, "exportAll", [], smalltalk.Exporter)}
 }),
 smalltalk.Exporter);
 
@@ -110,15 +110,15 @@ smalltalk.method({
 selector: "exportClass:",
 fn: function (aClass){
 var self=this;
-var $1;
-$1=smalltalk.send((smalltalk.String || String),"_streamContents_",[(function(stream){
-smalltalk.send(self,"_exportDefinitionOf_on_",[aClass,stream]);
-smalltalk.send(self,"_exportMethodsOf_on_",[aClass,stream]);
-smalltalk.send(self,"_exportMetaDefinitionOf_on_",[aClass,stream]);
-return smalltalk.send(self,"_exportMethodsOf_on_",[smalltalk.send(aClass,"_class",[]),stream]);
-})]);
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st((smalltalk.String || String))._streamContents_((function(stream){
+_st(self)._exportDefinitionOf_on_(aClass,stream);
+_st(self)._exportMethodsOf_on_(aClass,stream);
+_st(self)._exportMetaDefinitionOf_on_(aClass,stream);
+return _st(self)._exportMethodsOf_on_(_st(aClass)._class(),stream);
+}));
 return $1;
-}
+}, self, "exportClass:", [aClass], smalltalk.Exporter)}
 }),
 smalltalk.Exporter);
 
@@ -128,30 +128,30 @@ smalltalk.method({
 selector: "exportDefinitionOf:on:",
 fn: function (aClass,aStream){
 var self=this;
-var $1,$2,$3,$4;
-smalltalk.send(aStream,"_nextPutAll_",["smalltalk.addClass("]);
-smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send("'","__comma",[smalltalk.send(self,"_classNameFor_",[aClass])]),"__comma",["', "])]);
-smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send("smalltalk.","__comma",[smalltalk.send(self,"_classNameFor_",[smalltalk.send(aClass,"_superclass",[])])])]);
-$1=smalltalk.send(aStream,"_nextPutAll_",[", ["]);
-smalltalk.send(smalltalk.send(aClass,"_instanceVariableNames",[]),"_do_separatedBy_",[(function(each){
-return smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send("'","__comma",[each]),"__comma",["'"])]);
+return smalltalk.withContext(function($ctx) { var $1,$2,$3,$4;
+_st(aStream)._nextPutAll_("smalltalk.addClass(");
+_st(aStream)._nextPutAll_(_st(_st("'").__comma(_st(self)._classNameFor_(aClass))).__comma("', "));
+_st(aStream)._nextPutAll_(_st("smalltalk.").__comma(_st(self)._classNameFor_(_st(aClass)._superclass())));
+$1=_st(aStream)._nextPutAll_(", [");
+_st(_st(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
+return _st(aStream)._nextPutAll_(_st(_st("'").__comma(each)).__comma("'"));
 }),(function(){
-return smalltalk.send(aStream,"_nextPutAll_",[", "]);
-})]);
-smalltalk.send(aStream,"_nextPutAll_",["], '"]);
-smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send(aClass,"_category",[]),"__comma",["'"])]);
-$2=smalltalk.send(aStream,"_nextPutAll_",[");"]);
-$3=smalltalk.send(smalltalk.send(aClass,"_comment",[]),"_notEmpty",[]);
+return _st(aStream)._nextPutAll_(", ");
+}));
+_st(aStream)._nextPutAll_("], '");
+_st(aStream)._nextPutAll_(_st(_st(aClass)._category()).__comma("'"));
+$2=_st(aStream)._nextPutAll_(");");
+$3=_st(_st(aClass)._comment())._notEmpty();
 if(smalltalk.assert($3)){
-smalltalk.send(aStream,"_lf",[]);
-smalltalk.send(aStream,"_nextPutAll_",["smalltalk."]);
-smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(self,"_classNameFor_",[aClass])]);
-smalltalk.send(aStream,"_nextPutAll_",[".comment="]);
-$4=smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send(aClass,"_comment",[]),"_asJavascript",[])]);
+_st(aStream)._lf();
+_st(aStream)._nextPutAll_("smalltalk.");
+_st(aStream)._nextPutAll_(_st(self)._classNameFor_(aClass));
+_st(aStream)._nextPutAll_(".comment=");
+$4=_st(aStream)._nextPutAll_(_st(_st(aClass)._comment())._asJavascript());
 $4;
 };
-smalltalk.send(aStream,"_lf",[]);
-return self}
+_st(aStream)._lf();
+return self}, self, "exportDefinitionOf:on:", [aClass,aStream], smalltalk.Exporter)}
 }),
 smalltalk.Exporter);
 
@@ -161,20 +161,20 @@ smalltalk.method({
 selector: "exportMetaDefinitionOf:on:",
 fn: function (aClass,aStream){
 var self=this;
-var $1,$2;
-$1=smalltalk.send(smalltalk.send(smalltalk.send(aClass,"_class",[]),"_instanceVariableNames",[]),"_isEmpty",[]);
+return smalltalk.withContext(function($ctx) { var $1,$2;
+$1=_st(_st(_st(aClass)._class())._instanceVariableNames())._isEmpty();
 if(! smalltalk.assert($1)){
-smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send("smalltalk.","__comma",[smalltalk.send(self,"_classNameFor_",[smalltalk.send(aClass,"_class",[])])])]);
-$2=smalltalk.send(aStream,"_nextPutAll_",[".iVarNames = ["]);
+_st(aStream)._nextPutAll_(_st("smalltalk.").__comma(_st(self)._classNameFor_(_st(aClass)._class())));
+$2=_st(aStream)._nextPutAll_(".iVarNames = [");
 $2;
-smalltalk.send(smalltalk.send(smalltalk.send(aClass,"_class",[]),"_instanceVariableNames",[]),"_do_separatedBy_",[(function(each){
-return smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send("'","__comma",[each]),"__comma",["'"])]);
+_st(_st(_st(aClass)._class())._instanceVariableNames())._do_separatedBy_((function(each){
+return _st(aStream)._nextPutAll_(_st(_st("'").__comma(each)).__comma("'"));
 }),(function(){
-return smalltalk.send(aStream,"_nextPutAll_",[","]);
-})]);
-smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send("];","__comma",[smalltalk.send((smalltalk.String || String),"_lf",[])])]);
+return _st(aStream)._nextPutAll_(",");
+}));
+_st(aStream)._nextPutAll_(_st("];").__comma(_st((smalltalk.String || String))._lf()));
 };
-return self}
+return self}, self, "exportMetaDefinitionOf:on:", [aClass,aStream], smalltalk.Exporter)}
 }),
 smalltalk.Exporter);
 
@@ -184,34 +184,34 @@ smalltalk.method({
 selector: "exportMethod:of:on:",
 fn: function (aMethod,aClass,aStream){
 var self=this;
-var $1,$2;
-smalltalk.send(aStream,"_nextPutAll_",["smalltalk.addMethod("]);
-smalltalk.send(aStream,"_lf",[]);
-smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aMethod,"_selector",[]),"_asSelector",[]),"_asJavascript",[]),"__comma",[","])]);
-smalltalk.send(aStream,"_lf",[]);
-smalltalk.send(aStream,"_nextPutAll_",["smalltalk.method({"]);
-smalltalk.send(aStream,"_lf",[]);
-smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send("selector: ","__comma",[smalltalk.send(smalltalk.send(aMethod,"_selector",[]),"_asJavascript",[])]),"__comma",[","])]);
-smalltalk.send(aStream,"_lf",[]);
-smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send("category: '","__comma",[smalltalk.send(aMethod,"_category",[])]),"__comma",["',"])]);
-smalltalk.send(aStream,"_lf",[]);
-smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send("fn: ","__comma",[smalltalk.send(smalltalk.send(aMethod,"_fn",[]),"_compiledSource",[])]),"__comma",[","])]);
-smalltalk.send(aStream,"_lf",[]);
-smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send("args: ","__comma",[smalltalk.send(smalltalk.send(aMethod,"_arguments",[]),"_asJavascript",[])]),"__comma",[","])]);
-smalltalk.send(aStream,"_lf",[]);
-smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send("source: ","__comma",[smalltalk.send(smalltalk.send(aMethod,"_source",[]),"_asJavascript",[])]),"__comma",[","])]);
-smalltalk.send(aStream,"_lf",[]);
-smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send("messageSends: ","__comma",[smalltalk.send(smalltalk.send(aMethod,"_messageSends",[]),"_asJavascript",[])]),"__comma",[","])]);
-smalltalk.send(aStream,"_lf",[]);
-$1=smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send("referencedClasses: ","__comma",[smalltalk.send(smalltalk.send(aMethod,"_referencedClasses",[]),"_asJavascript",[])])]);
-smalltalk.send(aStream,"_lf",[]);
-smalltalk.send(aStream,"_nextPutAll_",["}),"]);
-smalltalk.send(aStream,"_lf",[]);
-smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send("smalltalk.","__comma",[smalltalk.send(self,"_classNameFor_",[aClass])])]);
-smalltalk.send(aStream,"_nextPutAll_",[");"]);
-smalltalk.send(aStream,"_lf",[]);
-$2=smalltalk.send(aStream,"_lf",[]);
-return self}
+return smalltalk.withContext(function($ctx) { var $1,$2;
+_st(aStream)._nextPutAll_("smalltalk.addMethod(");
+_st(aStream)._lf();
+_st(aStream)._nextPutAll_(_st(_st(_st(_st(aMethod)._selector())._asSelector())._asJavascript()).__comma(","));
+_st(aStream)._lf();
+_st(aStream)._nextPutAll_("smalltalk.method({");
+_st(aStream)._lf();
+_st(aStream)._nextPutAll_(_st(_st("selector: ").__comma(_st(_st(aMethod)._selector())._asJavascript())).__comma(","));
+_st(aStream)._lf();
+_st(aStream)._nextPutAll_(_st(_st("category: '").__comma(_st(aMethod)._category())).__comma("',"));
+_st(aStream)._lf();
+_st(aStream)._nextPutAll_(_st(_st("fn: ").__comma(_st(_st(aMethod)._fn())._compiledSource())).__comma(","));
+_st(aStream)._lf();
+_st(aStream)._nextPutAll_(_st(_st("args: ").__comma(_st(_st(aMethod)._arguments())._asJavascript())).__comma(","));
+_st(aStream)._lf();
+_st(aStream)._nextPutAll_(_st(_st("source: ").__comma(_st(_st(aMethod)._source())._asJavascript())).__comma(","));
+_st(aStream)._lf();
+_st(aStream)._nextPutAll_(_st(_st("messageSends: ").__comma(_st(_st(aMethod)._messageSends())._asJavascript())).__comma(","));
+_st(aStream)._lf();
+$1=_st(aStream)._nextPutAll_(_st("referencedClasses: ").__comma(_st(_st(aMethod)._referencedClasses())._asJavascript()));
+_st(aStream)._lf();
+_st(aStream)._nextPutAll_("}),");
+_st(aStream)._lf();
+_st(aStream)._nextPutAll_(_st("smalltalk.").__comma(_st(self)._classNameFor_(aClass)));
+_st(aStream)._nextPutAll_(");");
+_st(aStream)._lf();
+$2=_st(aStream)._lf();
+return self}, self, "exportMethod:of:on:", [aMethod,aClass,aStream], smalltalk.Exporter)}
 }),
 smalltalk.Exporter);
 
@@ -221,17 +221,17 @@ smalltalk.method({
 selector: "exportMethodsOf:on:",
 fn: function (aClass,aStream){
 var self=this;
-var $1;
-smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aClass,"_methodDictionary",[]),"_values",[]),"_sorted_",[(function(a,b){
-return smalltalk.send(smalltalk.send(a,"_selector",[]),"__lt_eq",[smalltalk.send(b,"_selector",[])]);
-})]),"_do_",[(function(each){
-$1=smalltalk.send(smalltalk.send(each,"_category",[]),"_match_",["^\x5c*"]);
+return smalltalk.withContext(function($ctx) { var $1;
+_st(_st(_st(_st(aClass)._methodDictionary())._values())._sorted_((function(a,b){
+return _st(_st(a)._selector()).__lt_eq(_st(b)._selector());
+})))._do_((function(each){
+$1=_st(_st(each)._category())._match_("^\x5c*");
 if(! smalltalk.assert($1)){
-return smalltalk.send(self,"_exportMethod_of_on_",[each,aClass,aStream]);
+return _st(self)._exportMethod_of_on_(each,aClass,aStream);
 };
-})]);
-smalltalk.send(aStream,"_lf",[]);
-return self}
+}));
+_st(aStream)._lf();
+return self}, self, "exportMethodsOf:on:", [aClass,aStream], smalltalk.Exporter)}
 }),
 smalltalk.Exporter);
 
@@ -241,19 +241,19 @@ smalltalk.method({
 selector: "exportPackage:",
 fn: function (packageName){
 var self=this;
-var $1;
+return smalltalk.withContext(function($ctx) { var $1;
 var package;
-$1=smalltalk.send((smalltalk.String || String),"_streamContents_",[(function(stream){
-package=smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk),"_current",[]),"_packageAt_",[packageName]);
+$1=_st((smalltalk.String || String))._streamContents_((function(stream){
+package=_st(_st((smalltalk.Smalltalk || Smalltalk))._current())._packageAt_(packageName);
 package;
-smalltalk.send(self,"_exportPackageDefinitionOf_on_",[package,stream]);
-smalltalk.send(smalltalk.send(smalltalk.send(package,"_sortedClasses",[]),"_asSet",[]),"_do_",[(function(each){
-return smalltalk.send(stream,"_nextPutAll_",[smalltalk.send(self,"_exportClass_",[each])]);
-})]);
-return smalltalk.send(self,"_exportPackageExtensionsOf_on_",[package,stream]);
-})]);
+_st(self)._exportPackageDefinitionOf_on_(package,stream);
+_st(_st(_st(package)._sortedClasses())._asSet())._do_((function(each){
+return _st(stream)._nextPutAll_(_st(self)._exportClass_(each));
+}));
+return _st(self)._exportPackageExtensionsOf_on_(package,stream);
+}));
 return $1;
-}
+}, self, "exportPackage:", [packageName], smalltalk.Exporter)}
 }),
 smalltalk.Exporter);
 
@@ -263,11 +263,11 @@ smalltalk.method({
 selector: "exportPackageDefinitionOf:on:",
 fn: function (package,aStream){
 var self=this;
-var $1;
-smalltalk.send(aStream,"_nextPutAll_",["smalltalk.addPackage("]);
-$1=smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send("'","__comma",[smalltalk.send(package,"_name",[])]),"__comma",["', "]),"__comma",[smalltalk.send(package,"_propertiesAsJSON",[])]),"__comma",[");"])]);
-smalltalk.send(aStream,"_lf",[]);
-return self}
+return smalltalk.withContext(function($ctx) { var $1;
+_st(aStream)._nextPutAll_("smalltalk.addPackage(");
+$1=_st(aStream)._nextPutAll_(_st(_st(_st(_st("'").__comma(_st(package)._name())).__comma("', ")).__comma(_st(package)._propertiesAsJSON())).__comma(");"));
+_st(aStream)._lf();
+return self}, self, "exportPackageDefinitionOf:on:", [package,aStream], smalltalk.Exporter)}
 }),
 smalltalk.Exporter);
 
@@ -277,22 +277,22 @@ smalltalk.method({
 selector: "exportPackageExtensionsOf:on:",
 fn: function (package,aStream){
 var self=this;
-var $1;
+return smalltalk.withContext(function($ctx) { var $1;
 var name;
-name=smalltalk.send(package,"_name",[]);
-smalltalk.send(smalltalk.send((smalltalk.Package || Package),"_sortedClasses_",[smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk),"_current",[]),"_classes",[])]),"_do_",[(function(each){
-return smalltalk.send([each,smalltalk.send(each,"_class",[])],"_do_",[(function(aClass){
-return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aClass,"_methodDictionary",[]),"_values",[]),"_sorted_",[(function(a,b){
-return smalltalk.send(smalltalk.send(a,"_selector",[]),"__lt_eq",[smalltalk.send(b,"_selector",[])]);
-})]),"_do_",[(function(method){
-$1=smalltalk.send(smalltalk.send(method,"_category",[]),"_match_",[smalltalk.send("^\x5c*","__comma",[name])]);
+name=_st(package)._name();
+_st(_st((smalltalk.Package || Package))._sortedClasses_(_st(_st((smalltalk.Smalltalk || Smalltalk))._current())._classes()))._do_((function(each){
+return _st([each,_st(each)._class()])._do_((function(aClass){
+return _st(_st(_st(_st(aClass)._methodDictionary())._values())._sorted_((function(a,b){
+return _st(_st(a)._selector()).__lt_eq(_st(b)._selector());
+})))._do_((function(method){
+$1=_st(_st(method)._category())._match_(_st("^\x5c*").__comma(name));
 if(smalltalk.assert($1)){
-return smalltalk.send(self,"_exportMethod_of_on_",[method,aClass,aStream]);
+return _st(self)._exportMethod_of_on_(method,aClass,aStream);
 };
-})]);
-})]);
-})]);
-return self}
+}));
+}));
+}));
+return self}, self, "exportPackageExtensionsOf:on:", [package,aStream], smalltalk.Exporter)}
 }),
 smalltalk.Exporter);
 
@@ -305,10 +305,10 @@ smalltalk.method({
 selector: "chunkEscape:",
 fn: function (aString){
 var self=this;
-var $1;
-$1=smalltalk.send(smalltalk.send(aString,"_replace_with_",["!","!!"]),"_trimBoth",[]);
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st(_st(aString)._replace_with_("!","!!"))._trimBoth();
 return $1;
-}
+}, self, "chunkEscape:", [aString], smalltalk.ChunkExporter)}
 }),
 smalltalk.ChunkExporter);
 
@@ -318,20 +318,20 @@ smalltalk.method({
 selector: "classNameFor:",
 fn: function (aClass){
 var self=this;
-var $2,$3,$1;
-$2=smalltalk.send(aClass,"_isMetaclass",[]);
+return smalltalk.withContext(function($ctx) { var $2,$3,$1;
+$2=_st(aClass)._isMetaclass();
 if(smalltalk.assert($2)){
-$1=smalltalk.send(smalltalk.send(smalltalk.send(aClass,"_instanceClass",[]),"_name",[]),"__comma",[" class"]);
+$1=_st(_st(_st(aClass)._instanceClass())._name()).__comma(" class");
 } else {
-$3=smalltalk.send(aClass,"_isNil",[]);
+$3=_st(aClass)._isNil();
 if(smalltalk.assert($3)){
 $1="nil";
 } else {
-$1=smalltalk.send(aClass,"_name",[]);
+$1=_st(aClass)._name();
 };
 };
 return $1;
-}
+}, self, "classNameFor:", [aClass], smalltalk.ChunkExporter)}
 }),
 smalltalk.ChunkExporter);
 
@@ -341,30 +341,30 @@ smalltalk.method({
 selector: "exportDefinitionOf:on:",
 fn: function (aClass,aStream){
 var self=this;
-var $1,$2,$3,$4;
-smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(self,"_classNameFor_",[smalltalk.send(aClass,"_superclass",[])])]);
-smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(" subclass: #","__comma",[smalltalk.send(self,"_classNameFor_",[aClass])])]);
-smalltalk.send(aStream,"_lf",[]);
-$1=smalltalk.send(aStream,"_nextPutAll_",["\x09instanceVariableNames: '"]);
-smalltalk.send(smalltalk.send(aClass,"_instanceVariableNames",[]),"_do_separatedBy_",[(function(each){
-return smalltalk.send(aStream,"_nextPutAll_",[each]);
+return smalltalk.withContext(function($ctx) { var $1,$2,$3,$4;
+_st(aStream)._nextPutAll_(_st(self)._classNameFor_(_st(aClass)._superclass()));
+_st(aStream)._nextPutAll_(_st(" subclass: #").__comma(_st(self)._classNameFor_(aClass)));
+_st(aStream)._lf();
+$1=_st(aStream)._nextPutAll_("\x09instanceVariableNames: '");
+_st(_st(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
+return _st(aStream)._nextPutAll_(each);
 }),(function(){
-return smalltalk.send(aStream,"_nextPutAll_",[" "]);
-})]);
-smalltalk.send(aStream,"_nextPutAll_",["'"]);
-smalltalk.send(aStream,"_lf",[]);
-smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send("\x09package: '","__comma",[smalltalk.send(aClass,"_category",[])]),"__comma",["'!"])]);
-$2=smalltalk.send(aStream,"_lf",[]);
-$3=smalltalk.send(smalltalk.send(aClass,"_comment",[]),"_notEmpty",[]);
+return _st(aStream)._nextPutAll_(" ");
+}));
+_st(aStream)._nextPutAll_("'");
+_st(aStream)._lf();
+_st(aStream)._nextPutAll_(_st(_st("\x09package: '").__comma(_st(aClass)._category())).__comma("'!"));
+$2=_st(aStream)._lf();
+$3=_st(_st(aClass)._comment())._notEmpty();
 if(smalltalk.assert($3)){
-smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send("!","__comma",[smalltalk.send(self,"_classNameFor_",[aClass])]),"__comma",[" commentStamp!"])]);
-smalltalk.send(aStream,"_lf",[]);
-smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send(self,"_chunkEscape_",[smalltalk.send(aClass,"_comment",[])]),"__comma",["!"])]);
-$4=smalltalk.send(aStream,"_lf",[]);
+_st(aStream)._nextPutAll_(_st(_st("!").__comma(_st(self)._classNameFor_(aClass))).__comma(" commentStamp!"));
+_st(aStream)._lf();
+_st(aStream)._nextPutAll_(_st(_st(self)._chunkEscape_(_st(aClass)._comment())).__comma("!"));
+$4=_st(aStream)._lf();
 $4;
 };
-smalltalk.send(aStream,"_lf",[]);
-return self}
+_st(aStream)._lf();
+return self}, self, "exportDefinitionOf:on:", [aClass,aStream], smalltalk.ChunkExporter)}
 }),
 smalltalk.ChunkExporter);
 
@@ -374,23 +374,23 @@ smalltalk.method({
 selector: "exportMetaDefinitionOf:on:",
 fn: function (aClass,aStream){
 var self=this;
-var $1,$2,$3;
-$1=smalltalk.send(smalltalk.send(smalltalk.send(aClass,"_class",[]),"_instanceVariableNames",[]),"_isEmpty",[]);
+return smalltalk.withContext(function($ctx) { var $1,$2,$3;
+$1=_st(_st(_st(aClass)._class())._instanceVariableNames())._isEmpty();
 if(! smalltalk.assert($1)){
-smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(self,"_classNameFor_",[smalltalk.send(aClass,"_class",[])])]);
-$2=smalltalk.send(aStream,"_nextPutAll_",[" instanceVariableNames: '"]);
+_st(aStream)._nextPutAll_(_st(self)._classNameFor_(_st(aClass)._class()));
+$2=_st(aStream)._nextPutAll_(" instanceVariableNames: '");
 $2;
-smalltalk.send(smalltalk.send(smalltalk.send(aClass,"_class",[]),"_instanceVariableNames",[]),"_do_separatedBy_",[(function(each){
-return smalltalk.send(aStream,"_nextPutAll_",[each]);
+_st(_st(_st(aClass)._class())._instanceVariableNames())._do_separatedBy_((function(each){
+return _st(aStream)._nextPutAll_(each);
 }),(function(){
-return smalltalk.send(aStream,"_nextPutAll_",[" "]);
-})]);
-smalltalk.send(aStream,"_nextPutAll_",["'!"]);
-smalltalk.send(aStream,"_lf",[]);
-$3=smalltalk.send(aStream,"_lf",[]);
+return _st(aStream)._nextPutAll_(" ");
+}));
+_st(aStream)._nextPutAll_("'!");
+_st(aStream)._lf();
+$3=_st(aStream)._lf();
 $3;
 };
-return self}
+return self}, self, "exportMetaDefinitionOf:on:", [aClass,aStream], smalltalk.ChunkExporter)}
 }),
 smalltalk.ChunkExporter);
 
@@ -400,13 +400,13 @@ smalltalk.method({
 selector: "exportMethod:of:on:",
 fn: function (aMethod,aClass,aStream){
 var self=this;
-var $1;
-smalltalk.send(aStream,"_lf",[]);
-smalltalk.send(aStream,"_lf",[]);
-smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(self,"_chunkEscape_",[smalltalk.send(aMethod,"_source",[])])]);
-smalltalk.send(aStream,"_lf",[]);
-$1=smalltalk.send(aStream,"_nextPutAll_",["!"]);
-return self}
+return smalltalk.withContext(function($ctx) { var $1;
+_st(aStream)._lf();
+_st(aStream)._lf();
+_st(aStream)._nextPutAll_(_st(self)._chunkEscape_(_st(aMethod)._source()));
+_st(aStream)._lf();
+$1=_st(aStream)._nextPutAll_("!");
+return self}, self, "exportMethod:of:on:", [aMethod,aClass,aStream], smalltalk.ChunkExporter)}
 }),
 smalltalk.ChunkExporter);
 
@@ -416,18 +416,18 @@ smalltalk.method({
 selector: "exportMethods:category:of:on:",
 fn: function (methods,category,aClass,aStream){
 var self=this;
-var $1,$2;
-smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send("!","__comma",[smalltalk.send(self,"_classNameFor_",[aClass])])]);
-$1=smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send(" methodsFor: '","__comma",[category]),"__comma",["'!"])]);
-smalltalk.send(smalltalk.send(methods,"_sorted_",[(function(a,b){
-return smalltalk.send(smalltalk.send(a,"_selector",[]),"__lt_eq",[smalltalk.send(b,"_selector",[])]);
-})]),"_do_",[(function(each){
-return smalltalk.send(self,"_exportMethod_of_on_",[each,aClass,aStream]);
-})]);
-smalltalk.send(aStream,"_nextPutAll_",[" !"]);
-smalltalk.send(aStream,"_lf",[]);
-$2=smalltalk.send(aStream,"_lf",[]);
-return self}
+return smalltalk.withContext(function($ctx) { var $1,$2;
+_st(aStream)._nextPutAll_(_st("!").__comma(_st(self)._classNameFor_(aClass)));
+$1=_st(aStream)._nextPutAll_(_st(_st(" methodsFor: '").__comma(category)).__comma("'!"));
+_st(_st(methods)._sorted_((function(a,b){
+return _st(_st(a)._selector()).__lt_eq(_st(b)._selector());
+})))._do_((function(each){
+return _st(self)._exportMethod_of_on_(each,aClass,aStream);
+}));
+_st(aStream)._nextPutAll_(" !");
+_st(aStream)._lf();
+$2=_st(aStream)._lf();
+return self}, self, "exportMethods:category:of:on:", [methods,category,aClass,aStream], smalltalk.ChunkExporter)}
 }),
 smalltalk.ChunkExporter);
 
@@ -437,24 +437,24 @@ smalltalk.method({
 selector: "exportMethodsOf:on:",
 fn: function (aClass,aStream){
 var self=this;
-var $1;
+return smalltalk.withContext(function($ctx) { var $1;
 var map;
-map=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
-smalltalk.send(aClass,"_protocolsDo_",[(function(category,methods){
-$1=smalltalk.send(category,"_match_",["^\x5c*"]);
+map=_st((smalltalk.Dictionary || Dictionary))._new();
+_st(aClass)._protocolsDo_((function(category,methods){
+$1=_st(category)._match_("^\x5c*");
 if(! smalltalk.assert($1)){
-return smalltalk.send(map,"_at_put_",[category,methods]);
+return _st(map)._at_put_(category,methods);
 };
-})]);
-smalltalk.send(smalltalk.send(smalltalk.send(map,"_keys",[]),"_sorted_",[(function(a,b){
-return smalltalk.send(a,"__lt_eq",[b]);
-})]),"_do_",[(function(category){
+}));
+_st(_st(_st(map)._keys())._sorted_((function(a,b){
+return _st(a).__lt_eq(b);
+})))._do_((function(category){
 var methods;
-methods=smalltalk.send(map,"_at_",[category]);
+methods=_st(map)._at_(category);
 methods;
-return smalltalk.send(self,"_exportMethods_category_of_on_",[methods,category,aClass,aStream]);
-})]);
-return self}
+return _st(self)._exportMethods_category_of_on_(methods,category,aClass,aStream);
+}));
+return self}, self, "exportMethodsOf:on:", [aClass,aStream], smalltalk.ChunkExporter)}
 }),
 smalltalk.ChunkExporter);
 
@@ -464,10 +464,10 @@ smalltalk.method({
 selector: "exportPackageDefinitionOf:on:",
 fn: function (package,aStream){
 var self=this;
-var $1;
-smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send("Smalltalk current createPackage: '","__comma",[smalltalk.send(package,"_name",[])]),"__comma",["' properties: "]),"__comma",[smalltalk.send(smalltalk.send(package,"_properties",[]),"_storeString",[])]),"__comma",["!"])]);
-$1=smalltalk.send(aStream,"_lf",[]);
-return self}
+return smalltalk.withContext(function($ctx) { var $1;
+_st(aStream)._nextPutAll_(_st(_st(_st(_st("Smalltalk current createPackage: '").__comma(_st(package)._name())).__comma("' properties: ")).__comma(_st(_st(package)._properties())._storeString())).__comma("!"));
+$1=_st(aStream)._lf();
+return self}, self, "exportPackageDefinitionOf:on:", [package,aStream], smalltalk.ChunkExporter)}
 }),
 smalltalk.ChunkExporter);
 
@@ -477,31 +477,31 @@ smalltalk.method({
 selector: "exportPackageExtensionsOf:on:",
 fn: function (package,aStream){
 var self=this;
-var $1;
+return smalltalk.withContext(function($ctx) { var $1;
 var name;
 var map;
-name=smalltalk.send(package,"_name",[]);
-smalltalk.send(smalltalk.send((smalltalk.Package || Package),"_sortedClasses_",[smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk),"_current",[]),"_classes",[])]),"_do_",[(function(each){
-return smalltalk.send([each,smalltalk.send(each,"_class",[])],"_do_",[(function(aClass){
-map=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
+name=_st(package)._name();
+_st(_st((smalltalk.Package || Package))._sortedClasses_(_st(_st((smalltalk.Smalltalk || Smalltalk))._current())._classes()))._do_((function(each){
+return _st([each,_st(each)._class()])._do_((function(aClass){
+map=_st((smalltalk.Dictionary || Dictionary))._new();
 map;
-smalltalk.send(aClass,"_protocolsDo_",[(function(category,methods){
-$1=smalltalk.send(category,"_match_",[smalltalk.send("^\x5c*","__comma",[name])]);
+_st(aClass)._protocolsDo_((function(category,methods){
+$1=_st(category)._match_(_st("^\x5c*").__comma(name));
 if(smalltalk.assert($1)){
-return smalltalk.send(map,"_at_put_",[category,methods]);
+return _st(map)._at_put_(category,methods);
 };
-})]);
-return smalltalk.send(smalltalk.send(smalltalk.send(map,"_keys",[]),"_sorted_",[(function(a,b){
-return smalltalk.send(a,"__lt_eq",[b]);
-})]),"_do_",[(function(category){
+}));
+return _st(_st(_st(map)._keys())._sorted_((function(a,b){
+return _st(a).__lt_eq(b);
+})))._do_((function(category){
 var methods;
-methods=smalltalk.send(map,"_at_",[category]);
+methods=_st(map)._at_(category);
 methods;
-return smalltalk.send(self,"_exportMethods_category_of_on_",[methods,category,aClass,aStream]);
-})]);
-})]);
-})]);
-return self}
+return _st(self)._exportMethods_category_of_on_(methods,category,aClass,aStream);
+}));
+}));
+}));
+return self}, self, "exportPackageExtensionsOf:on:", [package,aStream], smalltalk.ChunkExporter)}
 }),
 smalltalk.ChunkExporter);
 
@@ -514,21 +514,21 @@ smalltalk.method({
 selector: "exportDefinitionOf:on:",
 fn: function (aClass,aStream){
 var self=this;
-var $1,$2;
-smalltalk.send(aStream,"_nextPutAll_",["smalltalk.addClass("]);
-smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send("'","__comma",[smalltalk.send(self,"_classNameFor_",[aClass])]),"__comma",["', "])]);
-smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send("smalltalk.","__comma",[smalltalk.send(self,"_classNameFor_",[smalltalk.send(aClass,"_superclass",[])])])]);
-$1=smalltalk.send(aStream,"_nextPutAll_",[", ["]);
-smalltalk.send(smalltalk.send(aClass,"_instanceVariableNames",[]),"_do_separatedBy_",[(function(each){
-return smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send("'","__comma",[each]),"__comma",["'"])]);
+return smalltalk.withContext(function($ctx) { var $1,$2;
+_st(aStream)._nextPutAll_("smalltalk.addClass(");
+_st(aStream)._nextPutAll_(_st(_st("'").__comma(_st(self)._classNameFor_(aClass))).__comma("', "));
+_st(aStream)._nextPutAll_(_st("smalltalk.").__comma(_st(self)._classNameFor_(_st(aClass)._superclass())));
+$1=_st(aStream)._nextPutAll_(", [");
+_st(_st(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
+return _st(aStream)._nextPutAll_(_st(_st("'").__comma(each)).__comma("'"));
 }),(function(){
-return smalltalk.send(aStream,"_nextPutAll_",[", "]);
-})]);
-smalltalk.send(aStream,"_nextPutAll_",["], '"]);
-smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send(aClass,"_category",[]),"__comma",["'"])]);
-$2=smalltalk.send(aStream,"_nextPutAll_",[");"]);
-smalltalk.send(aStream,"_lf",[]);
-return self}
+return _st(aStream)._nextPutAll_(", ");
+}));
+_st(aStream)._nextPutAll_("], '");
+_st(aStream)._nextPutAll_(_st(_st(aClass)._category()).__comma("'"));
+$2=_st(aStream)._nextPutAll_(");");
+_st(aStream)._lf();
+return self}, self, "exportDefinitionOf:on:", [aClass,aStream], smalltalk.StrippedExporter)}
 }),
 smalltalk.StrippedExporter);
 
@@ -538,24 +538,24 @@ smalltalk.method({
 selector: "exportMethod:of:on:",
 fn: function (aMethod,aClass,aStream){
 var self=this;
-var $1;
-smalltalk.send(aStream,"_nextPutAll_",["smalltalk.addMethod("]);
-smalltalk.send(aStream,"_lf",[]);
-smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aMethod,"_selector",[]),"_asSelector",[]),"_asJavascript",[]),"__comma",[","])]);
-smalltalk.send(aStream,"_lf",[]);
-smalltalk.send(aStream,"_nextPutAll_",["smalltalk.method({"]);
-smalltalk.send(aStream,"_lf",[]);
-smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send("selector: ","__comma",[smalltalk.send(smalltalk.send(aMethod,"_selector",[]),"_asJavascript",[])]),"__comma",[","])]);
-smalltalk.send(aStream,"_lf",[]);
-smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send("fn: ","__comma",[smalltalk.send(smalltalk.send(aMethod,"_fn",[]),"_compiledSource",[])])]);
-smalltalk.send(aStream,"_lf",[]);
-smalltalk.send(aStream,"_nextPutAll_",["}),"]);
-smalltalk.send(aStream,"_lf",[]);
-smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send("smalltalk.","__comma",[smalltalk.send(self,"_classNameFor_",[aClass])])]);
-smalltalk.send(aStream,"_nextPutAll_",[");"]);
-smalltalk.send(aStream,"_lf",[]);
-$1=smalltalk.send(aStream,"_lf",[]);
-return self}
+return smalltalk.withContext(function($ctx) { var $1;
+_st(aStream)._nextPutAll_("smalltalk.addMethod(");
+_st(aStream)._lf();
+_st(aStream)._nextPutAll_(_st(_st(_st(_st(aMethod)._selector())._asSelector())._asJavascript()).__comma(","));
+_st(aStream)._lf();
+_st(aStream)._nextPutAll_("smalltalk.method({");
+_st(aStream)._lf();
+_st(aStream)._nextPutAll_(_st(_st("selector: ").__comma(_st(_st(aMethod)._selector())._asJavascript())).__comma(","));
+_st(aStream)._lf();
+_st(aStream)._nextPutAll_(_st("fn: ").__comma(_st(_st(aMethod)._fn())._compiledSource()));
+_st(aStream)._lf();
+_st(aStream)._nextPutAll_("}),");
+_st(aStream)._lf();
+_st(aStream)._nextPutAll_(_st("smalltalk.").__comma(_st(self)._classNameFor_(aClass)));
+_st(aStream)._nextPutAll_(");");
+_st(aStream)._lf();
+$1=_st(aStream)._lf();
+return self}, self, "exportMethod:of:on:", [aMethod,aClass,aStream], smalltalk.StrippedExporter)}
 }),
 smalltalk.StrippedExporter);
 
@@ -568,33 +568,33 @@ smalltalk.method({
 selector: "import:",
 fn: function (aStream){
 var self=this;
-var $1;
+return smalltalk.withContext(function($ctx) { var $1;
 var chunk;
 var result;
 var parser;
 var lastEmpty;
-parser=smalltalk.send((smalltalk.ChunkParser || ChunkParser),"_on_",[aStream]);
+parser=_st((smalltalk.ChunkParser || ChunkParser))._on_(aStream);
 lastEmpty=false;
-smalltalk.send((function(){
-chunk=smalltalk.send(parser,"_nextChunk",[]);
+_st((function(){
+chunk=_st(parser)._nextChunk();
 chunk;
-return smalltalk.send(chunk,"_isNil",[]);
-}),"_whileFalse_",[(function(){
-$1=smalltalk.send(chunk,"_isEmpty",[]);
+return _st(chunk)._isNil();
+}))._whileFalse_((function(){
+$1=_st(chunk)._isEmpty();
 if(smalltalk.assert($1)){
 lastEmpty=true;
 return lastEmpty;
 } else {
-result=smalltalk.send(smalltalk.send((smalltalk.Compiler || Compiler),"_new",[]),"_evaluateExpression_",[chunk]);
+result=_st(_st((smalltalk.Compiler || Compiler))._new())._evaluateExpression_(chunk);
 result;
 if(smalltalk.assert(lastEmpty)){
 lastEmpty=false;
 lastEmpty;
-return smalltalk.send(result,"_scanFrom_",[parser]);
+return _st(result)._scanFrom_(parser);
 };
 };
-})]);
-return self}
+}));
+return self}, self, "import:", [aStream], smalltalk.Importer)}
 }),
 smalltalk.Importer);
 
@@ -607,16 +607,16 @@ smalltalk.method({
 selector: "initializePackageNamed:prefix:",
 fn: function (packageName,aString){
 var self=this;
-var $1,$2;
-smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Package || Package),"_named_",[packageName]),"_classes",[]),"_do_",[(function(each){
+return smalltalk.withContext(function($ctx) { var $1,$2;
+_st(_st(_st((smalltalk.Package || Package))._named_(packageName))._classes())._do_((function(each){
 smalltalk.init(each);
 ;
-return smalltalk.send(each,"_initialize",[]);
-})]);
-$1=smalltalk.send((smalltalk.Package || Package),"_named_",[packageName]);
-smalltalk.send($1,"_commitPathJs_",[smalltalk.send(smalltalk.send("/","__comma",[aString]),"__comma",["/js"])]);
-$2=smalltalk.send($1,"_commitPathSt_",[smalltalk.send(smalltalk.send("/","__comma",[aString]),"__comma",["/st"])]);
-return self}
+return _st(each)._initialize();
+}));
+$1=_st((smalltalk.Package || Package))._named_(packageName);
+_st($1)._commitPathJs_(_st(_st("/").__comma(aString)).__comma("/js"));
+$2=_st($1)._commitPathSt_(_st(_st("/").__comma(aString)).__comma("/st"));
+return self}, self, "initializePackageNamed:prefix:", [packageName,aString], smalltalk.PackageLoader)}
 }),
 smalltalk.PackageLoader);
 
@@ -626,18 +626,18 @@ smalltalk.method({
 selector: "loadPackage:prefix:",
 fn: function (packageName,aString){
 var self=this;
-var $1;
+return smalltalk.withContext(function($ctx) { var $1;
 var url;
-url=smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send("/","__comma",[aString]),"__comma",["/js/"]),"__comma",[packageName]),"__comma",[".js"]);
-smalltalk.send(jQuery,"_ajax_options_",[url,smalltalk.HashedCollection._fromPairs_([smalltalk.send("type","__minus_gt",["GET"]),smalltalk.send("dataType","__minus_gt",["script"]),smalltalk.send("complete","__minus_gt",[(function(jqXHR,textStatus){
-$1=smalltalk.send(smalltalk.send(jqXHR,"_readyState",[]),"__eq",[(4)]);
+url=_st(_st(_st(_st("/").__comma(aString)).__comma("/js/")).__comma(packageName)).__comma(".js");
+_st(jQuery)._ajax_options_(url,smalltalk.HashedCollection._fromPairs_([_st("type").__minus_gt("GET"),_st("dataType").__minus_gt("script"),_st("complete").__minus_gt((function(jqXHR,textStatus){
+$1=_st(_st(jqXHR)._readyState()).__eq((4));
 if(smalltalk.assert($1)){
-return smalltalk.send(self,"_initializePackageNamed_prefix_",[packageName,aString]);
+return _st(self)._initializePackageNamed_prefix_(packageName,aString);
 };
-})]),smalltalk.send("error","__minus_gt",[(function(){
-return smalltalk.send(window,"_alert_",[smalltalk.send("Could not load package at:  ","__comma",[url])]);
-})])])]);
-return self}
+})),_st("error").__minus_gt((function(){
+return _st(window)._alert_(_st("Could not load package at:  ").__comma(url));
+}))]));
+return self}, self, "loadPackage:prefix:", [packageName,aString], smalltalk.PackageLoader)}
 }),
 smalltalk.PackageLoader);
 
@@ -647,10 +647,10 @@ smalltalk.method({
 selector: "loadPackages:prefix:",
 fn: function (aCollection,aString){
 var self=this;
-smalltalk.send(aCollection,"_do_",[(function(each){
-return smalltalk.send(self,"_loadPackage_prefix_",[each,aString]);
-})]);
-return self}
+return smalltalk.withContext(function($ctx) { _st(aCollection)._do_((function(each){
+return _st(self)._loadPackage_prefix_(each,aString);
+}));
+return self}, self, "loadPackages:prefix:", [aCollection,aString], smalltalk.PackageLoader)}
 }),
 smalltalk.PackageLoader);
 
@@ -661,10 +661,10 @@ smalltalk.method({
 selector: "loadPackages:prefix:",
 fn: function (aCollection,aString){
 var self=this;
-var $1;
-$1=smalltalk.send(smalltalk.send(self,"_new",[]),"_loadPackages_prefix_",[aCollection,aString]);
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st(_st(self)._new())._loadPackages_prefix_(aCollection,aString);
 return $1;
-}
+}, self, "loadPackages:prefix:", [aCollection,aString], smalltalk.PackageLoader.klass)}
 }),
 smalltalk.PackageLoader.klass);
 

+ 296 - 296
js/Importer-Exporter.js

@@ -7,34 +7,34 @@ selector: "nextChunk",
 category: 'reading',
 fn: function (){
 var self=this;
-var $1,$2,$3;
+return smalltalk.withContext(function($ctx) { var $1,$2,$3;
 var $early={};
 try {
 var char_;
 var result;
 var chunk;
-result=smalltalk.send("","_writeStream",[]);
-smalltalk.send((function(){
-char_=smalltalk.send(self["@stream"],"_next",[]);
+result=_st("")._writeStream();
+_st((function(){
+char_=_st(self["@stream"])._next();
 char_;
-return smalltalk.send(char_,"_notNil",[]);
-}),"_whileTrue_",[(function(){
-$1=smalltalk.send(char_,"__eq",["!"]);
+return _st(char_)._notNil();
+}))._whileTrue_((function(){
+$1=_st(char_).__eq("!");
 if(smalltalk.assert($1)){
-$2=smalltalk.send(smalltalk.send(self["@stream"],"_peek",[]),"__eq",["!"]);
+$2=_st(_st(self["@stream"])._peek()).__eq("!");
 if(smalltalk.assert($2)){
-smalltalk.send(self["@stream"],"_next",[]);
+_st(self["@stream"])._next();
 } else {
-$3=smalltalk.send(smalltalk.send(result,"_contents",[]),"_trimBoth",[]);
+$3=_st(_st(result)._contents())._trimBoth();
 throw $early=[$3];
 };
 };
-return smalltalk.send(result,"_nextPut_",[char_]);
-})]);
+return _st(result)._nextPut_(char_);
+}));
 return nil;
 }
 catch(e) {if(e===$early)return e[0]; throw e}
-},
+}, self, "nextChunk", [], smalltalk.ChunkParser)},
 args: [],
 source: "nextChunk\x0a\x09\x22The chunk format (Smalltalk Interchange Format or Fileout format)\x0a\x09is a trivial format but can be a bit tricky to understand:\x0a\x09\x09- Uses the exclamation mark as delimiter of chunks.\x0a\x09\x09- Inside a chunk a normal exclamation mark must be doubled.\x0a\x09\x09- A non empty chunk must be a valid Smalltalk expression.\x0a\x09\x09- A chunk on top level with a preceding empty chunk is an instruction chunk:\x0a\x09\x09\x09- The object created by the expression then takes over reading chunks.\x0a\x0a\x09This metod returns next chunk as a String (trimmed), empty String (all whitespace) or nil.\x22\x0a\x0a\x09| char result chunk |\x0a\x09result := '' writeStream.\x0a        [char := stream next.\x0a        char notNil] whileTrue: [\x0a                 char = '!' ifTrue: [\x0a                         stream peek = '!'\x0a                                ifTrue: [stream next \x22skipping the escape double\x22]\x0a                                ifFalse: [^result contents trimBoth  \x22chunk end marker found\x22]].\x0a                 result nextPut: char].\x0a\x09^nil \x22a chunk needs to end with !\x22",
 messageSends: ["writeStream", "whileTrue:", "ifTrue:", "ifTrue:ifFalse:", "next", "trimBoth", "contents", "=", "peek", "nextPut:", "notNil"],
@@ -49,8 +49,8 @@ selector: "stream:",
 category: 'accessing',
 fn: function (aStream){
 var self=this;
-self["@stream"]=aStream;
-return self},
+return smalltalk.withContext(function($ctx) { self["@stream"]=aStream;
+return self}, self, "stream:", [aStream], smalltalk.ChunkParser)},
 args: ["aStream"],
 source: "stream: aStream\x0a\x09stream := aStream",
 messageSends: [],
@@ -66,10 +66,10 @@ selector: "on:",
 category: 'not yet classified',
 fn: function (aStream){
 var self=this;
-var $1;
-$1=smalltalk.send(smalltalk.send(self,"_new",[]),"_stream_",[aStream]);
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st(_st(self)._new())._stream_(aStream);
 return $1;
-},
+}, self, "on:", [aStream], smalltalk.ChunkParser.klass)},
 args: ["aStream"],
 source: "on: aStream\x0a\x09^self new stream: aStream",
 messageSends: ["stream:", "new"],
@@ -86,20 +86,20 @@ selector: "classNameFor:",
 category: 'private',
 fn: function (aClass){
 var self=this;
-var $2,$3,$1;
-$2=smalltalk.send(aClass,"_isMetaclass",[]);
+return smalltalk.withContext(function($ctx) { var $2,$3,$1;
+$2=_st(aClass)._isMetaclass();
 if(smalltalk.assert($2)){
-$1=smalltalk.send(smalltalk.send(smalltalk.send(aClass,"_instanceClass",[]),"_name",[]),"__comma",[".klass"]);
+$1=_st(_st(_st(aClass)._instanceClass())._name()).__comma(".klass");
 } else {
-$3=smalltalk.send(aClass,"_isNil",[]);
+$3=_st(aClass)._isNil();
 if(smalltalk.assert($3)){
 $1="nil";
 } else {
-$1=smalltalk.send(aClass,"_name",[]);
+$1=_st(aClass)._name();
 };
 };
 return $1;
-},
+}, self, "classNameFor:", [aClass], smalltalk.Exporter)},
 args: ["aClass"],
 source: "classNameFor: aClass\x0a\x09^aClass isMetaclass\x0a\x09    ifTrue: [aClass instanceClass name, '.klass']\x0a\x09    ifFalse: [\x0a\x09\x09aClass isNil\x0a\x09\x09    ifTrue: ['nil']\x0a\x09\x09    ifFalse: [aClass name]]",
 messageSends: ["ifTrue:ifFalse:", ",", "name", "instanceClass", "isNil", "isMetaclass"],
@@ -114,14 +114,14 @@ selector: "exportAll",
 category: 'fileOut',
 fn: function (){
 var self=this;
-var $1;
-$1=smalltalk.send((smalltalk.String || String),"_streamContents_",[(function(stream){
-return smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk),"_current",[]),"_packages",[]),"_do_",[(function(pkg){
-return smalltalk.send(stream,"_nextPutAll_",[smalltalk.send(self,"_exportPackage_",[smalltalk.send(pkg,"_name",[])])]);
-})]);
-})]);
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st((smalltalk.String || String))._streamContents_((function(stream){
+return _st(_st(_st((smalltalk.Smalltalk || Smalltalk))._current())._packages())._do_((function(pkg){
+return _st(stream)._nextPutAll_(_st(self)._exportPackage_(_st(pkg)._name()));
+}));
+}));
 return $1;
-},
+}, self, "exportAll", [], smalltalk.Exporter)},
 args: [],
 source: "exportAll\x0a    \x22Export all packages in the system.\x22\x0a\x0a    ^String streamContents: [:stream |\x0a    \x09Smalltalk current packages do: [:pkg |\x0a\x09\x09stream nextPutAll: (self exportPackage: pkg name)]]",
 messageSends: ["streamContents:", "do:", "nextPutAll:", "exportPackage:", "name", "packages", "current"],
@@ -136,15 +136,15 @@ selector: "exportClass:",
 category: 'fileOut',
 fn: function (aClass){
 var self=this;
-var $1;
-$1=smalltalk.send((smalltalk.String || String),"_streamContents_",[(function(stream){
-smalltalk.send(self,"_exportDefinitionOf_on_",[aClass,stream]);
-smalltalk.send(self,"_exportMethodsOf_on_",[aClass,stream]);
-smalltalk.send(self,"_exportMetaDefinitionOf_on_",[aClass,stream]);
-return smalltalk.send(self,"_exportMethodsOf_on_",[smalltalk.send(aClass,"_class",[]),stream]);
-})]);
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st((smalltalk.String || String))._streamContents_((function(stream){
+_st(self)._exportDefinitionOf_on_(aClass,stream);
+_st(self)._exportMethodsOf_on_(aClass,stream);
+_st(self)._exportMetaDefinitionOf_on_(aClass,stream);
+return _st(self)._exportMethodsOf_on_(_st(aClass)._class(),stream);
+}));
 return $1;
-},
+}, self, "exportClass:", [aClass], smalltalk.Exporter)},
 args: ["aClass"],
 source: "exportClass: aClass\x0a\x09\x22Export a single class. Subclasses override these methods.\x22\x0a\x0a\x09^String streamContents: [:stream |\x0a\x09\x09self exportDefinitionOf: aClass on: stream.\x0a\x09\x09self exportMethodsOf: aClass on: stream.\x0a\x09\x09self exportMetaDefinitionOf: aClass on: stream.\x0a\x09\x09self exportMethodsOf: aClass class on: stream]",
 messageSends: ["streamContents:", "exportDefinitionOf:on:", "exportMethodsOf:on:", "exportMetaDefinitionOf:on:", "class"],
@@ -159,30 +159,30 @@ selector: "exportDefinitionOf:on:",
 category: 'private',
 fn: function (aClass,aStream){
 var self=this;
-var $1,$2,$3,$4;
-smalltalk.send(aStream,"_nextPutAll_",["smalltalk.addClass("]);
-smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send("'","__comma",[smalltalk.send(self,"_classNameFor_",[aClass])]),"__comma",["', "])]);
-smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send("smalltalk.","__comma",[smalltalk.send(self,"_classNameFor_",[smalltalk.send(aClass,"_superclass",[])])])]);
-$1=smalltalk.send(aStream,"_nextPutAll_",[", ["]);
-smalltalk.send(smalltalk.send(aClass,"_instanceVariableNames",[]),"_do_separatedBy_",[(function(each){
-return smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send("'","__comma",[each]),"__comma",["'"])]);
+return smalltalk.withContext(function($ctx) { var $1,$2,$3,$4;
+_st(aStream)._nextPutAll_("smalltalk.addClass(");
+_st(aStream)._nextPutAll_(_st(_st("'").__comma(_st(self)._classNameFor_(aClass))).__comma("', "));
+_st(aStream)._nextPutAll_(_st("smalltalk.").__comma(_st(self)._classNameFor_(_st(aClass)._superclass())));
+$1=_st(aStream)._nextPutAll_(", [");
+_st(_st(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
+return _st(aStream)._nextPutAll_(_st(_st("'").__comma(each)).__comma("'"));
 }),(function(){
-return smalltalk.send(aStream,"_nextPutAll_",[", "]);
-})]);
-smalltalk.send(aStream,"_nextPutAll_",["], '"]);
-smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send(aClass,"_category",[]),"__comma",["'"])]);
-$2=smalltalk.send(aStream,"_nextPutAll_",[");"]);
-$3=smalltalk.send(smalltalk.send(aClass,"_comment",[]),"_notEmpty",[]);
+return _st(aStream)._nextPutAll_(", ");
+}));
+_st(aStream)._nextPutAll_("], '");
+_st(aStream)._nextPutAll_(_st(_st(aClass)._category()).__comma("'"));
+$2=_st(aStream)._nextPutAll_(");");
+$3=_st(_st(aClass)._comment())._notEmpty();
 if(smalltalk.assert($3)){
-smalltalk.send(aStream,"_lf",[]);
-smalltalk.send(aStream,"_nextPutAll_",["smalltalk."]);
-smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(self,"_classNameFor_",[aClass])]);
-smalltalk.send(aStream,"_nextPutAll_",[".comment="]);
-$4=smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send(aClass,"_comment",[]),"_asJavascript",[])]);
+_st(aStream)._lf();
+_st(aStream)._nextPutAll_("smalltalk.");
+_st(aStream)._nextPutAll_(_st(self)._classNameFor_(aClass));
+_st(aStream)._nextPutAll_(".comment=");
+$4=_st(aStream)._nextPutAll_(_st(_st(aClass)._comment())._asJavascript());
 $4;
 };
-smalltalk.send(aStream,"_lf",[]);
-return self},
+_st(aStream)._lf();
+return self}, self, "exportDefinitionOf:on:", [aClass,aStream], smalltalk.Exporter)},
 args: ["aClass", "aStream"],
 source: "exportDefinitionOf: aClass on: aStream\x0a\x09aStream \x0a\x09    nextPutAll: 'smalltalk.addClass(';\x0a\x09    nextPutAll: '''', (self classNameFor: aClass), ''', ';\x0a\x09    nextPutAll: 'smalltalk.', (self classNameFor: aClass superclass);\x0a\x09    nextPutAll: ', ['.\x0a\x09aClass instanceVariableNames \x0a\x09    do: [:each | aStream nextPutAll: '''', each, '''']\x0a\x09    separatedBy: [aStream nextPutAll: ', '].\x0a\x09aStream\x09\x0a\x09    nextPutAll: '], ''';\x0a\x09    nextPutAll: aClass category, '''';\x0a\x09    nextPutAll: ');'.\x0a\x09aClass comment notEmpty ifTrue: [\x0a\x09    aStream \x0a\x09    \x09lf;\x0a\x09\x09nextPutAll: 'smalltalk.';\x0a\x09\x09nextPutAll: (self classNameFor: aClass);\x0a\x09\x09nextPutAll: '.comment=';\x0a\x09\x09nextPutAll: aClass comment asJavascript].\x0a\x09aStream lf",
 messageSends: ["nextPutAll:", ",", "classNameFor:", "superclass", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "lf", "asJavascript", "comment", "notEmpty"],
@@ -197,20 +197,20 @@ selector: "exportMetaDefinitionOf:on:",
 category: 'private',
 fn: function (aClass,aStream){
 var self=this;
-var $1,$2;
-$1=smalltalk.send(smalltalk.send(smalltalk.send(aClass,"_class",[]),"_instanceVariableNames",[]),"_isEmpty",[]);
+return smalltalk.withContext(function($ctx) { var $1,$2;
+$1=_st(_st(_st(aClass)._class())._instanceVariableNames())._isEmpty();
 if(! smalltalk.assert($1)){
-smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send("smalltalk.","__comma",[smalltalk.send(self,"_classNameFor_",[smalltalk.send(aClass,"_class",[])])])]);
-$2=smalltalk.send(aStream,"_nextPutAll_",[".iVarNames = ["]);
+_st(aStream)._nextPutAll_(_st("smalltalk.").__comma(_st(self)._classNameFor_(_st(aClass)._class())));
+$2=_st(aStream)._nextPutAll_(".iVarNames = [");
 $2;
-smalltalk.send(smalltalk.send(smalltalk.send(aClass,"_class",[]),"_instanceVariableNames",[]),"_do_separatedBy_",[(function(each){
-return smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send("'","__comma",[each]),"__comma",["'"])]);
+_st(_st(_st(aClass)._class())._instanceVariableNames())._do_separatedBy_((function(each){
+return _st(aStream)._nextPutAll_(_st(_st("'").__comma(each)).__comma("'"));
 }),(function(){
-return smalltalk.send(aStream,"_nextPutAll_",[","]);
-})]);
-smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send("];","__comma",[smalltalk.send((smalltalk.String || String),"_lf",[])])]);
+return _st(aStream)._nextPutAll_(",");
+}));
+_st(aStream)._nextPutAll_(_st("];").__comma(_st((smalltalk.String || String))._lf()));
 };
-return self},
+return self}, self, "exportMetaDefinitionOf:on:", [aClass,aStream], smalltalk.Exporter)},
 args: ["aClass", "aStream"],
 source: "exportMetaDefinitionOf: aClass on: aStream\x0a\x09aClass class instanceVariableNames isEmpty ifFalse: [\x0a\x09    aStream \x0a\x09\x09nextPutAll: 'smalltalk.', (self classNameFor: aClass class);\x0a\x09\x09nextPutAll: '.iVarNames = ['.\x0a\x09    aClass class instanceVariableNames\x0a\x09\x09do: [:each | aStream nextPutAll: '''', each, '''']\x0a\x09\x09separatedBy: [aStream nextPutAll: ','].\x0a\x09    aStream nextPutAll: '];', String lf]",
 messageSends: ["ifFalse:", "nextPutAll:", ",", "classNameFor:", "class", "do:separatedBy:", "instanceVariableNames", "lf", "isEmpty"],
@@ -225,34 +225,34 @@ selector: "exportMethod:of:on:",
 category: 'private',
 fn: function (aMethod,aClass,aStream){
 var self=this;
-var $1,$2;
-smalltalk.send(aStream,"_nextPutAll_",["smalltalk.addMethod("]);
-smalltalk.send(aStream,"_lf",[]);
-smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aMethod,"_selector",[]),"_asSelector",[]),"_asJavascript",[]),"__comma",[","])]);
-smalltalk.send(aStream,"_lf",[]);
-smalltalk.send(aStream,"_nextPutAll_",["smalltalk.method({"]);
-smalltalk.send(aStream,"_lf",[]);
-smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send("selector: ","__comma",[smalltalk.send(smalltalk.send(aMethod,"_selector",[]),"_asJavascript",[])]),"__comma",[","])]);
-smalltalk.send(aStream,"_lf",[]);
-smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send("category: '","__comma",[smalltalk.send(aMethod,"_category",[])]),"__comma",["',"])]);
-smalltalk.send(aStream,"_lf",[]);
-smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send("fn: ","__comma",[smalltalk.send(smalltalk.send(aMethod,"_fn",[]),"_compiledSource",[])]),"__comma",[","])]);
-smalltalk.send(aStream,"_lf",[]);
-smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send("args: ","__comma",[smalltalk.send(smalltalk.send(aMethod,"_arguments",[]),"_asJavascript",[])]),"__comma",[","])]);
-smalltalk.send(aStream,"_lf",[]);
-smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send("source: ","__comma",[smalltalk.send(smalltalk.send(aMethod,"_source",[]),"_asJavascript",[])]),"__comma",[","])]);
-smalltalk.send(aStream,"_lf",[]);
-smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send("messageSends: ","__comma",[smalltalk.send(smalltalk.send(aMethod,"_messageSends",[]),"_asJavascript",[])]),"__comma",[","])]);
-smalltalk.send(aStream,"_lf",[]);
-$1=smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send("referencedClasses: ","__comma",[smalltalk.send(smalltalk.send(aMethod,"_referencedClasses",[]),"_asJavascript",[])])]);
-smalltalk.send(aStream,"_lf",[]);
-smalltalk.send(aStream,"_nextPutAll_",["}),"]);
-smalltalk.send(aStream,"_lf",[]);
-smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send("smalltalk.","__comma",[smalltalk.send(self,"_classNameFor_",[aClass])])]);
-smalltalk.send(aStream,"_nextPutAll_",[");"]);
-smalltalk.send(aStream,"_lf",[]);
-$2=smalltalk.send(aStream,"_lf",[]);
-return self},
+return smalltalk.withContext(function($ctx) { var $1,$2;
+_st(aStream)._nextPutAll_("smalltalk.addMethod(");
+_st(aStream)._lf();
+_st(aStream)._nextPutAll_(_st(_st(_st(_st(aMethod)._selector())._asSelector())._asJavascript()).__comma(","));
+_st(aStream)._lf();
+_st(aStream)._nextPutAll_("smalltalk.method({");
+_st(aStream)._lf();
+_st(aStream)._nextPutAll_(_st(_st("selector: ").__comma(_st(_st(aMethod)._selector())._asJavascript())).__comma(","));
+_st(aStream)._lf();
+_st(aStream)._nextPutAll_(_st(_st("category: '").__comma(_st(aMethod)._category())).__comma("',"));
+_st(aStream)._lf();
+_st(aStream)._nextPutAll_(_st(_st("fn: ").__comma(_st(_st(aMethod)._fn())._compiledSource())).__comma(","));
+_st(aStream)._lf();
+_st(aStream)._nextPutAll_(_st(_st("args: ").__comma(_st(_st(aMethod)._arguments())._asJavascript())).__comma(","));
+_st(aStream)._lf();
+_st(aStream)._nextPutAll_(_st(_st("source: ").__comma(_st(_st(aMethod)._source())._asJavascript())).__comma(","));
+_st(aStream)._lf();
+_st(aStream)._nextPutAll_(_st(_st("messageSends: ").__comma(_st(_st(aMethod)._messageSends())._asJavascript())).__comma(","));
+_st(aStream)._lf();
+$1=_st(aStream)._nextPutAll_(_st("referencedClasses: ").__comma(_st(_st(aMethod)._referencedClasses())._asJavascript()));
+_st(aStream)._lf();
+_st(aStream)._nextPutAll_("}),");
+_st(aStream)._lf();
+_st(aStream)._nextPutAll_(_st("smalltalk.").__comma(_st(self)._classNameFor_(aClass)));
+_st(aStream)._nextPutAll_(");");
+_st(aStream)._lf();
+$2=_st(aStream)._lf();
+return self}, self, "exportMethod:of:on:", [aMethod,aClass,aStream], smalltalk.Exporter)},
 args: ["aMethod", "aClass", "aStream"],
 source: "exportMethod: aMethod of: aClass on: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: 'smalltalk.addMethod(';lf;\x0a\x09\x09nextPutAll: aMethod selector asSelector asJavascript, ',';lf;\x0a\x09\x09nextPutAll: 'smalltalk.method({';lf;\x0a\x09\x09nextPutAll: 'selector: ', aMethod selector asJavascript, ',';lf;\x0a\x09\x09nextPutAll: 'category: ''', aMethod category, ''',';lf;\x0a\x09\x09nextPutAll: 'fn: ', aMethod fn compiledSource, ',';lf;\x0a\x09\x09nextPutAll: 'args: ', aMethod arguments asJavascript, ','; lf;\x0a\x09\x09nextPutAll: 'source: ', aMethod source asJavascript, ',';lf;\x0a\x09\x09nextPutAll: 'messageSends: ', aMethod messageSends asJavascript, ',';lf;\x0a\x09\x09nextPutAll: 'referencedClasses: ', aMethod referencedClasses asJavascript.\x0a\x09aStream\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: '}),';lf;\x0a\x09\x09nextPutAll: 'smalltalk.', (self classNameFor: aClass);\x0a\x09\x09nextPutAll: ');';lf;lf",
 messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "asSelector", "selector", "category", "compiledSource", "fn", "arguments", "source", "messageSends", "referencedClasses", "classNameFor:"],
@@ -267,17 +267,17 @@ selector: "exportMethodsOf:on:",
 category: 'private',
 fn: function (aClass,aStream){
 var self=this;
-var $1;
-smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aClass,"_methodDictionary",[]),"_values",[]),"_sorted_",[(function(a,b){
-return smalltalk.send(smalltalk.send(a,"_selector",[]),"__lt_eq",[smalltalk.send(b,"_selector",[])]);
-})]),"_do_",[(function(each){
-$1=smalltalk.send(smalltalk.send(each,"_category",[]),"_match_",["^\x5c*"]);
+return smalltalk.withContext(function($ctx) { var $1;
+_st(_st(_st(_st(aClass)._methodDictionary())._values())._sorted_((function(a,b){
+return _st(_st(a)._selector()).__lt_eq(_st(b)._selector());
+})))._do_((function(each){
+$1=_st(_st(each)._category())._match_("^\x5c*");
 if(! smalltalk.assert($1)){
-return smalltalk.send(self,"_exportMethod_of_on_",[each,aClass,aStream]);
+return _st(self)._exportMethod_of_on_(each,aClass,aStream);
 };
-})]);
-smalltalk.send(aStream,"_lf",[]);
-return self},
+}));
+_st(aStream)._lf();
+return self}, self, "exportMethodsOf:on:", [aClass,aStream], smalltalk.Exporter)},
 args: ["aClass", "aStream"],
 source: "exportMethodsOf: aClass on: aStream\x0a\x09\x22Issue #143: sort methods alphabetically\x22\x0a\x0a\x09((aClass methodDictionary values) sorted: [:a :b | a selector <= b selector]) do: [:each |\x0a\x09\x09(each category match: '^\x5c*') ifFalse: [\x0a\x09\x09\x09self exportMethod: each of: aClass on: aStream]].\x0a\x09aStream lf",
 messageSends: ["do:", "ifFalse:", "exportMethod:of:on:", "match:", "category", "sorted:", "<=", "selector", "values", "methodDictionary", "lf"],
@@ -292,19 +292,19 @@ selector: "exportPackage:",
 category: 'fileOut',
 fn: function (packageName){
 var self=this;
-var $1;
+return smalltalk.withContext(function($ctx) { var $1;
 var package;
-$1=smalltalk.send((smalltalk.String || String),"_streamContents_",[(function(stream){
-package=smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk),"_current",[]),"_packageAt_",[packageName]);
+$1=_st((smalltalk.String || String))._streamContents_((function(stream){
+package=_st(_st((smalltalk.Smalltalk || Smalltalk))._current())._packageAt_(packageName);
 package;
-smalltalk.send(self,"_exportPackageDefinitionOf_on_",[package,stream]);
-smalltalk.send(smalltalk.send(smalltalk.send(package,"_sortedClasses",[]),"_asSet",[]),"_do_",[(function(each){
-return smalltalk.send(stream,"_nextPutAll_",[smalltalk.send(self,"_exportClass_",[each])]);
-})]);
-return smalltalk.send(self,"_exportPackageExtensionsOf_on_",[package,stream]);
-})]);
+_st(self)._exportPackageDefinitionOf_on_(package,stream);
+_st(_st(_st(package)._sortedClasses())._asSet())._do_((function(each){
+return _st(stream)._nextPutAll_(_st(self)._exportClass_(each));
+}));
+return _st(self)._exportPackageExtensionsOf_on_(package,stream);
+}));
 return $1;
-},
+}, self, "exportPackage:", [packageName], smalltalk.Exporter)},
 args: ["packageName"],
 source: "exportPackage: packageName\x0a\x09\x22Export a given package by name.\x22\x0a\x0a\x09| package |\x0a\x09^String streamContents: [:stream |\x0a                package := Smalltalk current packageAt: packageName.\x0a                self exportPackageDefinitionOf: package on: stream.\x0a\x0a\x09\x09\x22Export classes in dependency order.\x0a\x09\x09Update (issue #171): Remove duplicates for export\x22\x0a\x09    \x09package sortedClasses asSet do: [:each |\x0a                        stream nextPutAll: (self exportClass: each)].\x0a\x09\x09self exportPackageExtensionsOf: package on: stream]",
 messageSends: ["streamContents:", "packageAt:", "current", "exportPackageDefinitionOf:on:", "do:", "nextPutAll:", "exportClass:", "asSet", "sortedClasses", "exportPackageExtensionsOf:on:"],
@@ -319,11 +319,11 @@ selector: "exportPackageDefinitionOf:on:",
 category: 'private',
 fn: function (package,aStream){
 var self=this;
-var $1;
-smalltalk.send(aStream,"_nextPutAll_",["smalltalk.addPackage("]);
-$1=smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send("'","__comma",[smalltalk.send(package,"_name",[])]),"__comma",["', "]),"__comma",[smalltalk.send(package,"_propertiesAsJSON",[])]),"__comma",[");"])]);
-smalltalk.send(aStream,"_lf",[]);
-return self},
+return smalltalk.withContext(function($ctx) { var $1;
+_st(aStream)._nextPutAll_("smalltalk.addPackage(");
+$1=_st(aStream)._nextPutAll_(_st(_st(_st(_st("'").__comma(_st(package)._name())).__comma("', ")).__comma(_st(package)._propertiesAsJSON())).__comma(");"));
+_st(aStream)._lf();
+return self}, self, "exportPackageDefinitionOf:on:", [package,aStream], smalltalk.Exporter)},
 args: ["package", "aStream"],
 source: "exportPackageDefinitionOf: package on: aStream\x0a\x09aStream \x0a\x09    nextPutAll: 'smalltalk.addPackage(';\x0a\x09    nextPutAll: '''', package name, ''', ', package propertiesAsJSON , ');'.\x0a\x09aStream lf",
 messageSends: ["nextPutAll:", ",", "propertiesAsJSON", "name", "lf"],
@@ -338,22 +338,22 @@ selector: "exportPackageExtensionsOf:on:",
 category: 'private',
 fn: function (package,aStream){
 var self=this;
-var $1;
+return smalltalk.withContext(function($ctx) { var $1;
 var name;
-name=smalltalk.send(package,"_name",[]);
-smalltalk.send(smalltalk.send((smalltalk.Package || Package),"_sortedClasses_",[smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk),"_current",[]),"_classes",[])]),"_do_",[(function(each){
-return smalltalk.send([each,smalltalk.send(each,"_class",[])],"_do_",[(function(aClass){
-return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aClass,"_methodDictionary",[]),"_values",[]),"_sorted_",[(function(a,b){
-return smalltalk.send(smalltalk.send(a,"_selector",[]),"__lt_eq",[smalltalk.send(b,"_selector",[])]);
-})]),"_do_",[(function(method){
-$1=smalltalk.send(smalltalk.send(method,"_category",[]),"_match_",[smalltalk.send("^\x5c*","__comma",[name])]);
+name=_st(package)._name();
+_st(_st((smalltalk.Package || Package))._sortedClasses_(_st(_st((smalltalk.Smalltalk || Smalltalk))._current())._classes()))._do_((function(each){
+return _st([each,_st(each)._class()])._do_((function(aClass){
+return _st(_st(_st(_st(aClass)._methodDictionary())._values())._sorted_((function(a,b){
+return _st(_st(a)._selector()).__lt_eq(_st(b)._selector());
+})))._do_((function(method){
+$1=_st(_st(method)._category())._match_(_st("^\x5c*").__comma(name));
 if(smalltalk.assert($1)){
-return smalltalk.send(self,"_exportMethod_of_on_",[method,aClass,aStream]);
+return _st(self)._exportMethod_of_on_(method,aClass,aStream);
 };
-})]);
-})]);
-})]);
-return self},
+}));
+}));
+}));
+return self}, self, "exportPackageExtensionsOf:on:", [package,aStream], smalltalk.Exporter)},
 args: ["package", "aStream"],
 source: "exportPackageExtensionsOf: package on: aStream\x0a\x09\x22Issue #143: sort classes and methods alphabetically\x22\x0a\x0a\x09| name |\x0a\x09name := package name.\x0a\x09(Package sortedClasses: Smalltalk current classes) do: [:each |\x0a\x09\x09{each. each class} do: [:aClass | \x0a\x09\x09\x09((aClass methodDictionary values) sorted: [:a :b | a selector <= b selector]) do: [:method |\x0a\x09\x09\x09\x09(method category match: '^\x5c*', name) ifTrue: [\x0a\x09\x09\x09\x09\x09self exportMethod: method of: aClass on: aStream ]]]]",
 messageSends: ["name", "do:", "ifTrue:", "exportMethod:of:on:", "match:", ",", "category", "sorted:", "<=", "selector", "values", "methodDictionary", "class", "sortedClasses:", "classes", "current"],
@@ -371,10 +371,10 @@ selector: "chunkEscape:",
 category: 'not yet classified',
 fn: function (aString){
 var self=this;
-var $1;
-$1=smalltalk.send(smalltalk.send(aString,"_replace_with_",["!","!!"]),"_trimBoth",[]);
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st(_st(aString)._replace_with_("!","!!"))._trimBoth();
 return $1;
-},
+}, self, "chunkEscape:", [aString], smalltalk.ChunkExporter)},
 args: ["aString"],
 source: "chunkEscape: aString\x0a\x09\x22Replace all occurrences of ! with !! and trim at both ends.\x22\x0a\x0a\x09^(aString replace: '!' with: '!!') trimBoth",
 messageSends: ["trimBoth", "replace:with:"],
@@ -389,20 +389,20 @@ selector: "classNameFor:",
 category: 'not yet classified',
 fn: function (aClass){
 var self=this;
-var $2,$3,$1;
-$2=smalltalk.send(aClass,"_isMetaclass",[]);
+return smalltalk.withContext(function($ctx) { var $2,$3,$1;
+$2=_st(aClass)._isMetaclass();
 if(smalltalk.assert($2)){
-$1=smalltalk.send(smalltalk.send(smalltalk.send(aClass,"_instanceClass",[]),"_name",[]),"__comma",[" class"]);
+$1=_st(_st(_st(aClass)._instanceClass())._name()).__comma(" class");
 } else {
-$3=smalltalk.send(aClass,"_isNil",[]);
+$3=_st(aClass)._isNil();
 if(smalltalk.assert($3)){
 $1="nil";
 } else {
-$1=smalltalk.send(aClass,"_name",[]);
+$1=_st(aClass)._name();
 };
 };
 return $1;
-},
+}, self, "classNameFor:", [aClass], smalltalk.ChunkExporter)},
 args: ["aClass"],
 source: "classNameFor: aClass\x0a\x09^aClass isMetaclass\x0a\x09    ifTrue: [aClass instanceClass name, ' class']\x0a\x09    ifFalse: [\x0a\x09\x09aClass isNil\x0a\x09\x09    ifTrue: ['nil']\x0a\x09\x09    ifFalse: [aClass name]]",
 messageSends: ["ifTrue:ifFalse:", ",", "name", "instanceClass", "isNil", "isMetaclass"],
@@ -417,30 +417,30 @@ selector: "exportDefinitionOf:on:",
 category: 'not yet classified',
 fn: function (aClass,aStream){
 var self=this;
-var $1,$2,$3,$4;
-smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(self,"_classNameFor_",[smalltalk.send(aClass,"_superclass",[])])]);
-smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(" subclass: #","__comma",[smalltalk.send(self,"_classNameFor_",[aClass])])]);
-smalltalk.send(aStream,"_lf",[]);
-$1=smalltalk.send(aStream,"_nextPutAll_",["\x09instanceVariableNames: '"]);
-smalltalk.send(smalltalk.send(aClass,"_instanceVariableNames",[]),"_do_separatedBy_",[(function(each){
-return smalltalk.send(aStream,"_nextPutAll_",[each]);
+return smalltalk.withContext(function($ctx) { var $1,$2,$3,$4;
+_st(aStream)._nextPutAll_(_st(self)._classNameFor_(_st(aClass)._superclass()));
+_st(aStream)._nextPutAll_(_st(" subclass: #").__comma(_st(self)._classNameFor_(aClass)));
+_st(aStream)._lf();
+$1=_st(aStream)._nextPutAll_("\x09instanceVariableNames: '");
+_st(_st(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
+return _st(aStream)._nextPutAll_(each);
 }),(function(){
-return smalltalk.send(aStream,"_nextPutAll_",[" "]);
-})]);
-smalltalk.send(aStream,"_nextPutAll_",["'"]);
-smalltalk.send(aStream,"_lf",[]);
-smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send("\x09package: '","__comma",[smalltalk.send(aClass,"_category",[])]),"__comma",["'!"])]);
-$2=smalltalk.send(aStream,"_lf",[]);
-$3=smalltalk.send(smalltalk.send(aClass,"_comment",[]),"_notEmpty",[]);
+return _st(aStream)._nextPutAll_(" ");
+}));
+_st(aStream)._nextPutAll_("'");
+_st(aStream)._lf();
+_st(aStream)._nextPutAll_(_st(_st("\x09package: '").__comma(_st(aClass)._category())).__comma("'!"));
+$2=_st(aStream)._lf();
+$3=_st(_st(aClass)._comment())._notEmpty();
 if(smalltalk.assert($3)){
-smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send("!","__comma",[smalltalk.send(self,"_classNameFor_",[aClass])]),"__comma",[" commentStamp!"])]);
-smalltalk.send(aStream,"_lf",[]);
-smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send(self,"_chunkEscape_",[smalltalk.send(aClass,"_comment",[])]),"__comma",["!"])]);
-$4=smalltalk.send(aStream,"_lf",[]);
+_st(aStream)._nextPutAll_(_st(_st("!").__comma(_st(self)._classNameFor_(aClass))).__comma(" commentStamp!"));
+_st(aStream)._lf();
+_st(aStream)._nextPutAll_(_st(_st(self)._chunkEscape_(_st(aClass)._comment())).__comma("!"));
+$4=_st(aStream)._lf();
 $4;
 };
-smalltalk.send(aStream,"_lf",[]);
-return self},
+_st(aStream)._lf();
+return self}, self, "exportDefinitionOf:on:", [aClass,aStream], smalltalk.ChunkExporter)},
 args: ["aClass", "aStream"],
 source: "exportDefinitionOf: aClass on: aStream\x0a    \x22Chunk format.\x22\x0a\x0a    aStream \x0a        nextPutAll: (self classNameFor: aClass superclass);\x0a        nextPutAll: ' subclass: #', (self classNameFor: aClass); lf;\x0a        nextPutAll: '\x09instanceVariableNames: '''.\x0a    aClass instanceVariableNames \x0a        do: [:each | aStream nextPutAll: each]\x0a        separatedBy: [aStream nextPutAll: ' '].\x0a    aStream \x0a        nextPutAll: ''''; lf;\x0a        nextPutAll: '\x09package: ''', aClass category, '''!'; lf.\x0a    aClass comment notEmpty ifTrue: [\x0a        aStream \x0a        nextPutAll: '!', (self classNameFor: aClass), ' commentStamp!';lf;\x0a        nextPutAll: (self chunkEscape: aClass comment), '!';lf].\x0a    aStream lf",
 messageSends: ["nextPutAll:", "classNameFor:", "superclass", ",", "lf", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "chunkEscape:", "comment", "notEmpty"],
@@ -455,23 +455,23 @@ selector: "exportMetaDefinitionOf:on:",
 category: 'not yet classified',
 fn: function (aClass,aStream){
 var self=this;
-var $1,$2,$3;
-$1=smalltalk.send(smalltalk.send(smalltalk.send(aClass,"_class",[]),"_instanceVariableNames",[]),"_isEmpty",[]);
+return smalltalk.withContext(function($ctx) { var $1,$2,$3;
+$1=_st(_st(_st(aClass)._class())._instanceVariableNames())._isEmpty();
 if(! smalltalk.assert($1)){
-smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(self,"_classNameFor_",[smalltalk.send(aClass,"_class",[])])]);
-$2=smalltalk.send(aStream,"_nextPutAll_",[" instanceVariableNames: '"]);
+_st(aStream)._nextPutAll_(_st(self)._classNameFor_(_st(aClass)._class()));
+$2=_st(aStream)._nextPutAll_(" instanceVariableNames: '");
 $2;
-smalltalk.send(smalltalk.send(smalltalk.send(aClass,"_class",[]),"_instanceVariableNames",[]),"_do_separatedBy_",[(function(each){
-return smalltalk.send(aStream,"_nextPutAll_",[each]);
+_st(_st(_st(aClass)._class())._instanceVariableNames())._do_separatedBy_((function(each){
+return _st(aStream)._nextPutAll_(each);
 }),(function(){
-return smalltalk.send(aStream,"_nextPutAll_",[" "]);
-})]);
-smalltalk.send(aStream,"_nextPutAll_",["'!"]);
-smalltalk.send(aStream,"_lf",[]);
-$3=smalltalk.send(aStream,"_lf",[]);
+return _st(aStream)._nextPutAll_(" ");
+}));
+_st(aStream)._nextPutAll_("'!");
+_st(aStream)._lf();
+$3=_st(aStream)._lf();
 $3;
 };
-return self},
+return self}, self, "exportMetaDefinitionOf:on:", [aClass,aStream], smalltalk.ChunkExporter)},
 args: ["aClass", "aStream"],
 source: "exportMetaDefinitionOf: aClass on: aStream\x0a\x0a\x09aClass class instanceVariableNames isEmpty ifFalse: [\x0a\x09\x09aStream \x0a\x09\x09    nextPutAll: (self classNameFor: aClass class);\x0a\x09\x09    nextPutAll: ' instanceVariableNames: '''.\x0a\x09\x09aClass class instanceVariableNames \x0a\x09\x09    do: [:each | aStream nextPutAll: each]\x0a\x09\x09    separatedBy: [aStream nextPutAll: ' '].\x0a\x09\x09aStream\x09\x0a\x09\x09    nextPutAll: '''!'; lf; lf]",
 messageSends: ["ifFalse:", "nextPutAll:", "classNameFor:", "class", "do:separatedBy:", "instanceVariableNames", "lf", "isEmpty"],
@@ -486,13 +486,13 @@ selector: "exportMethod:of:on:",
 category: 'not yet classified',
 fn: function (aMethod,aClass,aStream){
 var self=this;
-var $1;
-smalltalk.send(aStream,"_lf",[]);
-smalltalk.send(aStream,"_lf",[]);
-smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(self,"_chunkEscape_",[smalltalk.send(aMethod,"_source",[])])]);
-smalltalk.send(aStream,"_lf",[]);
-$1=smalltalk.send(aStream,"_nextPutAll_",["!"]);
-return self},
+return smalltalk.withContext(function($ctx) { var $1;
+_st(aStream)._lf();
+_st(aStream)._lf();
+_st(aStream)._nextPutAll_(_st(self)._chunkEscape_(_st(aMethod)._source()));
+_st(aStream)._lf();
+$1=_st(aStream)._nextPutAll_("!");
+return self}, self, "exportMethod:of:on:", [aMethod,aClass,aStream], smalltalk.ChunkExporter)},
 args: ["aMethod", "aClass", "aStream"],
 source: "exportMethod: aMethod of: aClass on: aStream\x0a\x09aStream \x0a\x09\x09lf; lf; nextPutAll: (self chunkEscape: aMethod source); lf;\x0a\x09\x09nextPutAll: '!'",
 messageSends: ["lf", "nextPutAll:", "chunkEscape:", "source"],
@@ -507,18 +507,18 @@ selector: "exportMethods:category:of:on:",
 category: 'not yet classified',
 fn: function (methods,category,aClass,aStream){
 var self=this;
-var $1,$2;
-smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send("!","__comma",[smalltalk.send(self,"_classNameFor_",[aClass])])]);
-$1=smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send(" methodsFor: '","__comma",[category]),"__comma",["'!"])]);
-smalltalk.send(smalltalk.send(methods,"_sorted_",[(function(a,b){
-return smalltalk.send(smalltalk.send(a,"_selector",[]),"__lt_eq",[smalltalk.send(b,"_selector",[])]);
-})]),"_do_",[(function(each){
-return smalltalk.send(self,"_exportMethod_of_on_",[each,aClass,aStream]);
-})]);
-smalltalk.send(aStream,"_nextPutAll_",[" !"]);
-smalltalk.send(aStream,"_lf",[]);
-$2=smalltalk.send(aStream,"_lf",[]);
-return self},
+return smalltalk.withContext(function($ctx) { var $1,$2;
+_st(aStream)._nextPutAll_(_st("!").__comma(_st(self)._classNameFor_(aClass)));
+$1=_st(aStream)._nextPutAll_(_st(_st(" methodsFor: '").__comma(category)).__comma("'!"));
+_st(_st(methods)._sorted_((function(a,b){
+return _st(_st(a)._selector()).__lt_eq(_st(b)._selector());
+})))._do_((function(each){
+return _st(self)._exportMethod_of_on_(each,aClass,aStream);
+}));
+_st(aStream)._nextPutAll_(" !");
+_st(aStream)._lf();
+$2=_st(aStream)._lf();
+return self}, self, "exportMethods:category:of:on:", [methods,category,aClass,aStream], smalltalk.ChunkExporter)},
 args: ["methods", "category", "aClass", "aStream"],
 source: "exportMethods: methods category: category of: aClass on: aStream\x0a\x09\x22Issue #143: sort methods alphabetically\x22\x0a\x0a\x09aStream\x0a\x09\x09nextPutAll: '!', (self classNameFor: aClass);\x0a\x09\x09nextPutAll: ' methodsFor: ''', category, '''!'.\x0a\x09\x09(methods sorted: [:a :b | a selector <= b selector]) do: [:each |\x0a\x09\x09\x09\x09self exportMethod: each of: aClass on: aStream].\x0a\x09aStream nextPutAll: ' !'; lf; lf",
 messageSends: ["nextPutAll:", ",", "classNameFor:", "do:", "exportMethod:of:on:", "sorted:", "<=", "selector", "lf"],
@@ -533,24 +533,24 @@ selector: "exportMethodsOf:on:",
 category: 'not yet classified',
 fn: function (aClass,aStream){
 var self=this;
-var $1;
+return smalltalk.withContext(function($ctx) { var $1;
 var map;
-map=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
-smalltalk.send(aClass,"_protocolsDo_",[(function(category,methods){
-$1=smalltalk.send(category,"_match_",["^\x5c*"]);
+map=_st((smalltalk.Dictionary || Dictionary))._new();
+_st(aClass)._protocolsDo_((function(category,methods){
+$1=_st(category)._match_("^\x5c*");
 if(! smalltalk.assert($1)){
-return smalltalk.send(map,"_at_put_",[category,methods]);
+return _st(map)._at_put_(category,methods);
 };
-})]);
-smalltalk.send(smalltalk.send(smalltalk.send(map,"_keys",[]),"_sorted_",[(function(a,b){
-return smalltalk.send(a,"__lt_eq",[b]);
-})]),"_do_",[(function(category){
+}));
+_st(_st(_st(map)._keys())._sorted_((function(a,b){
+return _st(a).__lt_eq(b);
+})))._do_((function(category){
 var methods;
-methods=smalltalk.send(map,"_at_",[category]);
+methods=_st(map)._at_(category);
 methods;
-return smalltalk.send(self,"_exportMethods_category_of_on_",[methods,category,aClass,aStream]);
-})]);
-return self},
+return _st(self)._exportMethods_category_of_on_(methods,category,aClass,aStream);
+}));
+return self}, self, "exportMethodsOf:on:", [aClass,aStream], smalltalk.ChunkExporter)},
 args: ["aClass", "aStream"],
 source: "exportMethodsOf: aClass on: aStream\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09| map |\x0a\x09map := Dictionary new.\x0a\x09aClass protocolsDo: [:category :methods | \x0a\x09\x09(category match: '^\x5c*') ifFalse: [ map at: category put: methods ]].\x0a\x09(map keys sorted: [:a :b | a <= b ]) do: [:category | | methods |\x0a\x09\x09methods := map at: category.\x0a\x09\x09self\x0a\x09\x09\x09exportMethods: methods\x0a\x09\x09\x09category: category\x0a\x09\x09\x09of: aClass\x0a\x09\x09\x09on: aStream ]",
 messageSends: ["new", "protocolsDo:", "ifFalse:", "at:put:", "match:", "do:", "at:", "exportMethods:category:of:on:", "sorted:", "<=", "keys"],
@@ -565,10 +565,10 @@ selector: "exportPackageDefinitionOf:on:",
 category: 'not yet classified',
 fn: function (package,aStream){
 var self=this;
-var $1;
-smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send("Smalltalk current createPackage: '","__comma",[smalltalk.send(package,"_name",[])]),"__comma",["' properties: "]),"__comma",[smalltalk.send(smalltalk.send(package,"_properties",[]),"_storeString",[])]),"__comma",["!"])]);
-$1=smalltalk.send(aStream,"_lf",[]);
-return self},
+return smalltalk.withContext(function($ctx) { var $1;
+_st(aStream)._nextPutAll_(_st(_st(_st(_st("Smalltalk current createPackage: '").__comma(_st(package)._name())).__comma("' properties: ")).__comma(_st(_st(package)._properties())._storeString())).__comma("!"));
+$1=_st(aStream)._lf();
+return self}, self, "exportPackageDefinitionOf:on:", [package,aStream], smalltalk.ChunkExporter)},
 args: ["package", "aStream"],
 source: "exportPackageDefinitionOf: package on: aStream\x0a\x09\x22Chunk format.\x22\x0a\x0a\x09aStream \x0a\x09    nextPutAll: 'Smalltalk current createPackage: ''', package name,\x0a\x09\x09''' properties: ', package properties storeString, '!'; lf.",
 messageSends: ["nextPutAll:", ",", "storeString", "properties", "name", "lf"],
@@ -583,31 +583,31 @@ selector: "exportPackageExtensionsOf:on:",
 category: 'not yet classified',
 fn: function (package,aStream){
 var self=this;
-var $1;
+return smalltalk.withContext(function($ctx) { var $1;
 var name;
 var map;
-name=smalltalk.send(package,"_name",[]);
-smalltalk.send(smalltalk.send((smalltalk.Package || Package),"_sortedClasses_",[smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk),"_current",[]),"_classes",[])]),"_do_",[(function(each){
-return smalltalk.send([each,smalltalk.send(each,"_class",[])],"_do_",[(function(aClass){
-map=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
+name=_st(package)._name();
+_st(_st((smalltalk.Package || Package))._sortedClasses_(_st(_st((smalltalk.Smalltalk || Smalltalk))._current())._classes()))._do_((function(each){
+return _st([each,_st(each)._class()])._do_((function(aClass){
+map=_st((smalltalk.Dictionary || Dictionary))._new();
 map;
-smalltalk.send(aClass,"_protocolsDo_",[(function(category,methods){
-$1=smalltalk.send(category,"_match_",[smalltalk.send("^\x5c*","__comma",[name])]);
+_st(aClass)._protocolsDo_((function(category,methods){
+$1=_st(category)._match_(_st("^\x5c*").__comma(name));
 if(smalltalk.assert($1)){
-return smalltalk.send(map,"_at_put_",[category,methods]);
+return _st(map)._at_put_(category,methods);
 };
-})]);
-return smalltalk.send(smalltalk.send(smalltalk.send(map,"_keys",[]),"_sorted_",[(function(a,b){
-return smalltalk.send(a,"__lt_eq",[b]);
-})]),"_do_",[(function(category){
+}));
+return _st(_st(_st(map)._keys())._sorted_((function(a,b){
+return _st(a).__lt_eq(b);
+})))._do_((function(category){
 var methods;
-methods=smalltalk.send(map,"_at_",[category]);
+methods=_st(map)._at_(category);
 methods;
-return smalltalk.send(self,"_exportMethods_category_of_on_",[methods,category,aClass,aStream]);
-})]);
-})]);
-})]);
-return self},
+return _st(self)._exportMethods_category_of_on_(methods,category,aClass,aStream);
+}));
+}));
+}));
+return self}, self, "exportPackageExtensionsOf:on:", [package,aStream], smalltalk.ChunkExporter)},
 args: ["package", "aStream"],
 source: "exportPackageExtensionsOf: package on: aStream\x0a\x09\x22We need to override this one too since we need to group\x0a\x09all methods in a given protocol under a leading methodsFor: chunk\x0a\x09for that class.\x22\x0a\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09| name map |\x0a\x09name := package name.\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\x09(category match: '^\x5c*', name) ifTrue: [ map at: category put: methods ]].\x0a\x09\x09\x09(map keys sorted: [:a :b | a <= b ]) do: [:category | | methods |\x0a\x09\x09\x09\x09methods := map at: category.\x09\x0a\x09\x09\x09\x09self exportMethods: methods category: category of: aClass on: aStream ]]]",
 messageSends: ["name", "do:", "new", "protocolsDo:", "ifTrue:", "at:put:", "match:", ",", "at:", "exportMethods:category:of:on:", "sorted:", "<=", "keys", "class", "sortedClasses:", "classes", "current"],
@@ -625,21 +625,21 @@ selector: "exportDefinitionOf:on:",
 category: 'private',
 fn: function (aClass,aStream){
 var self=this;
-var $1,$2;
-smalltalk.send(aStream,"_nextPutAll_",["smalltalk.addClass("]);
-smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send("'","__comma",[smalltalk.send(self,"_classNameFor_",[aClass])]),"__comma",["', "])]);
-smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send("smalltalk.","__comma",[smalltalk.send(self,"_classNameFor_",[smalltalk.send(aClass,"_superclass",[])])])]);
-$1=smalltalk.send(aStream,"_nextPutAll_",[", ["]);
-smalltalk.send(smalltalk.send(aClass,"_instanceVariableNames",[]),"_do_separatedBy_",[(function(each){
-return smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send("'","__comma",[each]),"__comma",["'"])]);
+return smalltalk.withContext(function($ctx) { var $1,$2;
+_st(aStream)._nextPutAll_("smalltalk.addClass(");
+_st(aStream)._nextPutAll_(_st(_st("'").__comma(_st(self)._classNameFor_(aClass))).__comma("', "));
+_st(aStream)._nextPutAll_(_st("smalltalk.").__comma(_st(self)._classNameFor_(_st(aClass)._superclass())));
+$1=_st(aStream)._nextPutAll_(", [");
+_st(_st(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
+return _st(aStream)._nextPutAll_(_st(_st("'").__comma(each)).__comma("'"));
 }),(function(){
-return smalltalk.send(aStream,"_nextPutAll_",[", "]);
-})]);
-smalltalk.send(aStream,"_nextPutAll_",["], '"]);
-smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send(aClass,"_category",[]),"__comma",["'"])]);
-$2=smalltalk.send(aStream,"_nextPutAll_",[");"]);
-smalltalk.send(aStream,"_lf",[]);
-return self},
+return _st(aStream)._nextPutAll_(", ");
+}));
+_st(aStream)._nextPutAll_("], '");
+_st(aStream)._nextPutAll_(_st(_st(aClass)._category()).__comma("'"));
+$2=_st(aStream)._nextPutAll_(");");
+_st(aStream)._lf();
+return self}, self, "exportDefinitionOf:on:", [aClass,aStream], smalltalk.StrippedExporter)},
 args: ["aClass", "aStream"],
 source: "exportDefinitionOf: aClass on: aStream\x0a\x09aStream \x0a\x09    nextPutAll: 'smalltalk.addClass(';\x0a\x09    nextPutAll: '''', (self classNameFor: aClass), ''', ';\x0a\x09    nextPutAll: 'smalltalk.', (self classNameFor: aClass superclass);\x0a\x09    nextPutAll: ', ['.\x0a\x09aClass instanceVariableNames \x0a\x09    do: [:each | aStream nextPutAll: '''', each, '''']\x0a\x09    separatedBy: [aStream nextPutAll: ', '].\x0a\x09aStream\x09\x0a\x09    nextPutAll: '], ''';\x0a\x09    nextPutAll: aClass category, '''';\x0a\x09    nextPutAll: ');'.\x0a\x09aStream lf",
 messageSends: ["nextPutAll:", ",", "classNameFor:", "superclass", "do:separatedBy:", "instanceVariableNames", "category", "lf"],
@@ -654,24 +654,24 @@ selector: "exportMethod:of:on:",
 category: 'private',
 fn: function (aMethod,aClass,aStream){
 var self=this;
-var $1;
-smalltalk.send(aStream,"_nextPutAll_",["smalltalk.addMethod("]);
-smalltalk.send(aStream,"_lf",[]);
-smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aMethod,"_selector",[]),"_asSelector",[]),"_asJavascript",[]),"__comma",[","])]);
-smalltalk.send(aStream,"_lf",[]);
-smalltalk.send(aStream,"_nextPutAll_",["smalltalk.method({"]);
-smalltalk.send(aStream,"_lf",[]);
-smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(smalltalk.send("selector: ","__comma",[smalltalk.send(smalltalk.send(aMethod,"_selector",[]),"_asJavascript",[])]),"__comma",[","])]);
-smalltalk.send(aStream,"_lf",[]);
-smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send("fn: ","__comma",[smalltalk.send(smalltalk.send(aMethod,"_fn",[]),"_compiledSource",[])])]);
-smalltalk.send(aStream,"_lf",[]);
-smalltalk.send(aStream,"_nextPutAll_",["}),"]);
-smalltalk.send(aStream,"_lf",[]);
-smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send("smalltalk.","__comma",[smalltalk.send(self,"_classNameFor_",[aClass])])]);
-smalltalk.send(aStream,"_nextPutAll_",[");"]);
-smalltalk.send(aStream,"_lf",[]);
-$1=smalltalk.send(aStream,"_lf",[]);
-return self},
+return smalltalk.withContext(function($ctx) { var $1;
+_st(aStream)._nextPutAll_("smalltalk.addMethod(");
+_st(aStream)._lf();
+_st(aStream)._nextPutAll_(_st(_st(_st(_st(aMethod)._selector())._asSelector())._asJavascript()).__comma(","));
+_st(aStream)._lf();
+_st(aStream)._nextPutAll_("smalltalk.method({");
+_st(aStream)._lf();
+_st(aStream)._nextPutAll_(_st(_st("selector: ").__comma(_st(_st(aMethod)._selector())._asJavascript())).__comma(","));
+_st(aStream)._lf();
+_st(aStream)._nextPutAll_(_st("fn: ").__comma(_st(_st(aMethod)._fn())._compiledSource()));
+_st(aStream)._lf();
+_st(aStream)._nextPutAll_("}),");
+_st(aStream)._lf();
+_st(aStream)._nextPutAll_(_st("smalltalk.").__comma(_st(self)._classNameFor_(aClass)));
+_st(aStream)._nextPutAll_(");");
+_st(aStream)._lf();
+$1=_st(aStream)._lf();
+return self}, self, "exportMethod:of:on:", [aMethod,aClass,aStream], smalltalk.StrippedExporter)},
 args: ["aMethod", "aClass", "aStream"],
 source: "exportMethod: aMethod of: aClass on: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: 'smalltalk.addMethod(';lf;\x0a\x09\x09nextPutAll: aMethod selector asSelector asJavascript, ',';lf;\x0a\x09\x09nextPutAll: 'smalltalk.method({';lf;\x0a\x09\x09nextPutAll: 'selector: ', aMethod selector asJavascript, ',';lf;\x0a\x09\x09nextPutAll: 'fn: ', aMethod fn compiledSource;lf;\x0a\x09\x09nextPutAll: '}),';lf;\x0a\x09\x09nextPutAll: 'smalltalk.', (self classNameFor: aClass);\x0a\x09\x09nextPutAll: ');';lf;lf",
 messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "asSelector", "selector", "compiledSource", "fn", "classNameFor:"],
@@ -689,33 +689,33 @@ selector: "import:",
 category: 'fileIn',
 fn: function (aStream){
 var self=this;
-var $1;
+return smalltalk.withContext(function($ctx) { var $1;
 var chunk;
 var result;
 var parser;
 var lastEmpty;
-parser=smalltalk.send((smalltalk.ChunkParser || ChunkParser),"_on_",[aStream]);
+parser=_st((smalltalk.ChunkParser || ChunkParser))._on_(aStream);
 lastEmpty=false;
-smalltalk.send((function(){
-chunk=smalltalk.send(parser,"_nextChunk",[]);
+_st((function(){
+chunk=_st(parser)._nextChunk();
 chunk;
-return smalltalk.send(chunk,"_isNil",[]);
-}),"_whileFalse_",[(function(){
-$1=smalltalk.send(chunk,"_isEmpty",[]);
+return _st(chunk)._isNil();
+}))._whileFalse_((function(){
+$1=_st(chunk)._isEmpty();
 if(smalltalk.assert($1)){
 lastEmpty=true;
 return lastEmpty;
 } else {
-result=smalltalk.send(smalltalk.send((smalltalk.Compiler || Compiler),"_new",[]),"_evaluateExpression_",[chunk]);
+result=_st(_st((smalltalk.Compiler || Compiler))._new())._evaluateExpression_(chunk);
 result;
 if(smalltalk.assert(lastEmpty)){
 lastEmpty=false;
 lastEmpty;
-return smalltalk.send(result,"_scanFrom_",[parser]);
+return _st(result)._scanFrom_(parser);
 };
 };
-})]);
-return self},
+}));
+return self}, self, "import:", [aStream], smalltalk.Importer)},
 args: ["aStream"],
 source: "import: aStream\x0a    | chunk result parser lastEmpty |\x0a    parser := ChunkParser on: aStream.\x0a    lastEmpty := false.\x0a    [chunk := parser nextChunk.\x0a     chunk isNil] whileFalse: [\x0a        chunk isEmpty\x0a       \x09\x09ifTrue: [lastEmpty := true]\x0a       \x09\x09ifFalse: [\x0a        \x09\x09result := Compiler new evaluateExpression: chunk.\x0a        \x09\x09lastEmpty \x0a            \x09\x09\x09ifTrue: [\x0a                                  \x09lastEmpty := false.\x0a                                  \x09result scanFrom: parser]]]",
 messageSends: ["on:", "whileFalse:", "ifTrue:ifFalse:", "evaluateExpression:", "new", "ifTrue:", "scanFrom:", "isEmpty", "nextChunk", "isNil"],
@@ -733,16 +733,16 @@ selector: "initializePackageNamed:prefix:",
 category: 'not yet classified',
 fn: function (packageName,aString){
 var self=this;
-var $1,$2;
-smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Package || Package),"_named_",[packageName]),"_classes",[]),"_do_",[(function(each){
+return smalltalk.withContext(function($ctx) { var $1,$2;
+_st(_st(_st((smalltalk.Package || Package))._named_(packageName))._classes())._do_((function(each){
 smalltalk.init(each);
 ;
-return smalltalk.send(each,"_initialize",[]);
-})]);
-$1=smalltalk.send((smalltalk.Package || Package),"_named_",[packageName]);
-smalltalk.send($1,"_commitPathJs_",[smalltalk.send(smalltalk.send("/","__comma",[aString]),"__comma",["/js"])]);
-$2=smalltalk.send($1,"_commitPathSt_",[smalltalk.send(smalltalk.send("/","__comma",[aString]),"__comma",["/st"])]);
-return self},
+return _st(each)._initialize();
+}));
+$1=_st((smalltalk.Package || Package))._named_(packageName);
+_st($1)._commitPathJs_(_st(_st("/").__comma(aString)).__comma("/js"));
+$2=_st($1)._commitPathSt_(_st(_st("/").__comma(aString)).__comma("/st"));
+return self}, self, "initializePackageNamed:prefix:", [packageName,aString], smalltalk.PackageLoader)},
 args: ["packageName", "aString"],
 source: "initializePackageNamed: packageName prefix: aString\x0a\x0a\x09(Package named: packageName) classes do: [ :each |\x0a    \x09<smalltalk.init(each)>.\x0a        each initialize. ].\x0a        \x0a    (Package named: packageName) \x0a    \x09commitPathJs: '/', aString, '/js';\x0a        commitPathSt: '/', aString, '/st'",
 messageSends: ["do:", "initialize", "classes", "named:", "commitPathJs:", ",", "commitPathSt:"],
@@ -757,18 +757,18 @@ selector: "loadPackage:prefix:",
 category: 'not yet classified',
 fn: function (packageName,aString){
 var self=this;
-var $1;
+return smalltalk.withContext(function($ctx) { var $1;
 var url;
-url=smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send("/","__comma",[aString]),"__comma",["/js/"]),"__comma",[packageName]),"__comma",[".js"]);
-smalltalk.send(jQuery,"_ajax_options_",[url,smalltalk.HashedCollection._fromPairs_([smalltalk.send("type","__minus_gt",["GET"]),smalltalk.send("dataType","__minus_gt",["script"]),smalltalk.send("complete","__minus_gt",[(function(jqXHR,textStatus){
-$1=smalltalk.send(smalltalk.send(jqXHR,"_readyState",[]),"__eq",[(4)]);
+url=_st(_st(_st(_st("/").__comma(aString)).__comma("/js/")).__comma(packageName)).__comma(".js");
+_st(jQuery)._ajax_options_(url,smalltalk.HashedCollection._fromPairs_([_st("type").__minus_gt("GET"),_st("dataType").__minus_gt("script"),_st("complete").__minus_gt((function(jqXHR,textStatus){
+$1=_st(_st(jqXHR)._readyState()).__eq((4));
 if(smalltalk.assert($1)){
-return smalltalk.send(self,"_initializePackageNamed_prefix_",[packageName,aString]);
+return _st(self)._initializePackageNamed_prefix_(packageName,aString);
 };
-})]),smalltalk.send("error","__minus_gt",[(function(){
-return smalltalk.send(window,"_alert_",[smalltalk.send("Could not load package at:  ","__comma",[url])]);
-})])])]);
-return self},
+})),_st("error").__minus_gt((function(){
+return _st(window)._alert_(_st("Could not load package at:  ").__comma(url));
+}))]));
+return self}, self, "loadPackage:prefix:", [packageName,aString], smalltalk.PackageLoader)},
 args: ["packageName", "aString"],
 source: "loadPackage: packageName prefix: aString\x09\x0a\x09| url |\x0a    url := '/', aString, '/js/', packageName, '.js'.\x0a\x09jQuery \x0a\x09\x09ajax: url\x0a        options: #{\x0a\x09\x09\x09'type' -> 'GET'.\x0a\x09\x09\x09'dataType' -> 'script'.\x0a    \x09\x09'complete' -> [ :jqXHR :textStatus | \x0a\x09\x09\x09\x09jqXHR readyState = 4 \x0a                \x09ifTrue: [ self initializePackageNamed: packageName prefix: aString ] ].\x0a\x09\x09\x09'error' -> [ window alert: 'Could not load package at:  ', url ]\x0a\x09\x09}",
 messageSends: [",", "ajax:options:", "->", "ifTrue:", "initializePackageNamed:prefix:", "=", "readyState", "alert:"],
@@ -783,10 +783,10 @@ selector: "loadPackages:prefix:",
 category: 'not yet classified',
 fn: function (aCollection,aString){
 var self=this;
-smalltalk.send(aCollection,"_do_",[(function(each){
-return smalltalk.send(self,"_loadPackage_prefix_",[each,aString]);
-})]);
-return self},
+return smalltalk.withContext(function($ctx) { _st(aCollection)._do_((function(each){
+return _st(self)._loadPackage_prefix_(each,aString);
+}));
+return self}, self, "loadPackages:prefix:", [aCollection,aString], smalltalk.PackageLoader)},
 args: ["aCollection", "aString"],
 source: "loadPackages: aCollection prefix: aString\x0a\x09aCollection do: [ :each |\x0a    \x09self loadPackage: each prefix: aString ]",
 messageSends: ["do:", "loadPackage:prefix:"],
@@ -802,10 +802,10 @@ selector: "loadPackages:prefix:",
 category: 'not yet classified',
 fn: function (aCollection,aString){
 var self=this;
-var $1;
-$1=smalltalk.send(smalltalk.send(self,"_new",[]),"_loadPackages_prefix_",[aCollection,aString]);
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st(_st(self)._new())._loadPackages_prefix_(aCollection,aString);
 return $1;
-},
+}, self, "loadPackages:prefix:", [aCollection,aString], smalltalk.PackageLoader.klass)},
 args: ["aCollection", "aString"],
 source: "loadPackages: aCollection prefix: aString\x0a\x09^ self new loadPackages: aCollection prefix: aString",
 messageSends: ["loadPackages:prefix:", "new"],

+ 42 - 42
js/Kernel-Announcements.deploy.js

@@ -6,8 +6,8 @@ smalltalk.method({
 selector: "announcementClass",
 fn: function (){
 var self=this;
-return self["@announcementClass"];
-}
+return smalltalk.withContext(function($ctx) { return self["@announcementClass"];
+}, self, "announcementClass", [], smalltalk.AnnouncementSubscription)}
 }),
 smalltalk.AnnouncementSubscription);
 
@@ -17,8 +17,8 @@ smalltalk.method({
 selector: "announcementClass:",
 fn: function (aClass){
 var self=this;
-self["@announcementClass"]=aClass;
-return self}
+return smalltalk.withContext(function($ctx) { self["@announcementClass"]=aClass;
+return self}, self, "announcementClass:", [aClass], smalltalk.AnnouncementSubscription)}
 }),
 smalltalk.AnnouncementSubscription);
 
@@ -28,8 +28,8 @@ smalltalk.method({
 selector: "block",
 fn: function (){
 var self=this;
-return self["@block"];
-}
+return smalltalk.withContext(function($ctx) { return self["@block"];
+}, self, "block", [], smalltalk.AnnouncementSubscription)}
 }),
 smalltalk.AnnouncementSubscription);
 
@@ -39,8 +39,8 @@ smalltalk.method({
 selector: "block:",
 fn: function (aBlock){
 var self=this;
-self["@block"]=aBlock;
-return self}
+return smalltalk.withContext(function($ctx) { self["@block"]=aBlock;
+return self}, self, "block:", [aBlock], smalltalk.AnnouncementSubscription)}
 }),
 smalltalk.AnnouncementSubscription);
 
@@ -50,12 +50,12 @@ smalltalk.method({
 selector: "deliver:",
 fn: function (anAnnouncement){
 var self=this;
-var $1;
-$1=smalltalk.send(self,"_handlesAnnouncement_",[anAnnouncement]);
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st(self)._handlesAnnouncement_(anAnnouncement);
 if(smalltalk.assert($1)){
-smalltalk.send(smalltalk.send(self,"_block",[]),"_value_",[anAnnouncement]);
+_st(_st(self)._block())._value_(anAnnouncement);
 };
-return self}
+return self}, self, "deliver:", [anAnnouncement], smalltalk.AnnouncementSubscription)}
 }),
 smalltalk.AnnouncementSubscription);
 
@@ -65,10 +65,10 @@ smalltalk.method({
 selector: "handlesAnnouncement:",
 fn: function (anAnnouncement){
 var self=this;
-var $1;
-$1=smalltalk.send(anAnnouncement,"_isKindOf_",[smalltalk.send(self,"_announcementClass",[])]);
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st(anAnnouncement)._isKindOf_(_st(self)._announcementClass());
 return $1;
-}
+}, self, "handlesAnnouncement:", [anAnnouncement], smalltalk.AnnouncementSubscription)}
 }),
 smalltalk.AnnouncementSubscription);
 
@@ -81,10 +81,10 @@ smalltalk.method({
 selector: "announce:",
 fn: function (anAnnouncement){
 var self=this;
-smalltalk.send(self["@subscriptions"],"_do_",[(function(each){
-return smalltalk.send(each,"_deliver_",[anAnnouncement]);
-})]);
-return self}
+return smalltalk.withContext(function($ctx) { _st(self["@subscriptions"])._do_((function(each){
+return _st(each)._deliver_(anAnnouncement);
+}));
+return self}, self, "announce:", [anAnnouncement], smalltalk.Announcer)}
 }),
 smalltalk.Announcer);
 
@@ -94,9 +94,9 @@ smalltalk.method({
 selector: "initialize",
 fn: function (){
 var self=this;
-smalltalk.send(self,"_initialize",[],smalltalk.Object);
-self["@subscriptions"]=smalltalk.send((smalltalk.Array || Array),"_new",[]);
-return self}
+return smalltalk.withContext(function($ctx) { smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
+self["@subscriptions"]=_st((smalltalk.Array || Array))._new();
+return self}, self, "initialize", [], smalltalk.Announcer)}
 }),
 smalltalk.Announcer);
 
@@ -106,13 +106,13 @@ smalltalk.method({
 selector: "on:do:",
 fn: function (aClass,aBlock){
 var self=this;
-var $1,$2;
-$1=smalltalk.send((smalltalk.AnnouncementSubscription || AnnouncementSubscription),"_new",[]);
-smalltalk.send($1,"_block_",[aBlock]);
-smalltalk.send($1,"_announcementClass_",[aClass]);
-$2=smalltalk.send($1,"_yourself",[]);
-smalltalk.send(self["@subscriptions"],"_add_",[$2]);
-return self}
+return smalltalk.withContext(function($ctx) { var $1,$2;
+$1=_st((smalltalk.AnnouncementSubscription || AnnouncementSubscription))._new();
+_st($1)._block_(aBlock);
+_st($1)._announcementClass_(aClass);
+$2=_st($1)._yourself();
+_st(self["@subscriptions"])._add_($2);
+return self}, self, "on:do:", [aClass,aBlock], smalltalk.Announcer)}
 }),
 smalltalk.Announcer);
 
@@ -127,15 +127,15 @@ smalltalk.method({
 selector: "current",
 fn: function (){
 var self=this;
-var $1;
+return smalltalk.withContext(function($ctx) { var $1;
 if(($receiver = self["@current"]) == nil || $receiver == undefined){
-self["@current"]=smalltalk.send(self,"_new",[],smalltalk.Announcer.klass);
+self["@current"]=smalltalk.Announcer.klass.fn.prototype._new.apply(_st(self), []);
 $1=self["@current"];
 } else {
 $1=self["@current"];
 };
 return $1;
-}
+}, self, "current", [], smalltalk.SystemAnnouncer.klass)}
 }),
 smalltalk.SystemAnnouncer.klass);
 
@@ -145,8 +145,8 @@ smalltalk.method({
 selector: "new",
 fn: function (){
 var self=this;
-smalltalk.send(self,"_shouldNotImplement",[]);
-return self}
+return smalltalk.withContext(function($ctx) { _st(self)._shouldNotImplement();
+return self}, self, "new", [], smalltalk.SystemAnnouncer.klass)}
 }),
 smalltalk.SystemAnnouncer.klass);
 
@@ -158,8 +158,8 @@ smalltalk.method({
 selector: "theClass",
 fn: function (){
 var self=this;
-return self["@theClass"];
-}
+return smalltalk.withContext(function($ctx) { return self["@theClass"];
+}, self, "theClass", [], smalltalk.SystemAnnouncement)}
 }),
 smalltalk.SystemAnnouncement);
 
@@ -169,8 +169,8 @@ smalltalk.method({
 selector: "theClass:",
 fn: function (aClass){
 var self=this;
-self["@theClass"]=aClass;
-return self}
+return smalltalk.withContext(function($ctx) { self["@theClass"]=aClass;
+return self}, self, "theClass:", [aClass], smalltalk.SystemAnnouncement)}
 }),
 smalltalk.SystemAnnouncement);
 
@@ -198,8 +198,8 @@ smalltalk.method({
 selector: "method",
 fn: function (){
 var self=this;
-return self["@method"];
-}
+return smalltalk.withContext(function($ctx) { return self["@method"];
+}, self, "method", [], smalltalk.MethodAnnouncement)}
 }),
 smalltalk.MethodAnnouncement);
 
@@ -209,8 +209,8 @@ smalltalk.method({
 selector: "method:",
 fn: function (aCompiledMethod){
 var self=this;
-self["@method"]=aCompiledMethod;
-return self}
+return smalltalk.withContext(function($ctx) { self["@method"]=aCompiledMethod;
+return self}, self, "method:", [aCompiledMethod], smalltalk.MethodAnnouncement)}
 }),
 smalltalk.MethodAnnouncement);
 

+ 42 - 42
js/Kernel-Announcements.js

@@ -7,8 +7,8 @@ selector: "announcementClass",
 category: 'accessing',
 fn: function (){
 var self=this;
-return self["@announcementClass"];
-},
+return smalltalk.withContext(function($ctx) { return self["@announcementClass"];
+}, self, "announcementClass", [], smalltalk.AnnouncementSubscription)},
 args: [],
 source: "announcementClass\x0a\x09^announcementClass",
 messageSends: [],
@@ -23,8 +23,8 @@ selector: "announcementClass:",
 category: 'accessing',
 fn: function (aClass){
 var self=this;
-self["@announcementClass"]=aClass;
-return self},
+return smalltalk.withContext(function($ctx) { self["@announcementClass"]=aClass;
+return self}, self, "announcementClass:", [aClass], smalltalk.AnnouncementSubscription)},
 args: ["aClass"],
 source: "announcementClass: aClass\x0a\x09announcementClass := aClass",
 messageSends: [],
@@ -39,8 +39,8 @@ selector: "block",
 category: 'accessing',
 fn: function (){
 var self=this;
-return self["@block"];
-},
+return smalltalk.withContext(function($ctx) { return self["@block"];
+}, self, "block", [], smalltalk.AnnouncementSubscription)},
 args: [],
 source: "block\x0a\x09^block",
 messageSends: [],
@@ -55,8 +55,8 @@ selector: "block:",
 category: 'accessing',
 fn: function (aBlock){
 var self=this;
-self["@block"]=aBlock;
-return self},
+return smalltalk.withContext(function($ctx) { self["@block"]=aBlock;
+return self}, self, "block:", [aBlock], smalltalk.AnnouncementSubscription)},
 args: ["aBlock"],
 source: "block: aBlock\x0a\x09block := aBlock",
 messageSends: [],
@@ -71,12 +71,12 @@ selector: "deliver:",
 category: 'announcing',
 fn: function (anAnnouncement){
 var self=this;
-var $1;
-$1=smalltalk.send(self,"_handlesAnnouncement_",[anAnnouncement]);
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st(self)._handlesAnnouncement_(anAnnouncement);
 if(smalltalk.assert($1)){
-smalltalk.send(smalltalk.send(self,"_block",[]),"_value_",[anAnnouncement]);
+_st(_st(self)._block())._value_(anAnnouncement);
 };
-return self},
+return self}, self, "deliver:", [anAnnouncement], smalltalk.AnnouncementSubscription)},
 args: ["anAnnouncement"],
 source: "deliver: anAnnouncement\x0a\x09(self handlesAnnouncement: anAnnouncement)\x0a\x09\x09ifTrue: [self block value: anAnnouncement]",
 messageSends: ["ifTrue:", "value:", "block", "handlesAnnouncement:"],
@@ -91,10 +91,10 @@ selector: "handlesAnnouncement:",
 category: 'announcing',
 fn: function (anAnnouncement){
 var self=this;
-var $1;
-$1=smalltalk.send(anAnnouncement,"_isKindOf_",[smalltalk.send(self,"_announcementClass",[])]);
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st(anAnnouncement)._isKindOf_(_st(self)._announcementClass());
 return $1;
-},
+}, self, "handlesAnnouncement:", [anAnnouncement], smalltalk.AnnouncementSubscription)},
 args: ["anAnnouncement"],
 source: "handlesAnnouncement: anAnnouncement\x0a\x09^anAnnouncement isKindOf: self announcementClass",
 messageSends: ["isKindOf:", "announcementClass"],
@@ -112,10 +112,10 @@ selector: "announce:",
 category: 'announcing',
 fn: function (anAnnouncement){
 var self=this;
-smalltalk.send(self["@subscriptions"],"_do_",[(function(each){
-return smalltalk.send(each,"_deliver_",[anAnnouncement]);
-})]);
-return self},
+return smalltalk.withContext(function($ctx) { _st(self["@subscriptions"])._do_((function(each){
+return _st(each)._deliver_(anAnnouncement);
+}));
+return self}, self, "announce:", [anAnnouncement], smalltalk.Announcer)},
 args: ["anAnnouncement"],
 source: "announce: anAnnouncement\x0a\x09subscriptions do: [:each |\x0a\x09\x09each deliver: anAnnouncement]",
 messageSends: ["do:", "deliver:"],
@@ -130,9 +130,9 @@ selector: "initialize",
 category: 'initialization',
 fn: function (){
 var self=this;
-smalltalk.send(self,"_initialize",[],smalltalk.Object);
-self["@subscriptions"]=smalltalk.send((smalltalk.Array || Array),"_new",[]);
-return self},
+return smalltalk.withContext(function($ctx) { smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
+self["@subscriptions"]=_st((smalltalk.Array || Array))._new();
+return self}, self, "initialize", [], smalltalk.Announcer)},
 args: [],
 source: "initialize\x0a\x09super initialize.\x0a\x09subscriptions := Array new",
 messageSends: ["initialize", "new"],
@@ -147,13 +147,13 @@ selector: "on:do:",
 category: 'subscribing',
 fn: function (aClass,aBlock){
 var self=this;
-var $1,$2;
-$1=smalltalk.send((smalltalk.AnnouncementSubscription || AnnouncementSubscription),"_new",[]);
-smalltalk.send($1,"_block_",[aBlock]);
-smalltalk.send($1,"_announcementClass_",[aClass]);
-$2=smalltalk.send($1,"_yourself",[]);
-smalltalk.send(self["@subscriptions"],"_add_",[$2]);
-return self},
+return smalltalk.withContext(function($ctx) { var $1,$2;
+$1=_st((smalltalk.AnnouncementSubscription || AnnouncementSubscription))._new();
+_st($1)._block_(aBlock);
+_st($1)._announcementClass_(aClass);
+$2=_st($1)._yourself();
+_st(self["@subscriptions"])._add_($2);
+return self}, self, "on:do:", [aClass,aBlock], smalltalk.Announcer)},
 args: ["aClass", "aBlock"],
 source: "on: aClass do: aBlock\x0a\x09subscriptions add: (AnnouncementSubscription new\x0a\x09\x09block: aBlock;\x0a\x09\x09announcementClass: aClass;\x0a\x09\x09yourself)",
 messageSends: ["add:", "block:", "new", "announcementClass:", "yourself"],
@@ -174,15 +174,15 @@ selector: "current",
 category: 'accessing',
 fn: function (){
 var self=this;
-var $1;
+return smalltalk.withContext(function($ctx) { var $1;
 if(($receiver = self["@current"]) == nil || $receiver == undefined){
-self["@current"]=smalltalk.send(self,"_new",[],smalltalk.Announcer.klass);
+self["@current"]=smalltalk.Announcer.klass.fn.prototype._new.apply(_st(self), []);
 $1=self["@current"];
 } else {
 $1=self["@current"];
 };
 return $1;
-},
+}, self, "current", [], smalltalk.SystemAnnouncer.klass)},
 args: [],
 source: "current\x0a\x09^ current ifNil: [ current := super new ]",
 messageSends: ["ifNil:", "new"],
@@ -197,8 +197,8 @@ selector: "new",
 category: 'instance creation',
 fn: function (){
 var self=this;
-smalltalk.send(self,"_shouldNotImplement",[]);
-return self},
+return smalltalk.withContext(function($ctx) { _st(self)._shouldNotImplement();
+return self}, self, "new", [], smalltalk.SystemAnnouncer.klass)},
 args: [],
 source: "new\x0a\x09self shouldNotImplement",
 messageSends: ["shouldNotImplement"],
@@ -216,8 +216,8 @@ selector: "theClass",
 category: 'accessing',
 fn: function (){
 var self=this;
-return self["@theClass"];
-},
+return smalltalk.withContext(function($ctx) { return self["@theClass"];
+}, self, "theClass", [], smalltalk.SystemAnnouncement)},
 args: [],
 source: "theClass\x0a\x09^ theClass",
 messageSends: [],
@@ -232,8 +232,8 @@ selector: "theClass:",
 category: 'accessing',
 fn: function (aClass){
 var self=this;
-self["@theClass"]=aClass;
-return self},
+return smalltalk.withContext(function($ctx) { self["@theClass"]=aClass;
+return self}, self, "theClass:", [aClass], smalltalk.SystemAnnouncement)},
 args: ["aClass"],
 source: "theClass: aClass\x0a\x09theClass := aClass",
 messageSends: [],
@@ -271,8 +271,8 @@ selector: "method",
 category: 'accessing',
 fn: function (){
 var self=this;
-return self["@method"];
-},
+return smalltalk.withContext(function($ctx) { return self["@method"];
+}, self, "method", [], smalltalk.MethodAnnouncement)},
 args: [],
 source: "method\x0a\x09^ method",
 messageSends: [],
@@ -287,8 +287,8 @@ selector: "method:",
 category: 'accessing',
 fn: function (aCompiledMethod){
 var self=this;
-self["@method"]=aCompiledMethod;
-return self},
+return smalltalk.withContext(function($ctx) { self["@method"]=aCompiledMethod;
+return self}, self, "method:", [aCompiledMethod], smalltalk.MethodAnnouncement)},
 args: ["aCompiledMethod"],
 source: "method: aCompiledMethod\x0a\x09method := aCompiledMethod",
 messageSends: [],

文件差异内容过多而无法显示
+ 243 - 243
js/Kernel-Classes.deploy.js


文件差异内容过多而无法显示
+ 243 - 243
js/Kernel-Classes.js


文件差异内容过多而无法显示
+ 247 - 247
js/Kernel-Collections.deploy.js


文件差异内容过多而无法显示
+ 247 - 247
js/Kernel-Collections.js


+ 63 - 63
js/Kernel-Exceptions.deploy.js

@@ -6,9 +6,9 @@ smalltalk.method({
 selector: "context",
 fn: function (){
 var self=this;
-return self.context;
+return smalltalk.withContext(function($ctx) { return self.context;
 ;
-return self}
+return self}, self, "context", [], smalltalk.Error)}
 }),
 smalltalk.Error);
 
@@ -18,9 +18,9 @@ smalltalk.method({
 selector: "isSmalltalkError",
 fn: function (){
 var self=this;
-return self.smalltalkError === true;
+return smalltalk.withContext(function($ctx) { return self.smalltalkError === true;
 ;
-return self}
+return self}, self, "isSmalltalkError", [], smalltalk.Error)}
 }),
 smalltalk.Error);
 
@@ -30,9 +30,9 @@ smalltalk.method({
 selector: "jsStack",
 fn: function (){
 var self=this;
-return self.stack;
+return smalltalk.withContext(function($ctx) { return self.stack;
 ;
-return self}
+return self}, self, "jsStack", [], smalltalk.Error)}
 }),
 smalltalk.Error);
 
@@ -42,8 +42,8 @@ smalltalk.method({
 selector: "messageText",
 fn: function (){
 var self=this;
-return self["@messageText"];
-}
+return smalltalk.withContext(function($ctx) { return self["@messageText"];
+}, self, "messageText", [], smalltalk.Error)}
 }),
 smalltalk.Error);
 
@@ -53,8 +53,8 @@ smalltalk.method({
 selector: "messageText:",
 fn: function (aString){
 var self=this;
-self["@messageText"]=aString;
-return self}
+return smalltalk.withContext(function($ctx) { self["@messageText"]=aString;
+return self}, self, "messageText:", [aString], smalltalk.Error)}
 }),
 smalltalk.Error);
 
@@ -64,9 +64,9 @@ smalltalk.method({
 selector: "signal",
 fn: function (){
 var self=this;
-self.context = smalltalk.getThisContext(); self.smalltalkError = true; throw(self);
+return smalltalk.withContext(function($ctx) { self.context = smalltalk.getThisContext(); self.smalltalkError = true; throw(self);
 ;
-return self}
+return self}, self, "signal", [], smalltalk.Error)}
 }),
 smalltalk.Error);
 
@@ -76,9 +76,9 @@ smalltalk.method({
 selector: "signal:",
 fn: function (aString){
 var self=this;
-smalltalk.send(self,"_messageText_",[aString]);
-smalltalk.send(self,"_signal",[]);
-return self}
+return smalltalk.withContext(function($ctx) { _st(self)._messageText_(aString);
+_st(self)._signal();
+return self}, self, "signal:", [aString], smalltalk.Error)}
 }),
 smalltalk.Error);
 
@@ -89,10 +89,10 @@ smalltalk.method({
 selector: "signal",
 fn: function (){
 var self=this;
-var $1;
-$1=smalltalk.send(smalltalk.send(self,"_new",[]),"_signal",[]);
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st(_st(self)._new())._signal();
 return $1;
-}
+}, self, "signal", [], smalltalk.Error.klass)}
 }),
 smalltalk.Error.klass);
 
@@ -102,10 +102,10 @@ smalltalk.method({
 selector: "signal:",
 fn: function (aString){
 var self=this;
-var $1;
-$1=smalltalk.send(smalltalk.send(self,"_new",[]),"_signal_",[aString]);
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st(_st(self)._new())._signal_(aString);
 return $1;
-}
+}, self, "signal:", [aString], smalltalk.Error.klass)}
 }),
 smalltalk.Error.klass);
 
@@ -117,8 +117,8 @@ smalltalk.method({
 selector: "message",
 fn: function (){
 var self=this;
-return self["@message"];
-}
+return smalltalk.withContext(function($ctx) { return self["@message"];
+}, self, "message", [], smalltalk.MessageNotUnderstood)}
 }),
 smalltalk.MessageNotUnderstood);
 
@@ -128,8 +128,8 @@ smalltalk.method({
 selector: "message:",
 fn: function (aMessage){
 var self=this;
-self["@message"]=aMessage;
-return self}
+return smalltalk.withContext(function($ctx) { self["@message"]=aMessage;
+return self}, self, "message:", [aMessage], smalltalk.MessageNotUnderstood)}
 }),
 smalltalk.MessageNotUnderstood);
 
@@ -139,10 +139,10 @@ smalltalk.method({
 selector: "messageText",
 fn: function (){
 var self=this;
-var $1;
-$1=smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self,"_receiver",[]),"_asString",[]),"__comma",[" does not understand #"]),"__comma",[smalltalk.send(smalltalk.send(self,"_message",[]),"_selector",[])]);
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st(_st(_st(_st(self)._receiver())._asString()).__comma(" does not understand #")).__comma(_st(_st(self)._message())._selector());
 return $1;
-}
+}, self, "messageText", [], smalltalk.MessageNotUnderstood)}
 }),
 smalltalk.MessageNotUnderstood);
 
@@ -152,8 +152,8 @@ smalltalk.method({
 selector: "receiver",
 fn: function (){
 var self=this;
-return self["@receiver"];
-}
+return smalltalk.withContext(function($ctx) { return self["@receiver"];
+}, self, "receiver", [], smalltalk.MessageNotUnderstood)}
 }),
 smalltalk.MessageNotUnderstood);
 
@@ -163,8 +163,8 @@ smalltalk.method({
 selector: "receiver:",
 fn: function (anObject){
 var self=this;
-self["@receiver"]=anObject;
-return self}
+return smalltalk.withContext(function($ctx) { self["@receiver"]=anObject;
+return self}, self, "receiver:", [anObject], smalltalk.MessageNotUnderstood)}
 }),
 smalltalk.MessageNotUnderstood);
 
@@ -177,8 +177,8 @@ smalltalk.method({
 selector: "object",
 fn: function (){
 var self=this;
-return self["@object"];
-}
+return smalltalk.withContext(function($ctx) { return self["@object"];
+}, self, "object", [], smalltalk.NonBooleanReceiver)}
 }),
 smalltalk.NonBooleanReceiver);
 
@@ -188,8 +188,8 @@ smalltalk.method({
 selector: "object:",
 fn: function (anObject){
 var self=this;
-self["@object"]=anObject;
-return self}
+return smalltalk.withContext(function($ctx) { self["@object"]=anObject;
+return self}, self, "object:", [anObject], smalltalk.NonBooleanReceiver)}
 }),
 smalltalk.NonBooleanReceiver);
 
@@ -202,15 +202,15 @@ smalltalk.method({
 selector: "handleError:",
 fn: function (anError){
 var self=this;
-var $1;
-$1=smalltalk.send(anError,"_context",[]);
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st(anError)._context();
 if(($receiver = $1) == nil || $receiver == undefined){
 $1;
 } else {
-smalltalk.send(self,"_logErrorContext_",[smalltalk.send(anError,"_context",[])]);
+_st(self)._logErrorContext_(_st(anError)._context());
 };
-smalltalk.send(self,"_logError_",[anError]);
-return self}
+_st(self)._logError_(anError);
+return self}, self, "handleError:", [anError], smalltalk.ErrorHandler)}
 }),
 smalltalk.ErrorHandler);
 
@@ -220,8 +220,8 @@ smalltalk.method({
 selector: "log:",
 fn: function (aString){
 var self=this;
-smalltalk.send(console,"_log_",[aString]);
-return self}
+return smalltalk.withContext(function($ctx) { _st(console)._log_(aString);
+return self}, self, "log:", [aString], smalltalk.ErrorHandler)}
 }),
 smalltalk.ErrorHandler);
 
@@ -231,15 +231,15 @@ smalltalk.method({
 selector: "logContext:",
 fn: function (aContext){
 var self=this;
-var $1;
-$1=smalltalk.send(aContext,"_home",[]);
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st(aContext)._home();
 if(($receiver = $1) == nil || $receiver == undefined){
 $1;
 } else {
-smalltalk.send(self,"_logContext_",[smalltalk.send(aContext,"_home",[])]);
+_st(self)._logContext_(_st(aContext)._home());
 };
-smalltalk.send(self,"_log_",[smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aContext,"_receiver",[]),"_asString",[]),"__comma",[">>"]),"__comma",[smalltalk.send(aContext,"_selector",[])])]);
-return self}
+_st(self)._log_(_st(_st(_st(_st(aContext)._receiver())._asString()).__comma(">>")).__comma(_st(aContext)._selector()));
+return self}, self, "logContext:", [aContext], smalltalk.ErrorHandler)}
 }),
 smalltalk.ErrorHandler);
 
@@ -249,8 +249,8 @@ smalltalk.method({
 selector: "logError:",
 fn: function (anError){
 var self=this;
-smalltalk.send(self,"_log_",[smalltalk.send(anError,"_messageText",[])]);
-return self}
+return smalltalk.withContext(function($ctx) { _st(self)._log_(_st(anError)._messageText());
+return self}, self, "logError:", [anError], smalltalk.ErrorHandler)}
 }),
 smalltalk.ErrorHandler);
 
@@ -260,18 +260,18 @@ smalltalk.method({
 selector: "logErrorContext:",
 fn: function (aContext){
 var self=this;
-var $1;
+return smalltalk.withContext(function($ctx) { var $1;
 if(($receiver = aContext) == nil || $receiver == undefined){
 aContext;
 } else {
-$1=smalltalk.send(aContext,"_home",[]);
+$1=_st(aContext)._home();
 if(($receiver = $1) == nil || $receiver == undefined){
 $1;
 } else {
-smalltalk.send(self,"_logContext_",[smalltalk.send(aContext,"_home",[])]);
+_st(self)._logContext_(_st(aContext)._home());
 };
 };
-return self}
+return self}, self, "logErrorContext:", [aContext], smalltalk.ErrorHandler)}
 }),
 smalltalk.ErrorHandler);
 
@@ -283,15 +283,15 @@ smalltalk.method({
 selector: "current",
 fn: function (){
 var self=this;
-var $1;
+return smalltalk.withContext(function($ctx) { var $1;
 if(($receiver = self["@current"]) == nil || $receiver == undefined){
-self["@current"]=smalltalk.send(self,"_new",[]);
+self["@current"]=_st(self)._new();
 $1=self["@current"];
 } else {
 $1=self["@current"];
 };
 return $1;
-}
+}, self, "current", [], smalltalk.ErrorHandler.klass)}
 }),
 smalltalk.ErrorHandler.klass);
 
@@ -301,8 +301,8 @@ smalltalk.method({
 selector: "initialize",
 fn: function (){
 var self=this;
-smalltalk.send(self,"_register",[]);
-return self}
+return smalltalk.withContext(function($ctx) { _st(self)._register();
+return self}, self, "initialize", [], smalltalk.ErrorHandler.klass)}
 }),
 smalltalk.ErrorHandler.klass);
 
@@ -312,8 +312,8 @@ smalltalk.method({
 selector: "register",
 fn: function (){
 var self=this;
-smalltalk.send((smalltalk.ErrorHandler || ErrorHandler),"_setCurrent_",[smalltalk.send(self,"_new",[])]);
-return self}
+return smalltalk.withContext(function($ctx) { _st((smalltalk.ErrorHandler || ErrorHandler))._setCurrent_(_st(self)._new());
+return self}, self, "register", [], smalltalk.ErrorHandler.klass)}
 }),
 smalltalk.ErrorHandler.klass);
 
@@ -323,8 +323,8 @@ smalltalk.method({
 selector: "setCurrent:",
 fn: function (anHandler){
 var self=this;
-self["@current"]=anHandler;
-return self}
+return smalltalk.withContext(function($ctx) { self["@current"]=anHandler;
+return self}, self, "setCurrent:", [anHandler], smalltalk.ErrorHandler.klass)}
 }),
 smalltalk.ErrorHandler.klass);
 

+ 63 - 63
js/Kernel-Exceptions.js

@@ -7,9 +7,9 @@ selector: "context",
 category: 'accessing',
 fn: function (){
 var self=this;
-return self.context;
+return smalltalk.withContext(function($ctx) { return self.context;
 ;
-return self},
+return self}, self, "context", [], smalltalk.Error)},
 args: [],
 source: "context\x0a\x09<return self.context>",
 messageSends: [],
@@ -24,9 +24,9 @@ selector: "isSmalltalkError",
 category: 'testing',
 fn: function (){
 var self=this;
-return self.smalltalkError === true;
+return smalltalk.withContext(function($ctx) { return self.smalltalkError === true;
 ;
-return self},
+return self}, self, "isSmalltalkError", [], smalltalk.Error)},
 args: [],
 source: "isSmalltalkError\x0a\x09<return self.smalltalkError === true>",
 messageSends: [],
@@ -41,9 +41,9 @@ selector: "jsStack",
 category: 'accessing',
 fn: function (){
 var self=this;
-return self.stack;
+return smalltalk.withContext(function($ctx) { return self.stack;
 ;
-return self},
+return self}, self, "jsStack", [], smalltalk.Error)},
 args: [],
 source: "jsStack\x0a\x09<return self.stack>",
 messageSends: [],
@@ -58,8 +58,8 @@ selector: "messageText",
 category: 'accessing',
 fn: function (){
 var self=this;
-return self["@messageText"];
-},
+return smalltalk.withContext(function($ctx) { return self["@messageText"];
+}, self, "messageText", [], smalltalk.Error)},
 args: [],
 source: "messageText\x0a\x09^messageText",
 messageSends: [],
@@ -74,8 +74,8 @@ selector: "messageText:",
 category: 'accessing',
 fn: function (aString){
 var self=this;
-self["@messageText"]=aString;
-return self},
+return smalltalk.withContext(function($ctx) { self["@messageText"]=aString;
+return self}, self, "messageText:", [aString], smalltalk.Error)},
 args: ["aString"],
 source: "messageText: aString\x0a\x09messageText := aString",
 messageSends: [],
@@ -90,9 +90,9 @@ selector: "signal",
 category: 'signaling',
 fn: function (){
 var self=this;
-self.context = smalltalk.getThisContext(); self.smalltalkError = true; throw(self);
+return smalltalk.withContext(function($ctx) { self.context = smalltalk.getThisContext(); self.smalltalkError = true; throw(self);
 ;
-return self},
+return self}, self, "signal", [], smalltalk.Error)},
 args: [],
 source: "signal\x0a\x09<self.context = smalltalk.getThisContext(); self.smalltalkError = true; throw(self)>",
 messageSends: [],
@@ -107,9 +107,9 @@ selector: "signal:",
 category: 'signaling',
 fn: function (aString){
 var self=this;
-smalltalk.send(self,"_messageText_",[aString]);
-smalltalk.send(self,"_signal",[]);
-return self},
+return smalltalk.withContext(function($ctx) { _st(self)._messageText_(aString);
+_st(self)._signal();
+return self}, self, "signal:", [aString], smalltalk.Error)},
 args: ["aString"],
 source: "signal: aString\x0a\x09self messageText: aString.\x0a\x09self signal",
 messageSends: ["messageText:", "signal"],
@@ -125,10 +125,10 @@ selector: "signal",
 category: 'instance creation',
 fn: function (){
 var self=this;
-var $1;
-$1=smalltalk.send(smalltalk.send(self,"_new",[]),"_signal",[]);
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st(_st(self)._new())._signal();
 return $1;
-},
+}, self, "signal", [], smalltalk.Error.klass)},
 args: [],
 source: "signal\x0a\x09^self new signal",
 messageSends: ["signal", "new"],
@@ -143,10 +143,10 @@ selector: "signal:",
 category: 'instance creation',
 fn: function (aString){
 var self=this;
-var $1;
-$1=smalltalk.send(smalltalk.send(self,"_new",[]),"_signal_",[aString]);
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st(_st(self)._new())._signal_(aString);
 return $1;
-},
+}, self, "signal:", [aString], smalltalk.Error.klass)},
 args: ["aString"],
 source: "signal: aString\x0a\x09    ^self new\x0a\x09\x09signal: aString",
 messageSends: ["signal:", "new"],
@@ -163,8 +163,8 @@ selector: "message",
 category: 'accessing',
 fn: function (){
 var self=this;
-return self["@message"];
-},
+return smalltalk.withContext(function($ctx) { return self["@message"];
+}, self, "message", [], smalltalk.MessageNotUnderstood)},
 args: [],
 source: "message\x0a\x09^message",
 messageSends: [],
@@ -179,8 +179,8 @@ selector: "message:",
 category: 'accessing',
 fn: function (aMessage){
 var self=this;
-self["@message"]=aMessage;
-return self},
+return smalltalk.withContext(function($ctx) { self["@message"]=aMessage;
+return self}, self, "message:", [aMessage], smalltalk.MessageNotUnderstood)},
 args: ["aMessage"],
 source: "message: aMessage\x0a\x09message := aMessage",
 messageSends: [],
@@ -195,10 +195,10 @@ selector: "messageText",
 category: 'accessing',
 fn: function (){
 var self=this;
-var $1;
-$1=smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self,"_receiver",[]),"_asString",[]),"__comma",[" does not understand #"]),"__comma",[smalltalk.send(smalltalk.send(self,"_message",[]),"_selector",[])]);
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st(_st(_st(_st(self)._receiver())._asString()).__comma(" does not understand #")).__comma(_st(_st(self)._message())._selector());
 return $1;
-},
+}, self, "messageText", [], smalltalk.MessageNotUnderstood)},
 args: [],
 source: "messageText\x0a\x09^self receiver asString, ' does not understand #', self message selector",
 messageSends: [",", "selector", "message", "asString", "receiver"],
@@ -213,8 +213,8 @@ selector: "receiver",
 category: 'accessing',
 fn: function (){
 var self=this;
-return self["@receiver"];
-},
+return smalltalk.withContext(function($ctx) { return self["@receiver"];
+}, self, "receiver", [], smalltalk.MessageNotUnderstood)},
 args: [],
 source: "receiver\x0a\x09^receiver",
 messageSends: [],
@@ -229,8 +229,8 @@ selector: "receiver:",
 category: 'accessing',
 fn: function (anObject){
 var self=this;
-self["@receiver"]=anObject;
-return self},
+return smalltalk.withContext(function($ctx) { self["@receiver"]=anObject;
+return self}, self, "receiver:", [anObject], smalltalk.MessageNotUnderstood)},
 args: ["anObject"],
 source: "receiver: anObject\x0a\x09receiver := anObject",
 messageSends: [],
@@ -248,8 +248,8 @@ selector: "object",
 category: 'accessing',
 fn: function (){
 var self=this;
-return self["@object"];
-},
+return smalltalk.withContext(function($ctx) { return self["@object"];
+}, self, "object", [], smalltalk.NonBooleanReceiver)},
 args: [],
 source: "object\x0a\x09^ object",
 messageSends: [],
@@ -264,8 +264,8 @@ selector: "object:",
 category: 'accessing',
 fn: function (anObject){
 var self=this;
-self["@object"]=anObject;
-return self},
+return smalltalk.withContext(function($ctx) { self["@object"]=anObject;
+return self}, self, "object:", [anObject], smalltalk.NonBooleanReceiver)},
 args: ["anObject"],
 source: "object: anObject\x0a\x09object := anObject",
 messageSends: [],
@@ -283,15 +283,15 @@ selector: "handleError:",
 category: 'error handling',
 fn: function (anError){
 var self=this;
-var $1;
-$1=smalltalk.send(anError,"_context",[]);
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st(anError)._context();
 if(($receiver = $1) == nil || $receiver == undefined){
 $1;
 } else {
-smalltalk.send(self,"_logErrorContext_",[smalltalk.send(anError,"_context",[])]);
+_st(self)._logErrorContext_(_st(anError)._context());
 };
-smalltalk.send(self,"_logError_",[anError]);
-return self},
+_st(self)._logError_(anError);
+return self}, self, "handleError:", [anError], smalltalk.ErrorHandler)},
 args: ["anError"],
 source: "handleError: anError\x0a\x09anError context ifNotNil: [self logErrorContext: anError context].\x0a\x09self logError: anError",
 messageSends: ["ifNotNil:", "logErrorContext:", "context", "logError:"],
@@ -306,8 +306,8 @@ selector: "log:",
 category: 'private',
 fn: function (aString){
 var self=this;
-smalltalk.send(console,"_log_",[aString]);
-return self},
+return smalltalk.withContext(function($ctx) { _st(console)._log_(aString);
+return self}, self, "log:", [aString], smalltalk.ErrorHandler)},
 args: ["aString"],
 source: "log: aString\x0a\x09console log: aString",
 messageSends: ["log:"],
@@ -322,15 +322,15 @@ selector: "logContext:",
 category: 'private',
 fn: function (aContext){
 var self=this;
-var $1;
-$1=smalltalk.send(aContext,"_home",[]);
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st(aContext)._home();
 if(($receiver = $1) == nil || $receiver == undefined){
 $1;
 } else {
-smalltalk.send(self,"_logContext_",[smalltalk.send(aContext,"_home",[])]);
+_st(self)._logContext_(_st(aContext)._home());
 };
-smalltalk.send(self,"_log_",[smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aContext,"_receiver",[]),"_asString",[]),"__comma",[">>"]),"__comma",[smalltalk.send(aContext,"_selector",[])])]);
-return self},
+_st(self)._log_(_st(_st(_st(_st(aContext)._receiver())._asString()).__comma(">>")).__comma(_st(aContext)._selector()));
+return self}, self, "logContext:", [aContext], smalltalk.ErrorHandler)},
 args: ["aContext"],
 source: "logContext: aContext\x0a\x09aContext home ifNotNil: [\x0a\x09\x09self logContext: aContext home].\x0a\x09self log: aContext receiver asString, '>>', aContext selector",
 messageSends: ["ifNotNil:", "logContext:", "home", "log:", ",", "selector", "asString", "receiver"],
@@ -345,8 +345,8 @@ selector: "logError:",
 category: 'private',
 fn: function (anError){
 var self=this;
-smalltalk.send(self,"_log_",[smalltalk.send(anError,"_messageText",[])]);
-return self},
+return smalltalk.withContext(function($ctx) { _st(self)._log_(_st(anError)._messageText());
+return self}, self, "logError:", [anError], smalltalk.ErrorHandler)},
 args: ["anError"],
 source: "logError: anError\x0a\x09self log: anError messageText",
 messageSends: ["log:", "messageText"],
@@ -361,18 +361,18 @@ selector: "logErrorContext:",
 category: 'private',
 fn: function (aContext){
 var self=this;
-var $1;
+return smalltalk.withContext(function($ctx) { var $1;
 if(($receiver = aContext) == nil || $receiver == undefined){
 aContext;
 } else {
-$1=smalltalk.send(aContext,"_home",[]);
+$1=_st(aContext)._home();
 if(($receiver = $1) == nil || $receiver == undefined){
 $1;
 } else {
-smalltalk.send(self,"_logContext_",[smalltalk.send(aContext,"_home",[])]);
+_st(self)._logContext_(_st(aContext)._home());
 };
 };
-return self},
+return self}, self, "logErrorContext:", [aContext], smalltalk.ErrorHandler)},
 args: ["aContext"],
 source: "logErrorContext: aContext\x0a\x09aContext ifNotNil: [\x0a\x09\x09aContext home ifNotNil: [\x0a\x09\x09\x09self logContext: aContext home]]",
 messageSends: ["ifNotNil:", "logContext:", "home"],
@@ -389,15 +389,15 @@ selector: "current",
 category: 'accessing',
 fn: function (){
 var self=this;
-var $1;
+return smalltalk.withContext(function($ctx) { var $1;
 if(($receiver = self["@current"]) == nil || $receiver == undefined){
-self["@current"]=smalltalk.send(self,"_new",[]);
+self["@current"]=_st(self)._new();
 $1=self["@current"];
 } else {
 $1=self["@current"];
 };
 return $1;
-},
+}, self, "current", [], smalltalk.ErrorHandler.klass)},
 args: [],
 source: "current\x0a\x09^current ifNil: [current := self new]",
 messageSends: ["ifNil:", "new"],
@@ -412,8 +412,8 @@ selector: "initialize",
 category: 'initialization',
 fn: function (){
 var self=this;
-smalltalk.send(self,"_register",[]);
-return self},
+return smalltalk.withContext(function($ctx) { _st(self)._register();
+return self}, self, "initialize", [], smalltalk.ErrorHandler.klass)},
 args: [],
 source: "initialize\x0a\x09self register",
 messageSends: ["register"],
@@ -428,8 +428,8 @@ selector: "register",
 category: 'initialization',
 fn: function (){
 var self=this;
-smalltalk.send((smalltalk.ErrorHandler || ErrorHandler),"_setCurrent_",[smalltalk.send(self,"_new",[])]);
-return self},
+return smalltalk.withContext(function($ctx) { _st((smalltalk.ErrorHandler || ErrorHandler))._setCurrent_(_st(self)._new());
+return self}, self, "register", [], smalltalk.ErrorHandler.klass)},
 args: [],
 source: "register\x0a\x09ErrorHandler setCurrent: self new",
 messageSends: ["setCurrent:", "new"],
@@ -444,8 +444,8 @@ selector: "setCurrent:",
 category: 'accessing',
 fn: function (anHandler){
 var self=this;
-self["@current"]=anHandler;
-return self},
+return smalltalk.withContext(function($ctx) { self["@current"]=anHandler;
+return self}, self, "setCurrent:", [anHandler], smalltalk.ErrorHandler.klass)},
 args: ["anHandler"],
 source: "setCurrent: anHandler\x0a\x09current := anHandler",
 messageSends: [],

+ 319 - 280
js/Kernel-Methods.deploy.js

@@ -4,11 +4,11 @@ smalltalk.addMethod(
 "_applyTo_arguments_",
 smalltalk.method({
 selector: "applyTo:arguments:",
-fn: function (anObject, aCollection) {
-    var self = this;
-    return self.apply(anObject, aCollection);
-    return self;
-}
+fn: function (anObject,aCollection){
+var self=this;
+return smalltalk.withContext(function($ctx) { return self.apply(anObject, aCollection);
+;
+return self}, self, "applyTo:arguments:", [anObject,aCollection], smalltalk.BlockClosure)}
 }),
 smalltalk.BlockClosure);
 
@@ -16,11 +16,11 @@ smalltalk.addMethod(
 "_compiledSource",
 smalltalk.method({
 selector: "compiledSource",
-fn: function () {
-    var self = this;
-    return self.toString();
-    return self;
-}
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { return self.toString();
+;
+return self}, self, "compiledSource", [], smalltalk.BlockClosure)}
 }),
 smalltalk.BlockClosure);
 
@@ -28,14 +28,24 @@ smalltalk.addMethod(
 "_ensure_",
 smalltalk.method({
 selector: "ensure:",
-fn: function (aBlock) {
-    var self = this;
-    var $1;
-    var success;
-    success = false;
-    $1 = smalltalk.send(function () {smalltalk.send(self, "_value", []);success = true;success;return smalltalk.send(aBlock, "_value", []);}, "_on_do_", [smalltalk.Error || Error, function (ex) {if (!smalltalk.assert(success)) {smalltalk.send(aBlock, "_value", []);}return smalltalk.send(ex, "_signal", []);}]);
-    return $1;
-}
+fn: function (aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx) { var $1;
+var success;
+success=false;
+$1=_st((function(){
+_st(self)._value();
+success=true;
+success;
+return _st(aBlock)._value();
+}))._on_do_((smalltalk.Error || Error),(function(ex){
+if(! smalltalk.assert(success)){
+_st(aBlock)._value();
+};
+return _st(ex)._signal();
+}));
+return $1;
+}, self, "ensure:", [aBlock], smalltalk.BlockClosure)}
 }),
 smalltalk.BlockClosure);
 
@@ -43,11 +53,11 @@ smalltalk.addMethod(
 "_new",
 smalltalk.method({
 selector: "new",
-fn: function () {
-    var self = this;
-    return new self;
-    return self;
-}
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { return new self();
+;
+return self}, self, "new", [], smalltalk.BlockClosure)}
 }),
 smalltalk.BlockClosure);
 
@@ -55,11 +65,11 @@ smalltalk.addMethod(
 "_newValue_",
 smalltalk.method({
 selector: "newValue:",
-fn: function (anObject) {
-    var self = this;
-    return new self(anObject);
-    return self;
-}
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx) { return new self(anObject);
+;
+return self}, self, "newValue:", [anObject], smalltalk.BlockClosure)}
 }),
 smalltalk.BlockClosure);
 
@@ -67,11 +77,11 @@ smalltalk.addMethod(
 "_newValue_value_",
 smalltalk.method({
 selector: "newValue:value:",
-fn: function (anObject, anObject2) {
-    var self = this;
-    return new self(anObject, anObject2);
-    return self;
-}
+fn: function (anObject,anObject2){
+var self=this;
+return smalltalk.withContext(function($ctx) { return new self(anObject, anObject2);
+;
+return self}, self, "newValue:value:", [anObject,anObject2], smalltalk.BlockClosure)}
 }),
 smalltalk.BlockClosure);
 
@@ -79,11 +89,11 @@ smalltalk.addMethod(
 "_newValue_value_value_",
 smalltalk.method({
 selector: "newValue:value:value:",
-fn: function (anObject, anObject2, anObject3) {
-    var self = this;
-    return new self(anObject, anObject2);
-    return self;
-}
+fn: function (anObject,anObject2,anObject3){
+var self=this;
+return smalltalk.withContext(function($ctx) { return new self(anObject, anObject2);
+;
+return self}, self, "newValue:value:value:", [anObject,anObject2,anObject3], smalltalk.BlockClosure)}
 }),
 smalltalk.BlockClosure);
 
@@ -91,11 +101,11 @@ smalltalk.addMethod(
 "_numArgs",
 smalltalk.method({
 selector: "numArgs",
-fn: function () {
-    var self = this;
-    return self.length;
-    return self;
-}
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { return self.length;
+;
+return self}, self, "numArgs", [], smalltalk.BlockClosure)}
 }),
 smalltalk.BlockClosure);
 
@@ -103,12 +113,19 @@ smalltalk.addMethod(
 "_on_do_",
 smalltalk.method({
 selector: "on:do:",
-fn: function (anErrorClass, aBlock) {
-    var self = this;
-    var $2, $1;
-    $1 = smalltalk.send(self, "_try_catch_", [self, function (error) {$2 = smalltalk.send(error, "_isKindOf_", [anErrorClass]);if (smalltalk.assert($2)) {return smalltalk.send(aBlock, "_value_", [error]);} else {return smalltalk.send(error, "_signal", []);}}]);
-    return $1;
-}
+fn: function (anErrorClass,aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx) { var $2,$1;
+$1=_st(self)._try_catch_(self,(function(error){
+$2=_st(error)._isKindOf_(anErrorClass);
+if(smalltalk.assert($2)){
+return _st(aBlock)._value_(error);
+} else {
+return _st(error)._signal();
+};
+}));
+return $1;
+}, self, "on:do:", [anErrorClass,aBlock], smalltalk.BlockClosure)}
 }),
 smalltalk.BlockClosure);
 
@@ -116,12 +133,12 @@ smalltalk.addMethod(
 "_timeToRun",
 smalltalk.method({
 selector: "timeToRun",
-fn: function () {
-    var self = this;
-    var $1;
-    $1 = smalltalk.send(smalltalk.Date || Date, "_millisecondsToRun_", [self]);
-    return $1;
-}
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st((smalltalk.Date || Date))._millisecondsToRun_(self);
+return $1;
+}, self, "timeToRun", [], smalltalk.BlockClosure)}
 }),
 smalltalk.BlockClosure);
 
@@ -129,11 +146,11 @@ smalltalk.addMethod(
 "_value",
 smalltalk.method({
 selector: "value",
-fn: function () {
-    var self = this;
-    return self();
-    return self;
-}
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { return self();;
+;
+return self}, self, "value", [], smalltalk.BlockClosure)}
 }),
 smalltalk.BlockClosure);
 
@@ -141,11 +158,11 @@ smalltalk.addMethod(
 "_value_",
 smalltalk.method({
 selector: "value:",
-fn: function (anArg) {
-    var self = this;
-    return self(anArg);
-    return self;
-}
+fn: function (anArg){
+var self=this;
+return smalltalk.withContext(function($ctx) { return self(anArg);;
+;
+return self}, self, "value:", [anArg], smalltalk.BlockClosure)}
 }),
 smalltalk.BlockClosure);
 
@@ -153,11 +170,11 @@ smalltalk.addMethod(
 "_value_value_",
 smalltalk.method({
 selector: "value:value:",
-fn: function (firstArg, secondArg) {
-    var self = this;
-    return self(firstArg, secondArg);
-    return self;
-}
+fn: function (firstArg,secondArg){
+var self=this;
+return smalltalk.withContext(function($ctx) { return self(firstArg, secondArg);;
+;
+return self}, self, "value:value:", [firstArg,secondArg], smalltalk.BlockClosure)}
 }),
 smalltalk.BlockClosure);
 
@@ -165,11 +182,11 @@ smalltalk.addMethod(
 "_value_value_value_",
 smalltalk.method({
 selector: "value:value:value:",
-fn: function (firstArg, secondArg, thirdArg) {
-    var self = this;
-    return self(firstArg, secondArg, thirdArg);
-    return self;
-}
+fn: function (firstArg,secondArg,thirdArg){
+var self=this;
+return smalltalk.withContext(function($ctx) { return self(firstArg, secondArg, thirdArg);;
+;
+return self}, self, "value:value:value:", [firstArg,secondArg,thirdArg], smalltalk.BlockClosure)}
 }),
 smalltalk.BlockClosure);
 
@@ -177,11 +194,11 @@ smalltalk.addMethod(
 "_valueWithInterval_",
 smalltalk.method({
 selector: "valueWithInterval:",
-fn: function (aNumber) {
-    var self = this;
-    return setInterval(self, aNumber);
-    return self;
-}
+fn: function (aNumber){
+var self=this;
+return smalltalk.withContext(function($ctx) { return setInterval(self, aNumber);
+;
+return self}, self, "valueWithInterval:", [aNumber], smalltalk.BlockClosure)}
 }),
 smalltalk.BlockClosure);
 
@@ -189,11 +206,11 @@ smalltalk.addMethod(
 "_valueWithPossibleArguments_",
 smalltalk.method({
 selector: "valueWithPossibleArguments:",
-fn: function (aCollection) {
-    var self = this;
-    return self.apply(null, aCollection);
-    return self;
-}
+fn: function (aCollection){
+var self=this;
+return smalltalk.withContext(function($ctx) { return self.apply(null, aCollection);;
+;
+return self}, self, "valueWithPossibleArguments:", [aCollection], smalltalk.BlockClosure)}
 }),
 smalltalk.BlockClosure);
 
@@ -201,11 +218,11 @@ smalltalk.addMethod(
 "_valueWithTimeout_",
 smalltalk.method({
 selector: "valueWithTimeout:",
-fn: function (aNumber) {
-    var self = this;
-    return setTimeout(self, aNumber);
-    return self;
-}
+fn: function (aNumber){
+var self=this;
+return smalltalk.withContext(function($ctx) { return setTimeout(self, aNumber);
+;
+return self}, self, "valueWithTimeout:", [aNumber], smalltalk.BlockClosure)}
 }),
 smalltalk.BlockClosure);
 
@@ -213,11 +230,11 @@ smalltalk.addMethod(
 "_whileFalse",
 smalltalk.method({
 selector: "whileFalse",
-fn: function () {
-    var self = this;
-    smalltalk.send(self, "_whileFalse_", [function () {}]);
-    return self;
-}
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { _st(self)._whileFalse_((function(){
+}));
+return self}, self, "whileFalse", [], smalltalk.BlockClosure)}
 }),
 smalltalk.BlockClosure);
 
@@ -225,13 +242,11 @@ smalltalk.addMethod(
 "_whileFalse_",
 smalltalk.method({
 selector: "whileFalse:",
-fn: function (aBlock) {
-    var self = this;
-    while (!self()) {
-        aBlock();
-    }
-    return self;
-}
+fn: function (aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx) { while(!self()) {aBlock()};
+;
+return self}, self, "whileFalse:", [aBlock], smalltalk.BlockClosure)}
 }),
 smalltalk.BlockClosure);
 
@@ -239,11 +254,11 @@ smalltalk.addMethod(
 "_whileTrue",
 smalltalk.method({
 selector: "whileTrue",
-fn: function () {
-    var self = this;
-    smalltalk.send(self, "_whileTrue_", [function () {}]);
-    return self;
-}
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { _st(self)._whileTrue_((function(){
+}));
+return self}, self, "whileTrue", [], smalltalk.BlockClosure)}
 }),
 smalltalk.BlockClosure);
 
@@ -251,13 +266,11 @@ smalltalk.addMethod(
 "_whileTrue_",
 smalltalk.method({
 selector: "whileTrue:",
-fn: function (aBlock) {
-    var self = this;
-    while (self()) {
-        aBlock();
-    }
-    return self;
-}
+fn: function (aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx) { while(self()) {aBlock()};
+;
+return self}, self, "whileTrue:", [aBlock], smalltalk.BlockClosure)}
 }),
 smalltalk.BlockClosure);
 
@@ -268,11 +281,11 @@ smalltalk.addMethod(
 "_arguments",
 smalltalk.method({
 selector: "arguments",
-fn: function () {
-    var self = this;
-    return self.args || [];
-    return self;
-}
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { return self.args || [];
+;
+return self}, self, "arguments", [], smalltalk.CompiledMethod)}
 }),
 smalltalk.CompiledMethod);
 
@@ -280,17 +293,17 @@ smalltalk.addMethod(
 "_category",
 smalltalk.method({
 selector: "category",
-fn: function () {
-    var self = this;
-    var $2, $1;
-    $2 = smalltalk.send(self, "_basicAt_", ["category"]);
-    if (($receiver = $2) == nil || $receiver == undefined) {
-        $1 = "";
-    } else {
-        $1 = $2;
-    }
-    return $1;
-}
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { var $2,$1;
+$2=_st(self)._basicAt_("category");
+if(($receiver = $2) == nil || $receiver == undefined){
+$1="";
+} else {
+$1=$2;
+};
+return $1;
+}, self, "category", [], smalltalk.CompiledMethod)}
 }),
 smalltalk.CompiledMethod);
 
@@ -300,22 +313,22 @@ smalltalk.method({
 selector: "category:",
 fn: function (aString){
 var self=this;
-var $1;
+return smalltalk.withContext(function($ctx) { var $1;
 var oldCategory;
-oldCategory=smalltalk.send(self,"_category",[]);
-smalltalk.send(self,"_basicAt_put_",["category",aString]);
-$1=smalltalk.send(self,"_methodClass",[]);
+oldCategory=_st(self)._category();
+_st(self)._basicAt_put_("category",aString);
+$1=_st(self)._methodClass();
 if(($receiver = $1) == nil || $receiver == undefined){
 $1;
 } else {
-smalltalk.send(smalltalk.send(smalltalk.send(self,"_methodClass",[]),"_organization",[]),"_addElement_",[aString]);
-smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self,"_methodClass",[]),"_methods",[]),"_select_",[(function(each){
-return smalltalk.send(smalltalk.send(each,"_category",[]),"__eq",[oldCategory]);
-})]),"_ifEmpty_",[(function(){
-return smalltalk.send(smalltalk.send(smalltalk.send(self,"_methodClass",[]),"_organization",[]),"_removeElement_",[oldCategory]);
-})]);
+_st(_st(_st(self)._methodClass())._organization())._addElement_(aString);
+_st(_st(_st(_st(self)._methodClass())._methods())._select_((function(each){
+return _st(_st(each)._category()).__eq(oldCategory);
+})))._ifEmpty_((function(){
+return _st(_st(_st(self)._methodClass())._organization())._removeElement_(oldCategory);
+}));
 };
-return self}
+return self}, self, "category:", [aString], smalltalk.CompiledMethod)}
 }),
 smalltalk.CompiledMethod);
 
@@ -323,12 +336,12 @@ smalltalk.addMethod(
 "_fn",
 smalltalk.method({
 selector: "fn",
-fn: function () {
-    var self = this;
-    var $1;
-    $1 = smalltalk.send(self, "_basicAt_", ["fn"]);
-    return $1;
-}
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st(self)._basicAt_("fn");
+return $1;
+}, self, "fn", [], smalltalk.CompiledMethod)}
 }),
 smalltalk.CompiledMethod);
 
@@ -336,11 +349,10 @@ smalltalk.addMethod(
 "_fn_",
 smalltalk.method({
 selector: "fn:",
-fn: function (aBlock) {
-    var self = this;
-    smalltalk.send(self, "_basicAt_put_", ["fn", aBlock]);
-    return self;
-}
+fn: function (aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx) { _st(self)._basicAt_put_("fn",aBlock);
+return self}, self, "fn:", [aBlock], smalltalk.CompiledMethod)}
 }),
 smalltalk.CompiledMethod);
 
@@ -348,12 +360,12 @@ smalltalk.addMethod(
 "_messageSends",
 smalltalk.method({
 selector: "messageSends",
-fn: function () {
-    var self = this;
-    var $1;
-    $1 = smalltalk.send(self, "_basicAt_", ["messageSends"]);
-    return $1;
-}
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st(self)._basicAt_("messageSends");
+return $1;
+}, self, "messageSends", [], smalltalk.CompiledMethod)}
 }),
 smalltalk.CompiledMethod);
 
@@ -361,12 +373,12 @@ smalltalk.addMethod(
 "_methodClass",
 smalltalk.method({
 selector: "methodClass",
-fn: function () {
-    var self = this;
-    var $1;
-    $1 = smalltalk.send(self, "_basicAt_", ["methodClass"]);
-    return $1;
-}
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st(self)._basicAt_("methodClass");
+return $1;
+}, self, "methodClass", [], smalltalk.CompiledMethod)}
 }),
 smalltalk.CompiledMethod);
 
@@ -374,12 +386,12 @@ smalltalk.addMethod(
 "_protocol",
 smalltalk.method({
 selector: "protocol",
-fn: function () {
-    var self = this;
-    var $1;
-    $1 = smalltalk.send(self, "_category", []);
-    return $1;
-}
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st(self)._category();
+return $1;
+}, self, "protocol", [], smalltalk.CompiledMethod)}
 }),
 smalltalk.CompiledMethod);
 
@@ -387,12 +399,12 @@ smalltalk.addMethod(
 "_referencedClasses",
 smalltalk.method({
 selector: "referencedClasses",
-fn: function () {
-    var self = this;
-    var $1;
-    $1 = smalltalk.send(self, "_basicAt_", ["referencedClasses"]);
-    return $1;
-}
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st(self)._basicAt_("referencedClasses");
+return $1;
+}, self, "referencedClasses", [], smalltalk.CompiledMethod)}
 }),
 smalltalk.CompiledMethod);
 
@@ -400,12 +412,12 @@ smalltalk.addMethod(
 "_selector",
 smalltalk.method({
 selector: "selector",
-fn: function () {
-    var self = this;
-    var $1;
-    $1 = smalltalk.send(self, "_basicAt_", ["selector"]);
-    return $1;
-}
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st(self)._basicAt_("selector");
+return $1;
+}, self, "selector", [], smalltalk.CompiledMethod)}
 }),
 smalltalk.CompiledMethod);
 
@@ -413,11 +425,10 @@ smalltalk.addMethod(
 "_selector_",
 smalltalk.method({
 selector: "selector:",
-fn: function (aString) {
-    var self = this;
-    smalltalk.send(self, "_basicAt_put_", ["selector", aString]);
-    return self;
-}
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx) { _st(self)._basicAt_put_("selector",aString);
+return self}, self, "selector:", [aString], smalltalk.CompiledMethod)}
 }),
 smalltalk.CompiledMethod);
 
@@ -425,17 +436,17 @@ smalltalk.addMethod(
 "_source",
 smalltalk.method({
 selector: "source",
-fn: function () {
-    var self = this;
-    var $2, $1;
-    $2 = smalltalk.send(self, "_basicAt_", ["source"]);
-    if (($receiver = $2) == nil || $receiver == undefined) {
-        $1 = "";
-    } else {
-        $1 = $2;
-    }
-    return $1;
-}
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { var $2,$1;
+$2=_st(self)._basicAt_("source");
+if(($receiver = $2) == nil || $receiver == undefined){
+$1="";
+} else {
+$1=$2;
+};
+return $1;
+}, self, "source", [], smalltalk.CompiledMethod)}
 }),
 smalltalk.CompiledMethod);
 
@@ -443,11 +454,10 @@ smalltalk.addMethod(
 "_source_",
 smalltalk.method({
 selector: "source:",
-fn: function (aString) {
-    var self = this;
-    smalltalk.send(self, "_basicAt_put_", ["source", aString]);
-    return self;
-}
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx) { _st(self)._basicAt_put_("source",aString);
+return self}, self, "source:", [aString], smalltalk.CompiledMethod)}
 }),
 smalltalk.CompiledMethod);
 
@@ -458,10 +468,10 @@ smalltalk.addMethod(
 "_arguments",
 smalltalk.method({
 selector: "arguments",
-fn: function () {
-    var self = this;
-    return self['@arguments'];
-}
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { return self["@arguments"];
+}, self, "arguments", [], smalltalk.Message)}
 }),
 smalltalk.Message);
 
@@ -469,11 +479,10 @@ smalltalk.addMethod(
 "_arguments_",
 smalltalk.method({
 selector: "arguments:",
-fn: function (anArray) {
-    var self = this;
-    self['@arguments'] = anArray;
-    return self;
-}
+fn: function (anArray){
+var self=this;
+return smalltalk.withContext(function($ctx) { self["@arguments"]=anArray;
+return self}, self, "arguments:", [anArray], smalltalk.Message)}
 }),
 smalltalk.Message);
 
@@ -481,12 +490,18 @@ smalltalk.addMethod(
 "_printString",
 smalltalk.method({
 selector: "printString",
-fn: function () {
-    var self = this;
-    var $2, $1;
-    $1 = smalltalk.send(smalltalk.String || String, "_streamContents_", [function (aStream) {smalltalk.send(aStream, "_nextPutAll_", [smalltalk.send(self, "_printString", [], smalltalk.Object)]);smalltalk.send(aStream, "_nextPutAll_", ["("]);smalltalk.send(aStream, "_nextPutAll_", [self['@selector']]);$2 = smalltalk.send(aStream, "_nextPutAll_", [")"]);return $2;}]);
-    return $1;
-}
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { var $2,$1;
+$1=_st((smalltalk.String || String))._streamContents_((function(aStream){
+_st(aStream)._nextPutAll_(smalltalk.Object.fn.prototype._printString.apply(_st(self), []));
+_st(aStream)._nextPutAll_("(");
+_st(aStream)._nextPutAll_(self["@selector"]);
+$2=_st(aStream)._nextPutAll_(")");
+return $2;
+}));
+return $1;
+}, self, "printString", [], smalltalk.Message)}
 }),
 smalltalk.Message);
 
@@ -494,10 +509,10 @@ smalltalk.addMethod(
 "_selector",
 smalltalk.method({
 selector: "selector",
-fn: function () {
-    var self = this;
-    return self['@selector'];
-}
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { return self["@selector"];
+}, self, "selector", [], smalltalk.Message)}
 }),
 smalltalk.Message);
 
@@ -505,11 +520,10 @@ smalltalk.addMethod(
 "_selector_",
 smalltalk.method({
 selector: "selector:",
-fn: function (aString) {
-    var self = this;
-    self['@selector'] = aString;
-    return self;
-}
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx) { self["@selector"]=aString;
+return self}, self, "selector:", [aString], smalltalk.Message)}
 }),
 smalltalk.Message);
 
@@ -517,12 +531,12 @@ smalltalk.addMethod(
 "_sendTo_",
 smalltalk.method({
 selector: "sendTo:",
-fn: function (anObject) {
-    var self = this;
-    var $1;
-    $1 = smalltalk.send(smalltalk.send(smalltalk.Smalltalk || Smalltalk, "_current", []), "_send_to_arguments_", [smalltalk.send(self, "_selector", []), anObject, smalltalk.send(self, "_arguments", [])]);
-    return $1;
-}
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st(_st((smalltalk.Smalltalk || Smalltalk))._current())._send_to_arguments_(_st(self)._selector(),anObject,_st(self)._arguments());
+return $1;
+}, self, "sendTo:", [anObject], smalltalk.Message)}
 }),
 smalltalk.Message);
 
@@ -531,16 +545,16 @@ smalltalk.addMethod(
 "_selector_arguments_",
 smalltalk.method({
 selector: "selector:arguments:",
-fn: function (aString, anArray) {
-    var self = this;
-    var $2, $3, $1;
-    $2 = smalltalk.send(self, "_new", []);
-    smalltalk.send($2, "_selector_", [aString]);
-    smalltalk.send($2, "_arguments_", [anArray]);
-    $3 = smalltalk.send($2, "_yourself", []);
-    $1 = $3;
-    return $1;
-}
+fn: function (aString,anArray){
+var self=this;
+return smalltalk.withContext(function($ctx) { var $2,$3,$1;
+$2=_st(self)._new();
+_st($2)._selector_(aString);
+_st($2)._arguments_(anArray);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, self, "selector:arguments:", [aString,anArray], smalltalk.Message.klass)}
 }),
 smalltalk.Message.klass);
 
@@ -550,12 +564,12 @@ smalltalk.addMethod(
 "_asString",
 smalltalk.method({
 selector: "asString",
-fn: function () {
-    var self = this;
-    var $1;
-    $1 = smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_receiver", []), "_class", []), "_printString", []), "__comma", [" >> "]), "__comma", [smalltalk.send(self, "_selector", [])]);
-    return $1;
-}
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st(_st(_st(_st(_st(self)._receiver())._class())._printString()).__comma(" >> ")).__comma(_st(self)._selector());
+return $1;
+}, self, "asString", [], smalltalk.MethodContext)}
 }),
 smalltalk.MethodContext);
 
@@ -563,11 +577,35 @@ smalltalk.addMethod(
 "_home",
 smalltalk.method({
 selector: "home",
-fn: function () {
-    var self = this;
-    return self.homeContext;
-    return self;
-}
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { return self.homeContext;
+;
+return self}, self, "home", [], smalltalk.MethodContext)}
+}),
+smalltalk.MethodContext);
+
+smalltalk.addMethod(
+"_locals",
+smalltalk.method({
+selector: "locals",
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { return self.locals;
+;
+return self}, self, "locals", [], smalltalk.MethodContext)}
+}),
+smalltalk.MethodContext);
+
+smalltalk.addMethod(
+"_method",
+smalltalk.method({
+selector: "method",
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { return self.method();
+;
+return self}, self, "method", [], smalltalk.MethodContext)}
 }),
 smalltalk.MethodContext);
 
@@ -575,11 +613,11 @@ smalltalk.addMethod(
 "_pc",
 smalltalk.method({
 selector: "pc",
-fn: function () {
-    var self = this;
-    return self.pc;
-    return self;
-}
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { return self.pc;
+;
+return self}, self, "pc", [], smalltalk.MethodContext)}
 }),
 smalltalk.MethodContext);
 
@@ -587,12 +625,12 @@ smalltalk.addMethod(
 "_printString",
 smalltalk.method({
 selector: "printString",
-fn: function () {
-    var self = this;
-    var $1;
-    $1 = smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_printString", [], smalltalk.Object), "__comma", ["("]), "__comma", [smalltalk.send(self, "_asString", [])]), "__comma", [")"]);
-    return $1;
-}
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st(_st(_st(smalltalk.Object.fn.prototype._printString.apply(_st(self), [])).__comma("(")).__comma(_st(self)._asString())).__comma(")");
+return $1;
+}, self, "printString", [], smalltalk.MethodContext)}
 }),
 smalltalk.MethodContext);
 
@@ -600,11 +638,11 @@ smalltalk.addMethod(
 "_receiver",
 smalltalk.method({
 selector: "receiver",
-fn: function () {
-    var self = this;
-    return self.receiver;
-    return self;
-}
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { return self.receiver;
+;
+return self}, self, "receiver", [], smalltalk.MethodContext)}
 }),
 smalltalk.MethodContext);
 
@@ -612,11 +650,11 @@ smalltalk.addMethod(
 "_selector",
 smalltalk.method({
 selector: "selector",
-fn: function () {
-    var self = this;
-    return smalltalk.convertSelector(self.selector);
-    return self;
-}
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { return smalltalk.convertSelector(self.selector);
+;
+return self}, self, "selector", [], smalltalk.MethodContext)}
 }),
 smalltalk.MethodContext);
 
@@ -624,11 +662,12 @@ smalltalk.addMethod(
 "_temps",
 smalltalk.method({
 selector: "temps",
-fn: function () {
-    var self = this;
-    return self.temps;
-    return self;
-}
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st(self)._locals();
+return $1;
+}, self, "temps", [], smalltalk.MethodContext)}
 }),
 smalltalk.MethodContext);
 

+ 331 - 282
js/Kernel-Methods.js

@@ -6,11 +6,11 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "applyTo:arguments:",
 category: 'evaluating',
-fn: function (anObject, aCollection) {
-    var self = this;
-    return self.apply(anObject, aCollection);
-    return self;
-},
+fn: function (anObject,aCollection){
+var self=this;
+return smalltalk.withContext(function($ctx) { return self.apply(anObject, aCollection);
+;
+return self}, self, "applyTo:arguments:", [anObject,aCollection], smalltalk.BlockClosure)},
 args: ["anObject", "aCollection"],
 source: "applyTo: anObject arguments: aCollection\x0a\x09<return self.apply(anObject, aCollection)>",
 messageSends: [],
@@ -23,11 +23,11 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "compiledSource",
 category: 'accessing',
-fn: function () {
-    var self = this;
-    return self.toString();
-    return self;
-},
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { return self.toString();
+;
+return self}, self, "compiledSource", [], smalltalk.BlockClosure)},
 args: [],
 source: "compiledSource\x0a\x09<return self.toString()>",
 messageSends: [],
@@ -40,14 +40,24 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "ensure:",
 category: 'evaluating',
-fn: function (aBlock) {
-    var self = this;
-    var $1;
-    var success;
-    success = false;
-    $1 = smalltalk.send(function () {smalltalk.send(self, "_value", []);success = true;success;return smalltalk.send(aBlock, "_value", []);}, "_on_do_", [smalltalk.Error || Error, function (ex) {if (!smalltalk.assert(success)) {smalltalk.send(aBlock, "_value", []);}return smalltalk.send(ex, "_signal", []);}]);
-    return $1;
-},
+fn: function (aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx) { var $1;
+var success;
+success=false;
+$1=_st((function(){
+_st(self)._value();
+success=true;
+success;
+return _st(aBlock)._value();
+}))._on_do_((smalltalk.Error || Error),(function(ex){
+if(! smalltalk.assert(success)){
+_st(aBlock)._value();
+};
+return _st(ex)._signal();
+}));
+return $1;
+}, self, "ensure:", [aBlock], smalltalk.BlockClosure)},
 args: ["aBlock"],
 source: "ensure: aBlock\x0a\x09| success |\x0a\x09success := false.\x0a\x09^[self value. success := true. aBlock value]\x0a\x09\x09on: Error\x0a\x09\x09do: [:ex |\x0a\x09\x09\x09success ifFalse: [aBlock value].\x0a\x09\x09\x09ex signal]",
 messageSends: ["on:do:", "ifFalse:", "value", "signal"],
@@ -60,11 +70,11 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "new",
 category: 'evaluating',
-fn: function () {
-    var self = this;
-    return new self;
-    return self;
-},
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { return new self();
+;
+return self}, self, "new", [], smalltalk.BlockClosure)},
 args: [],
 source: "new\x0a\x09\x22Use the receiver as a JS constructor. \x0a\x09*Do not* use this method to instanciate Smalltalk objects!\x22\x0a\x09<return new self()>",
 messageSends: [],
@@ -77,11 +87,11 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "newValue:",
 category: 'evaluating',
-fn: function (anObject) {
-    var self = this;
-    return new self(anObject);
-    return self;
-},
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx) { return new self(anObject);
+;
+return self}, self, "newValue:", [anObject], smalltalk.BlockClosure)},
 args: ["anObject"],
 source: "newValue: anObject\x0a\x09\x22Use the receiver as a JS constructor. \x0a\x09*Do not* use this method to instanciate Smalltalk objects!\x22\x0a\x09<return new self(anObject)>",
 messageSends: [],
@@ -94,11 +104,11 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "newValue:value:",
 category: 'evaluating',
-fn: function (anObject, anObject2) {
-    var self = this;
-    return new self(anObject, anObject2);
-    return self;
-},
+fn: function (anObject,anObject2){
+var self=this;
+return smalltalk.withContext(function($ctx) { return new self(anObject, anObject2);
+;
+return self}, self, "newValue:value:", [anObject,anObject2], smalltalk.BlockClosure)},
 args: ["anObject", "anObject2"],
 source: "newValue:  anObject value: anObject2\x0a\x09\x22Use the receiver as a JS constructor. \x0a\x09*Do not* use this method to instanciate Smalltalk objects!\x22\x0a\x09<return new self(anObject, anObject2)>",
 messageSends: [],
@@ -111,11 +121,11 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "newValue:value:value:",
 category: 'evaluating',
-fn: function (anObject, anObject2, anObject3) {
-    var self = this;
-    return new self(anObject, anObject2);
-    return self;
-},
+fn: function (anObject,anObject2,anObject3){
+var self=this;
+return smalltalk.withContext(function($ctx) { return new self(anObject, anObject2);
+;
+return self}, self, "newValue:value:value:", [anObject,anObject2,anObject3], smalltalk.BlockClosure)},
 args: ["anObject", "anObject2", "anObject3"],
 source: "newValue:  anObject value: anObject2 value: anObject3\x0a\x09\x22Use the receiver as a JS constructor. \x0a\x09*Do not* use this method to instanciate Smalltalk objects!\x22\x0a\x09<return new self(anObject, anObject2)>",
 messageSends: [],
@@ -128,11 +138,11 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "numArgs",
 category: 'accessing',
-fn: function () {
-    var self = this;
-    return self.length;
-    return self;
-},
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { return self.length;
+;
+return self}, self, "numArgs", [], smalltalk.BlockClosure)},
 args: [],
 source: "numArgs\x0a\x09<return self.length>",
 messageSends: [],
@@ -145,12 +155,19 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "on:do:",
 category: 'error handling',
-fn: function (anErrorClass, aBlock) {
-    var self = this;
-    var $2, $1;
-    $1 = smalltalk.send(self, "_try_catch_", [self, function (error) {$2 = smalltalk.send(error, "_isKindOf_", [anErrorClass]);if (smalltalk.assert($2)) {return smalltalk.send(aBlock, "_value_", [error]);} else {return smalltalk.send(error, "_signal", []);}}]);
-    return $1;
-},
+fn: function (anErrorClass,aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx) { var $2,$1;
+$1=_st(self)._try_catch_(self,(function(error){
+$2=_st(error)._isKindOf_(anErrorClass);
+if(smalltalk.assert($2)){
+return _st(aBlock)._value_(error);
+} else {
+return _st(error)._signal();
+};
+}));
+return $1;
+}, self, "on:do:", [anErrorClass,aBlock], smalltalk.BlockClosure)},
 args: ["anErrorClass", "aBlock"],
 source: "on: anErrorClass do: aBlock\x0a\x09^self try: self catch: [:error |\x0a\x09    (error isKindOf: anErrorClass) \x0a\x09     ifTrue: [aBlock value: error]\x0a\x09     ifFalse: [error signal]]",
 messageSends: ["try:catch:", "ifTrue:ifFalse:", "value:", "signal", "isKindOf:"],
@@ -163,12 +180,12 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "timeToRun",
 category: 'evaluating',
-fn: function () {
-    var self = this;
-    var $1;
-    $1 = smalltalk.send(smalltalk.Date || Date, "_millisecondsToRun_", [self]);
-    return $1;
-},
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st((smalltalk.Date || Date))._millisecondsToRun_(self);
+return $1;
+}, self, "timeToRun", [], smalltalk.BlockClosure)},
 args: [],
 source: "timeToRun\x0a\x09\x22Answer the number of milliseconds taken to execute this block.\x22\x0a\x0a\x09^ Date millisecondsToRun: self",
 messageSends: ["millisecondsToRun:"],
@@ -181,11 +198,11 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "value",
 category: 'evaluating',
-fn: function () {
-    var self = this;
-    return self();
-    return self;
-},
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { return self();;
+;
+return self}, self, "value", [], smalltalk.BlockClosure)},
 args: [],
 source: "value\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<return self();>",
 messageSends: [],
@@ -198,11 +215,11 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "value:",
 category: 'evaluating',
-fn: function (anArg) {
-    var self = this;
-    return self(anArg);
-    return self;
-},
+fn: function (anArg){
+var self=this;
+return smalltalk.withContext(function($ctx) { return self(anArg);;
+;
+return self}, self, "value:", [anArg], smalltalk.BlockClosure)},
 args: ["anArg"],
 source: "value: anArg\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<return self(anArg);>",
 messageSends: [],
@@ -215,11 +232,11 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "value:value:",
 category: 'evaluating',
-fn: function (firstArg, secondArg) {
-    var self = this;
-    return self(firstArg, secondArg);
-    return self;
-},
+fn: function (firstArg,secondArg){
+var self=this;
+return smalltalk.withContext(function($ctx) { return self(firstArg, secondArg);;
+;
+return self}, self, "value:value:", [firstArg,secondArg], smalltalk.BlockClosure)},
 args: ["firstArg", "secondArg"],
 source: "value: firstArg value: secondArg\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<return self(firstArg, secondArg);>",
 messageSends: [],
@@ -232,11 +249,11 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "value:value:value:",
 category: 'evaluating',
-fn: function (firstArg, secondArg, thirdArg) {
-    var self = this;
-    return self(firstArg, secondArg, thirdArg);
-    return self;
-},
+fn: function (firstArg,secondArg,thirdArg){
+var self=this;
+return smalltalk.withContext(function($ctx) { return self(firstArg, secondArg, thirdArg);;
+;
+return self}, self, "value:value:value:", [firstArg,secondArg,thirdArg], smalltalk.BlockClosure)},
 args: ["firstArg", "secondArg", "thirdArg"],
 source: "value: firstArg value: secondArg value: thirdArg\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<return self(firstArg, secondArg, thirdArg);>",
 messageSends: [],
@@ -249,11 +266,11 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "valueWithInterval:",
 category: 'timeout/interval',
-fn: function (aNumber) {
-    var self = this;
-    return setInterval(self, aNumber);
-    return self;
-},
+fn: function (aNumber){
+var self=this;
+return smalltalk.withContext(function($ctx) { return setInterval(self, aNumber);
+;
+return self}, self, "valueWithInterval:", [aNumber], smalltalk.BlockClosure)},
 args: ["aNumber"],
 source: "valueWithInterval: aNumber\x0a\x09<return setInterval(self, aNumber)>",
 messageSends: [],
@@ -266,11 +283,11 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "valueWithPossibleArguments:",
 category: 'evaluating',
-fn: function (aCollection) {
-    var self = this;
-    return self.apply(null, aCollection);
-    return self;
-},
+fn: function (aCollection){
+var self=this;
+return smalltalk.withContext(function($ctx) { return self.apply(null, aCollection);;
+;
+return self}, self, "valueWithPossibleArguments:", [aCollection], smalltalk.BlockClosure)},
 args: ["aCollection"],
 source: "valueWithPossibleArguments: aCollection\x0a\x09<return self.apply(null, aCollection);>",
 messageSends: [],
@@ -283,11 +300,11 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "valueWithTimeout:",
 category: 'timeout/interval',
-fn: function (aNumber) {
-    var self = this;
-    return setTimeout(self, aNumber);
-    return self;
-},
+fn: function (aNumber){
+var self=this;
+return smalltalk.withContext(function($ctx) { return setTimeout(self, aNumber);
+;
+return self}, self, "valueWithTimeout:", [aNumber], smalltalk.BlockClosure)},
 args: ["aNumber"],
 source: "valueWithTimeout: aNumber\x0a\x09<return setTimeout(self, aNumber)>",
 messageSends: [],
@@ -300,11 +317,11 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "whileFalse",
 category: 'controlling',
-fn: function () {
-    var self = this;
-    smalltalk.send(self, "_whileFalse_", [function () {}]);
-    return self;
-},
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { _st(self)._whileFalse_((function(){
+}));
+return self}, self, "whileFalse", [], smalltalk.BlockClosure)},
 args: [],
 source: "whileFalse\x0a\x09\x22inlined in the Compiler\x22\x0a\x09self whileFalse: []",
 messageSends: ["whileFalse:"],
@@ -317,13 +334,11 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "whileFalse:",
 category: 'controlling',
-fn: function (aBlock) {
-    var self = this;
-    while (!self()) {
-        aBlock();
-    }
-    return self;
-},
+fn: function (aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx) { while(!self()) {aBlock()};
+;
+return self}, self, "whileFalse:", [aBlock], smalltalk.BlockClosure)},
 args: ["aBlock"],
 source: "whileFalse: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<while(!self()) {aBlock()}>",
 messageSends: [],
@@ -336,11 +351,11 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "whileTrue",
 category: 'controlling',
-fn: function () {
-    var self = this;
-    smalltalk.send(self, "_whileTrue_", [function () {}]);
-    return self;
-},
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { _st(self)._whileTrue_((function(){
+}));
+return self}, self, "whileTrue", [], smalltalk.BlockClosure)},
 args: [],
 source: "whileTrue\x0a\x09\x22inlined in the Compiler\x22\x0a\x09self whileTrue: []",
 messageSends: ["whileTrue:"],
@@ -353,13 +368,11 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "whileTrue:",
 category: 'controlling',
-fn: function (aBlock) {
-    var self = this;
-    while (self()) {
-        aBlock();
-    }
-    return self;
-},
+fn: function (aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx) { while(self()) {aBlock()};
+;
+return self}, self, "whileTrue:", [aBlock], smalltalk.BlockClosure)},
 args: ["aBlock"],
 source: "whileTrue: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<while(self()) {aBlock()}>",
 messageSends: [],
@@ -376,11 +389,11 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "arguments",
 category: 'accessing',
-fn: function () {
-    var self = this;
-    return self.args || [];
-    return self;
-},
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { return self.args || [];
+;
+return self}, self, "arguments", [], smalltalk.CompiledMethod)},
 args: [],
 source: "arguments\x0a\x09<return self.args || []>",
 messageSends: [],
@@ -393,17 +406,17 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "category",
 category: 'accessing',
-fn: function () {
-    var self = this;
-    var $2, $1;
-    $2 = smalltalk.send(self, "_basicAt_", ["category"]);
-    if (($receiver = $2) == nil || $receiver == undefined) {
-        $1 = "";
-    } else {
-        $1 = $2;
-    }
-    return $1;
-},
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { var $2,$1;
+$2=_st(self)._basicAt_("category");
+if(($receiver = $2) == nil || $receiver == undefined){
+$1="";
+} else {
+$1=$2;
+};
+return $1;
+}, self, "category", [], smalltalk.CompiledMethod)},
 args: [],
 source: "category\x0a\x09^(self basicAt: 'category') ifNil: ['']",
 messageSends: ["ifNil:", "basicAt:"],
@@ -418,22 +431,22 @@ selector: "category:",
 category: 'accessing',
 fn: function (aString){
 var self=this;
-var $1;
+return smalltalk.withContext(function($ctx) { var $1;
 var oldCategory;
-oldCategory=smalltalk.send(self,"_category",[]);
-smalltalk.send(self,"_basicAt_put_",["category",aString]);
-$1=smalltalk.send(self,"_methodClass",[]);
+oldCategory=_st(self)._category();
+_st(self)._basicAt_put_("category",aString);
+$1=_st(self)._methodClass();
 if(($receiver = $1) == nil || $receiver == undefined){
 $1;
 } else {
-smalltalk.send(smalltalk.send(smalltalk.send(self,"_methodClass",[]),"_organization",[]),"_addElement_",[aString]);
-smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self,"_methodClass",[]),"_methods",[]),"_select_",[(function(each){
-return smalltalk.send(smalltalk.send(each,"_category",[]),"__eq",[oldCategory]);
-})]),"_ifEmpty_",[(function(){
-return smalltalk.send(smalltalk.send(smalltalk.send(self,"_methodClass",[]),"_organization",[]),"_removeElement_",[oldCategory]);
-})]);
+_st(_st(_st(self)._methodClass())._organization())._addElement_(aString);
+_st(_st(_st(_st(self)._methodClass())._methods())._select_((function(each){
+return _st(_st(each)._category()).__eq(oldCategory);
+})))._ifEmpty_((function(){
+return _st(_st(_st(self)._methodClass())._organization())._removeElement_(oldCategory);
+}));
 };
-return self},
+return self}, self, "category:", [aString], smalltalk.CompiledMethod)},
 args: ["aString"],
 source: "category: aString\x0a\x09| oldCategory |\x0a    oldCategory := self category.\x0a\x09self basicAt: 'category' put: aString.\x0a    \x0a    self methodClass ifNotNil: [\x0a    \x09self methodClass organization addElement: aString.\x0a    \x0a\x09\x09(self methodClass methods \x0a    \x09\x09select: [ :each | each category = oldCategory ])\x0a        \x09ifEmpty: [ self methodClass organization removeElement: oldCategory ] ]",
 messageSends: ["category", "basicAt:put:", "ifNotNil:", "addElement:", "organization", "methodClass", "ifEmpty:", "removeElement:", "select:", "=", "methods"],
@@ -446,12 +459,12 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "fn",
 category: 'accessing',
-fn: function () {
-    var self = this;
-    var $1;
-    $1 = smalltalk.send(self, "_basicAt_", ["fn"]);
-    return $1;
-},
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st(self)._basicAt_("fn");
+return $1;
+}, self, "fn", [], smalltalk.CompiledMethod)},
 args: [],
 source: "fn\x0a\x09^self basicAt: 'fn'",
 messageSends: ["basicAt:"],
@@ -464,11 +477,10 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "fn:",
 category: 'accessing',
-fn: function (aBlock) {
-    var self = this;
-    smalltalk.send(self, "_basicAt_put_", ["fn", aBlock]);
-    return self;
-},
+fn: function (aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx) { _st(self)._basicAt_put_("fn",aBlock);
+return self}, self, "fn:", [aBlock], smalltalk.CompiledMethod)},
 args: ["aBlock"],
 source: "fn: aBlock\x0a\x09self basicAt: 'fn' put: aBlock",
 messageSends: ["basicAt:put:"],
@@ -481,12 +493,12 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "messageSends",
 category: 'accessing',
-fn: function () {
-    var self = this;
-    var $1;
-    $1 = smalltalk.send(self, "_basicAt_", ["messageSends"]);
-    return $1;
-},
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st(self)._basicAt_("messageSends");
+return $1;
+}, self, "messageSends", [], smalltalk.CompiledMethod)},
 args: [],
 source: "messageSends\x0a\x09^self basicAt: 'messageSends'",
 messageSends: ["basicAt:"],
@@ -499,12 +511,12 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "methodClass",
 category: 'accessing',
-fn: function () {
-    var self = this;
-    var $1;
-    $1 = smalltalk.send(self, "_basicAt_", ["methodClass"]);
-    return $1;
-},
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st(self)._basicAt_("methodClass");
+return $1;
+}, self, "methodClass", [], smalltalk.CompiledMethod)},
 args: [],
 source: "methodClass\x0a\x09^self basicAt: 'methodClass'",
 messageSends: ["basicAt:"],
@@ -517,12 +529,12 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "protocol",
 category: 'accessing',
-fn: function () {
-    var self = this;
-    var $1;
-    $1 = smalltalk.send(self, "_category", []);
-    return $1;
-},
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st(self)._category();
+return $1;
+}, self, "protocol", [], smalltalk.CompiledMethod)},
 args: [],
 source: "protocol\x0a\x09^ self category",
 messageSends: ["category"],
@@ -535,12 +547,12 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "referencedClasses",
 category: 'accessing',
-fn: function () {
-    var self = this;
-    var $1;
-    $1 = smalltalk.send(self, "_basicAt_", ["referencedClasses"]);
-    return $1;
-},
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st(self)._basicAt_("referencedClasses");
+return $1;
+}, self, "referencedClasses", [], smalltalk.CompiledMethod)},
 args: [],
 source: "referencedClasses\x0a\x09^self basicAt: 'referencedClasses'",
 messageSends: ["basicAt:"],
@@ -553,12 +565,12 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "selector",
 category: 'accessing',
-fn: function () {
-    var self = this;
-    var $1;
-    $1 = smalltalk.send(self, "_basicAt_", ["selector"]);
-    return $1;
-},
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st(self)._basicAt_("selector");
+return $1;
+}, self, "selector", [], smalltalk.CompiledMethod)},
 args: [],
 source: "selector\x0a\x09^self basicAt: 'selector'",
 messageSends: ["basicAt:"],
@@ -571,11 +583,10 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "selector:",
 category: 'accessing',
-fn: function (aString) {
-    var self = this;
-    smalltalk.send(self, "_basicAt_put_", ["selector", aString]);
-    return self;
-},
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx) { _st(self)._basicAt_put_("selector",aString);
+return self}, self, "selector:", [aString], smalltalk.CompiledMethod)},
 args: ["aString"],
 source: "selector: aString\x0a\x09self basicAt: 'selector' put: aString",
 messageSends: ["basicAt:put:"],
@@ -588,17 +599,17 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "source",
 category: 'accessing',
-fn: function () {
-    var self = this;
-    var $2, $1;
-    $2 = smalltalk.send(self, "_basicAt_", ["source"]);
-    if (($receiver = $2) == nil || $receiver == undefined) {
-        $1 = "";
-    } else {
-        $1 = $2;
-    }
-    return $1;
-},
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { var $2,$1;
+$2=_st(self)._basicAt_("source");
+if(($receiver = $2) == nil || $receiver == undefined){
+$1="";
+} else {
+$1=$2;
+};
+return $1;
+}, self, "source", [], smalltalk.CompiledMethod)},
 args: [],
 source: "source\x0a\x09^(self basicAt: 'source') ifNil: ['']",
 messageSends: ["ifNil:", "basicAt:"],
@@ -611,11 +622,10 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "source:",
 category: 'accessing',
-fn: function (aString) {
-    var self = this;
-    smalltalk.send(self, "_basicAt_put_", ["source", aString]);
-    return self;
-},
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx) { _st(self)._basicAt_put_("source",aString);
+return self}, self, "source:", [aString], smalltalk.CompiledMethod)},
 args: ["aString"],
 source: "source: aString\x0a\x09self basicAt: 'source' put: aString",
 messageSends: ["basicAt:put:"],
@@ -632,10 +642,10 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "arguments",
 category: 'accessing',
-fn: function () {
-    var self = this;
-    return self['@arguments'];
-},
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { return self["@arguments"];
+}, self, "arguments", [], smalltalk.Message)},
 args: [],
 source: "arguments\x0a\x09^arguments",
 messageSends: [],
@@ -648,11 +658,10 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "arguments:",
 category: 'accessing',
-fn: function (anArray) {
-    var self = this;
-    self['@arguments'] = anArray;
-    return self;
-},
+fn: function (anArray){
+var self=this;
+return smalltalk.withContext(function($ctx) { self["@arguments"]=anArray;
+return self}, self, "arguments:", [anArray], smalltalk.Message)},
 args: ["anArray"],
 source: "arguments: anArray\x0a\x09arguments := anArray",
 messageSends: [],
@@ -665,12 +674,18 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "printString",
 category: 'printing',
-fn: function () {
-    var self = this;
-    var $2, $1;
-    $1 = smalltalk.send(smalltalk.String || String, "_streamContents_", [function (aStream) {smalltalk.send(aStream, "_nextPutAll_", [smalltalk.send(self, "_printString", [], smalltalk.Object)]);smalltalk.send(aStream, "_nextPutAll_", ["("]);smalltalk.send(aStream, "_nextPutAll_", [self['@selector']]);$2 = smalltalk.send(aStream, "_nextPutAll_", [")"]);return $2;}]);
-    return $1;
-},
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { var $2,$1;
+$1=_st((smalltalk.String || String))._streamContents_((function(aStream){
+_st(aStream)._nextPutAll_(smalltalk.Object.fn.prototype._printString.apply(_st(self), []));
+_st(aStream)._nextPutAll_("(");
+_st(aStream)._nextPutAll_(self["@selector"]);
+$2=_st(aStream)._nextPutAll_(")");
+return $2;
+}));
+return $1;
+}, self, "printString", [], smalltalk.Message)},
 args: [],
 source: "printString\x0a\x09^ String streamContents: [:aStream|  \x0a                                  \x09\x09\x09\x09aStream \x0a                                  \x09\x09\x09\x09\x09nextPutAll: super printString;\x0a                                  \x09\x09\x09\x09\x09nextPutAll: '(';\x0a                                  \x09\x09\x09\x09\x09nextPutAll: selector;\x0a                                  \x09\x09\x09\x09\x09nextPutAll: ')' \x09\x09\x09\x09]",
 messageSends: ["streamContents:", "nextPutAll:", "printString"],
@@ -683,10 +698,10 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "selector",
 category: 'accessing',
-fn: function () {
-    var self = this;
-    return self['@selector'];
-},
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { return self["@selector"];
+}, self, "selector", [], smalltalk.Message)},
 args: [],
 source: "selector\x0a\x09^selector",
 messageSends: [],
@@ -699,11 +714,10 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "selector:",
 category: 'accessing',
-fn: function (aString) {
-    var self = this;
-    self['@selector'] = aString;
-    return self;
-},
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx) { self["@selector"]=aString;
+return self}, self, "selector:", [aString], smalltalk.Message)},
 args: ["aString"],
 source: "selector: aString\x0a\x09selector := aString",
 messageSends: [],
@@ -716,12 +730,12 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "sendTo:",
 category: 'printing',
-fn: function (anObject) {
-    var self = this;
-    var $1;
-    $1 = smalltalk.send(smalltalk.send(smalltalk.Smalltalk || Smalltalk, "_current", []), "_send_to_arguments_", [smalltalk.send(self, "_selector", []), anObject, smalltalk.send(self, "_arguments", [])]);
-    return $1;
-},
+fn: function (anObject){
+var self=this;
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st(_st((smalltalk.Smalltalk || Smalltalk))._current())._send_to_arguments_(_st(self)._selector(),anObject,_st(self)._arguments());
+return $1;
+}, self, "sendTo:", [anObject], smalltalk.Message)},
 args: ["anObject"],
 source: "sendTo: anObject\x0a\x09^ Smalltalk current send: self selector to: anObject arguments: self arguments",
 messageSends: ["send:to:arguments:", "selector", "arguments", "current"],
@@ -735,16 +749,16 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "selector:arguments:",
 category: 'instance creation',
-fn: function (aString, anArray) {
-    var self = this;
-    var $2, $3, $1;
-    $2 = smalltalk.send(self, "_new", []);
-    smalltalk.send($2, "_selector_", [aString]);
-    smalltalk.send($2, "_arguments_", [anArray]);
-    $3 = smalltalk.send($2, "_yourself", []);
-    $1 = $3;
-    return $1;
-},
+fn: function (aString,anArray){
+var self=this;
+return smalltalk.withContext(function($ctx) { var $2,$3,$1;
+$2=_st(self)._new();
+_st($2)._selector_(aString);
+_st($2)._arguments_(anArray);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, self, "selector:arguments:", [aString,anArray], smalltalk.Message.klass)},
 args: ["aString", "anArray"],
 source: "selector: aString arguments: anArray\x0a\x09^self new\x0a\x09\x09selector: aString;\x0a\x09\x09arguments: anArray;\x0a\x09\x09yourself",
 messageSends: ["selector:", "new", "arguments:", "yourself"],
@@ -760,12 +774,12 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "asString",
 category: 'accessing',
-fn: function () {
-    var self = this;
-    var $1;
-    $1 = smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_receiver", []), "_class", []), "_printString", []), "__comma", [" >> "]), "__comma", [smalltalk.send(self, "_selector", [])]);
-    return $1;
-},
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st(_st(_st(_st(_st(self)._receiver())._class())._printString()).__comma(" >> ")).__comma(_st(self)._selector());
+return $1;
+}, self, "asString", [], smalltalk.MethodContext)},
 args: [],
 source: "asString\x0a\x09^self receiver class printString, ' >> ', self selector",
 messageSends: [",", "selector", "printString", "class", "receiver"],
@@ -778,11 +792,11 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "home",
 category: 'accessing',
-fn: function () {
-    var self = this;
-    return self.homeContext;
-    return self;
-},
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { return self.homeContext;
+;
+return self}, self, "home", [], smalltalk.MethodContext)},
 args: [],
 source: "home\x0a\x09<return self.homeContext>",
 messageSends: [],
@@ -790,16 +804,50 @@ referencedClasses: []
 }),
 smalltalk.MethodContext);
 
+smalltalk.addMethod(
+"_locals",
+smalltalk.method({
+selector: "locals",
+category: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { return self.locals;
+;
+return self}, self, "locals", [], smalltalk.MethodContext)},
+args: [],
+source: "locals\x0a\x09<return self.locals>",
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.MethodContext);
+
+smalltalk.addMethod(
+"_method",
+smalltalk.method({
+selector: "method",
+category: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { return self.method();
+;
+return self}, self, "method", [], smalltalk.MethodContext)},
+args: [],
+source: "method\x0a\x09<return self.method()>",
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.MethodContext);
+
 smalltalk.addMethod(
 "_pc",
 smalltalk.method({
 selector: "pc",
 category: 'accessing',
-fn: function () {
-    var self = this;
-    return self.pc;
-    return self;
-},
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { return self.pc;
+;
+return self}, self, "pc", [], smalltalk.MethodContext)},
 args: [],
 source: "pc\x0a\x09<return self.pc>",
 messageSends: [],
@@ -812,12 +860,12 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "printString",
 category: 'accessing',
-fn: function () {
-    var self = this;
-    var $1;
-    $1 = smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_printString", [], smalltalk.Object), "__comma", ["("]), "__comma", [smalltalk.send(self, "_asString", [])]), "__comma", [")"]);
-    return $1;
-},
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st(_st(_st(smalltalk.Object.fn.prototype._printString.apply(_st(self), [])).__comma("(")).__comma(_st(self)._asString())).__comma(")");
+return $1;
+}, self, "printString", [], smalltalk.MethodContext)},
 args: [],
 source: "printString\x0a\x09^super printString, '(', self asString, ')'",
 messageSends: [",", "asString", "printString"],
@@ -830,11 +878,11 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "receiver",
 category: 'accessing',
-fn: function () {
-    var self = this;
-    return self.receiver;
-    return self;
-},
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { return self.receiver;
+;
+return self}, self, "receiver", [], smalltalk.MethodContext)},
 args: [],
 source: "receiver\x0a\x09<return self.receiver>",
 messageSends: [],
@@ -847,11 +895,11 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "selector",
 category: 'accessing',
-fn: function () {
-    var self = this;
-    return smalltalk.convertSelector(self.selector);
-    return self;
-},
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { return smalltalk.convertSelector(self.selector);
+;
+return self}, self, "selector", [], smalltalk.MethodContext)},
 args: [],
 source: "selector\x0a\x09<return smalltalk.convertSelector(self.selector)>",
 messageSends: [],
@@ -864,14 +912,15 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "temps",
 category: 'accessing',
-fn: function () {
-    var self = this;
-    return self.temps;
-    return self;
-},
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st(self)._locals();
+return $1;
+}, self, "temps", [], smalltalk.MethodContext)},
 args: [],
-source: "temps\x0a\x09<return self.temps>",
-messageSends: [],
+source: "temps\x0a\x09^ self locals",
+messageSends: ["locals"],
 referencedClasses: []
 }),
 smalltalk.MethodContext);

文件差异内容过多而无法显示
+ 314 - 318
js/Kernel-Objects.deploy.js


文件差异内容过多而无法显示
+ 314 - 318
js/Kernel-Objects.js


文件差异内容过多而无法显示
+ 310 - 310
js/Kernel-Tests.deploy.js


文件差异内容过多而无法显示
+ 310 - 310
js/Kernel-Tests.js


+ 22 - 22
js/Kernel-Transcript.deploy.js

@@ -6,7 +6,7 @@ smalltalk.method({
 selector: "clear",
 fn: function (){
 var self=this;
-return self}
+return smalltalk.withContext(function($ctx) { return self}, self, "clear", [], smalltalk.ConsoleTranscript)}
 }),
 smalltalk.ConsoleTranscript);
 
@@ -16,7 +16,7 @@ smalltalk.method({
 selector: "cr",
 fn: function (){
 var self=this;
-return self}
+return smalltalk.withContext(function($ctx) { return self}, self, "cr", [], smalltalk.ConsoleTranscript)}
 }),
 smalltalk.ConsoleTranscript);
 
@@ -26,7 +26,7 @@ smalltalk.method({
 selector: "open",
 fn: function (){
 var self=this;
-return self}
+return smalltalk.withContext(function($ctx) { return self}, self, "open", [], smalltalk.ConsoleTranscript)}
 }),
 smalltalk.ConsoleTranscript);
 
@@ -36,11 +36,11 @@ smalltalk.method({
 selector: "show:",
 fn: function (anObject){
 var self=this;
-var string;
-string=smalltalk.send(anObject,"_asString",[]);
+return smalltalk.withContext(function($ctx) { var string;
+string=_st(anObject)._asString();
 console.log(String(string));
 ;
-return self}
+return self}, self, "show:", [anObject], smalltalk.ConsoleTranscript)}
 }),
 smalltalk.ConsoleTranscript);
 
@@ -51,8 +51,8 @@ smalltalk.method({
 selector: "initialize",
 fn: function (){
 var self=this;
-smalltalk.send((smalltalk.Transcript || Transcript),"_register_",[smalltalk.send(self,"_new",[])]);
-return self}
+return smalltalk.withContext(function($ctx) { _st((smalltalk.Transcript || Transcript))._register_(_st(self)._new());
+return self}, self, "initialize", [], smalltalk.ConsoleTranscript.klass)}
 }),
 smalltalk.ConsoleTranscript.klass);
 
@@ -66,8 +66,8 @@ smalltalk.method({
 selector: "clear",
 fn: function (){
 var self=this;
-smalltalk.send(smalltalk.send(self,"_current",[]),"_clear",[]);
-return self}
+return smalltalk.withContext(function($ctx) { _st(_st(self)._current())._clear();
+return self}, self, "clear", [], smalltalk.Transcript.klass)}
 }),
 smalltalk.Transcript.klass);
 
@@ -77,8 +77,8 @@ smalltalk.method({
 selector: "cr",
 fn: function (){
 var self=this;
-smalltalk.send(smalltalk.send(self,"_current",[]),"_show_",[smalltalk.send((smalltalk.String || String),"_cr",[])]);
-return self}
+return smalltalk.withContext(function($ctx) { _st(_st(self)._current())._show_(_st((smalltalk.String || String))._cr());
+return self}, self, "cr", [], smalltalk.Transcript.klass)}
 }),
 smalltalk.Transcript.klass);
 
@@ -88,8 +88,8 @@ smalltalk.method({
 selector: "current",
 fn: function (){
 var self=this;
-return self["@current"];
-}
+return smalltalk.withContext(function($ctx) { return self["@current"];
+}, self, "current", [], smalltalk.Transcript.klass)}
 }),
 smalltalk.Transcript.klass);
 
@@ -99,8 +99,8 @@ smalltalk.method({
 selector: "new",
 fn: function (){
 var self=this;
-smalltalk.send(self,"_shouldNotImplement",[]);
-return self}
+return smalltalk.withContext(function($ctx) { _st(self)._shouldNotImplement();
+return self}, self, "new", [], smalltalk.Transcript.klass)}
 }),
 smalltalk.Transcript.klass);
 
@@ -110,8 +110,8 @@ smalltalk.method({
 selector: "open",
 fn: function (){
 var self=this;
-smalltalk.send(smalltalk.send(self,"_current",[]),"_open",[]);
-return self}
+return smalltalk.withContext(function($ctx) { _st(_st(self)._current())._open();
+return self}, self, "open", [], smalltalk.Transcript.klass)}
 }),
 smalltalk.Transcript.klass);
 
@@ -121,8 +121,8 @@ smalltalk.method({
 selector: "register:",
 fn: function (aTranscript){
 var self=this;
-self["@current"]=aTranscript;
-return self}
+return smalltalk.withContext(function($ctx) { self["@current"]=aTranscript;
+return self}, self, "register:", [aTranscript], smalltalk.Transcript.klass)}
 }),
 smalltalk.Transcript.klass);
 
@@ -132,8 +132,8 @@ smalltalk.method({
 selector: "show:",
 fn: function (anObject){
 var self=this;
-smalltalk.send(smalltalk.send(self,"_current",[]),"_show_",[anObject]);
-return self}
+return smalltalk.withContext(function($ctx) { _st(_st(self)._current())._show_(anObject);
+return self}, self, "show:", [anObject], smalltalk.Transcript.klass)}
 }),
 smalltalk.Transcript.klass);
 

+ 22 - 22
js/Kernel-Transcript.js

@@ -7,7 +7,7 @@ selector: "clear",
 category: 'printing',
 fn: function (){
 var self=this;
-return self},
+return smalltalk.withContext(function($ctx) { return self}, self, "clear", [], smalltalk.ConsoleTranscript)},
 args: [],
 source: "clear\x0a\x09\x22no op\x22",
 messageSends: [],
@@ -22,7 +22,7 @@ selector: "cr",
 category: 'printing',
 fn: function (){
 var self=this;
-return self},
+return smalltalk.withContext(function($ctx) { return self}, self, "cr", [], smalltalk.ConsoleTranscript)},
 args: [],
 source: "cr\x0a\x09\x22no op\x22",
 messageSends: [],
@@ -37,7 +37,7 @@ selector: "open",
 category: 'actions',
 fn: function (){
 var self=this;
-return self},
+return smalltalk.withContext(function($ctx) { return self}, self, "open", [], smalltalk.ConsoleTranscript)},
 args: [],
 source: "open",
 messageSends: [],
@@ -52,11 +52,11 @@ selector: "show:",
 category: 'printing',
 fn: function (anObject){
 var self=this;
-var string;
-string=smalltalk.send(anObject,"_asString",[]);
+return smalltalk.withContext(function($ctx) { var string;
+string=_st(anObject)._asString();
 console.log(String(string));
 ;
-return self},
+return self}, self, "show:", [anObject], smalltalk.ConsoleTranscript)},
 args: ["anObject"],
 source: "show: anObject\x0a\x09| string |\x0a\x09string := anObject asString.\x0a\x09<console.log(String(string))>",
 messageSends: ["asString"],
@@ -72,8 +72,8 @@ selector: "initialize",
 category: 'initialization',
 fn: function (){
 var self=this;
-smalltalk.send((smalltalk.Transcript || Transcript),"_register_",[smalltalk.send(self,"_new",[])]);
-return self},
+return smalltalk.withContext(function($ctx) { _st((smalltalk.Transcript || Transcript))._register_(_st(self)._new());
+return self}, self, "initialize", [], smalltalk.ConsoleTranscript.klass)},
 args: [],
 source: "initialize\x0a\x09Transcript register: self new",
 messageSends: ["register:", "new"],
@@ -92,8 +92,8 @@ selector: "clear",
 category: 'printing',
 fn: function (){
 var self=this;
-smalltalk.send(smalltalk.send(self,"_current",[]),"_clear",[]);
-return self},
+return smalltalk.withContext(function($ctx) { _st(_st(self)._current())._clear();
+return self}, self, "clear", [], smalltalk.Transcript.klass)},
 args: [],
 source: "clear\x0a    self current clear",
 messageSends: ["clear", "current"],
@@ -108,8 +108,8 @@ selector: "cr",
 category: 'printing',
 fn: function (){
 var self=this;
-smalltalk.send(smalltalk.send(self,"_current",[]),"_show_",[smalltalk.send((smalltalk.String || String),"_cr",[])]);
-return self},
+return smalltalk.withContext(function($ctx) { _st(_st(self)._current())._show_(_st((smalltalk.String || String))._cr());
+return self}, self, "cr", [], smalltalk.Transcript.klass)},
 args: [],
 source: "cr\x0a    self current show: String cr",
 messageSends: ["show:", "cr", "current"],
@@ -124,8 +124,8 @@ selector: "current",
 category: 'instance creation',
 fn: function (){
 var self=this;
-return self["@current"];
-},
+return smalltalk.withContext(function($ctx) { return self["@current"];
+}, self, "current", [], smalltalk.Transcript.klass)},
 args: [],
 source: "current\x0a    ^current",
 messageSends: [],
@@ -140,8 +140,8 @@ selector: "new",
 category: 'instance creation',
 fn: function (){
 var self=this;
-smalltalk.send(self,"_shouldNotImplement",[]);
-return self},
+return smalltalk.withContext(function($ctx) { _st(self)._shouldNotImplement();
+return self}, self, "new", [], smalltalk.Transcript.klass)},
 args: [],
 source: "new\x0a    self shouldNotImplement",
 messageSends: ["shouldNotImplement"],
@@ -156,8 +156,8 @@ selector: "open",
 category: 'instance creation',
 fn: function (){
 var self=this;
-smalltalk.send(smalltalk.send(self,"_current",[]),"_open",[]);
-return self},
+return smalltalk.withContext(function($ctx) { _st(_st(self)._current())._open();
+return self}, self, "open", [], smalltalk.Transcript.klass)},
 args: [],
 source: "open\x0a    self current open",
 messageSends: ["open", "current"],
@@ -172,8 +172,8 @@ selector: "register:",
 category: 'instance creation',
 fn: function (aTranscript){
 var self=this;
-self["@current"]=aTranscript;
-return self},
+return smalltalk.withContext(function($ctx) { self["@current"]=aTranscript;
+return self}, self, "register:", [aTranscript], smalltalk.Transcript.klass)},
 args: ["aTranscript"],
 source: "register: aTranscript\x0a\x09current := aTranscript",
 messageSends: [],
@@ -188,8 +188,8 @@ selector: "show:",
 category: 'printing',
 fn: function (anObject){
 var self=this;
-smalltalk.send(smalltalk.send(self,"_current",[]),"_show_",[anObject]);
-return self},
+return smalltalk.withContext(function($ctx) { _st(_st(self)._current())._show_(anObject);
+return self}, self, "show:", [anObject], smalltalk.Transcript.klass)},
 args: ["anObject"],
 source: "show: anObject\x0a    self current show: anObject",
 messageSends: ["show:", "current"],

+ 234 - 235
js/SUnit.deploy.js

@@ -6,8 +6,8 @@ smalltalk.method({
 selector: "result",
 fn: function (){
 var self=this;
-return self["@result"];
-}
+return smalltalk.withContext(function($ctx) { return self["@result"];
+}, self, "result", [], smalltalk.ResultAnnouncement)}
 }),
 smalltalk.ResultAnnouncement);
 
@@ -17,8 +17,8 @@ smalltalk.method({
 selector: "result:",
 fn: function (aTestResult){
 var self=this;
-self["@result"]=aTestResult;
-return self}
+return smalltalk.withContext(function($ctx) { self["@result"]=aTestResult;
+return self}, self, "result:", [aTestResult], smalltalk.ResultAnnouncement)}
 }),
 smalltalk.ResultAnnouncement);
 
@@ -29,11 +29,10 @@ smalltalk.addMethod(
 "_assert_",
 smalltalk.method({
 selector: "assert:",
-fn: function (aBoolean) {
-    var self = this;
-    smalltalk.send(self, "_assert_description_", [aBoolean, "Assertion failed"]);
-    return self;
-}
+fn: function (aBoolean){
+var self=this;
+return smalltalk.withContext(function($ctx) { _st(self)._assert_description_(aBoolean,"Assertion failed");
+return self}, self, "assert:", [aBoolean], smalltalk.TestCase)}
 }),
 smalltalk.TestCase);
 
@@ -41,13 +40,12 @@ smalltalk.addMethod(
 "_assert_description_",
 smalltalk.method({
 selector: "assert:description:",
-fn: function (aBoolean, aString) {
-    var self = this;
-    if (!smalltalk.assert(aBoolean)) {
-        smalltalk.send(self, "_signalFailure_", [aString]);
-    }
-    return self;
-}
+fn: function (aBoolean,aString){
+var self=this;
+return smalltalk.withContext(function($ctx) { if(! smalltalk.assert(aBoolean)){
+_st(self)._signalFailure_(aString);
+};
+return self}, self, "assert:description:", [aBoolean,aString], smalltalk.TestCase)}
 }),
 smalltalk.TestCase);
 
@@ -55,12 +53,12 @@ smalltalk.addMethod(
 "_assert_equals_",
 smalltalk.method({
 selector: "assert:equals:",
-fn: function (expected, actual) {
-    var self = this;
-    var $1;
-    $1 = smalltalk.send(self, "_assert_description_", [smalltalk.send(expected, "__eq", [actual]), smalltalk.send(smalltalk.send(smalltalk.send("Expected: ", "__comma", [smalltalk.send(expected, "_asString", [])]), "__comma", [" but was: "]), "__comma", [smalltalk.send(actual, "_asString", [])])]);
-    return $1;
-}
+fn: function (expected,actual){
+var self=this;
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st(self)._assert_description_(_st(expected).__eq(actual),_st(_st(_st("Expected: ").__comma(_st(expected)._asString())).__comma(" but was: ")).__comma(_st(actual)._asString()));
+return $1;
+}, self, "assert:equals:", [expected,actual], smalltalk.TestCase)}
 }),
 smalltalk.TestCase);
 
@@ -68,11 +66,10 @@ smalltalk.addMethod(
 "_deny_",
 smalltalk.method({
 selector: "deny:",
-fn: function (aBoolean) {
-    var self = this;
-    smalltalk.send(self, "_assert_", [smalltalk.send(aBoolean, "_not", [])]);
-    return self;
-}
+fn: function (aBoolean){
+var self=this;
+return smalltalk.withContext(function($ctx) { _st(self)._assert_(_st(aBoolean)._not());
+return self}, self, "deny:", [aBoolean], smalltalk.TestCase)}
 }),
 smalltalk.TestCase);
 
@@ -82,8 +79,8 @@ smalltalk.method({
 selector: "performTest",
 fn: function (){
 var self=this;
-smalltalk.send(self,"_perform_",[smalltalk.send(self,"_selector",[])]);
-return self}
+return smalltalk.withContext(function($ctx) { _st(self)._perform_(_st(self)._selector());
+return self}, self, "performTest", [], smalltalk.TestCase)}
 }),
 smalltalk.TestCase);
 
@@ -93,13 +90,13 @@ smalltalk.method({
 selector: "runCase",
 fn: function (){
 var self=this;
-smalltalk.send((function(){
-smalltalk.send(self,"_setUp",[]);
-return smalltalk.send(self,"_performTest",[]);
-}),"_ensure_",[(function(){
-return smalltalk.send(self,"_tearDown",[]);
-})]);
-return self}
+return smalltalk.withContext(function($ctx) { _st((function(){
+_st(self)._setUp();
+return _st(self)._performTest();
+}))._ensure_((function(){
+return _st(self)._tearDown();
+}));
+return self}, self, "runCase", [], smalltalk.TestCase)}
 }),
 smalltalk.TestCase);
 
@@ -107,10 +104,10 @@ smalltalk.addMethod(
 "_selector",
 smalltalk.method({
 selector: "selector",
-fn: function () {
-    var self = this;
-    return self['@testSelector'];
-}
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { return self["@testSelector"];
+}, self, "selector", [], smalltalk.TestCase)}
 }),
 smalltalk.TestCase);
 
@@ -118,11 +115,10 @@ smalltalk.addMethod(
 "_setTestSelector_",
 smalltalk.method({
 selector: "setTestSelector:",
-fn: function (aSelector) {
-    var self = this;
-    self['@testSelector'] = aSelector;
-    return self;
-}
+fn: function (aSelector){
+var self=this;
+return smalltalk.withContext(function($ctx) { self["@testSelector"]=aSelector;
+return self}, self, "setTestSelector:", [aSelector], smalltalk.TestCase)}
 }),
 smalltalk.TestCase);
 
@@ -130,10 +126,9 @@ smalltalk.addMethod(
 "_setUp",
 smalltalk.method({
 selector: "setUp",
-fn: function () {
-    var self = this;
-    return self;
-}
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { return self}, self, "setUp", [], smalltalk.TestCase)}
 }),
 smalltalk.TestCase);
 
@@ -141,11 +136,10 @@ smalltalk.addMethod(
 "_should_",
 smalltalk.method({
 selector: "should:",
-fn: function (aBlock) {
-    var self = this;
-    smalltalk.send(self, "_assert_", [smalltalk.send(aBlock, "_value", [])]);
-    return self;
-}
+fn: function (aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx) { _st(self)._assert_(_st(aBlock)._value());
+return self}, self, "should:", [aBlock], smalltalk.TestCase)}
 }),
 smalltalk.TestCase);
 
@@ -153,11 +147,15 @@ smalltalk.addMethod(
 "_should_raise_",
 smalltalk.method({
 selector: "should:raise:",
-fn: function (aBlock, anExceptionClass) {
-    var self = this;
-    smalltalk.send(self, "_assert_", [smalltalk.send(function () {smalltalk.send(aBlock, "_value", []);return false;}, "_on_do_", [anExceptionClass, function (ex) {return true;}])]);
-    return self;
-}
+fn: function (aBlock,anExceptionClass){
+var self=this;
+return smalltalk.withContext(function($ctx) { _st(self)._assert_(_st((function(){
+_st(aBlock)._value();
+return false;
+}))._on_do_(anExceptionClass,(function(ex){
+return true;
+})));
+return self}, self, "should:raise:", [aBlock,anExceptionClass], smalltalk.TestCase)}
 }),
 smalltalk.TestCase);
 
@@ -165,11 +163,15 @@ smalltalk.addMethod(
 "_shouldnt_raise_",
 smalltalk.method({
 selector: "shouldnt:raise:",
-fn: function (aBlock, anExceptionClass) {
-    var self = this;
-    smalltalk.send(self, "_assert_", [smalltalk.send(function () {smalltalk.send(aBlock, "_value", []);return true;}, "_on_do_", [anExceptionClass, function (ex) {return false;}])]);
-    return self;
-}
+fn: function (aBlock,anExceptionClass){
+var self=this;
+return smalltalk.withContext(function($ctx) { _st(self)._assert_(_st((function(){
+_st(aBlock)._value();
+return true;
+}))._on_do_(anExceptionClass,(function(ex){
+return false;
+})));
+return self}, self, "shouldnt:raise:", [aBlock,anExceptionClass], smalltalk.TestCase)}
 }),
 smalltalk.TestCase);
 
@@ -177,14 +179,13 @@ smalltalk.addMethod(
 "_signalFailure_",
 smalltalk.method({
 selector: "signalFailure:",
-fn: function (aString) {
-    var self = this;
-    var $1, $2;
-    $1 = smalltalk.send(smalltalk.TestFailure || TestFailure, "_new", []);
-    smalltalk.send($1, "_messageText_", [aString]);
-    $2 = smalltalk.send($1, "_signal", []);
-    return self;
-}
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx) { var $1,$2;
+$1=_st((smalltalk.TestFailure || TestFailure))._new();
+_st($1)._messageText_(aString);
+$2=_st($1)._signal();
+return self}, self, "signalFailure:", [aString], smalltalk.TestCase)}
 }),
 smalltalk.TestCase);
 
@@ -192,10 +193,9 @@ smalltalk.addMethod(
 "_tearDown",
 smalltalk.method({
 selector: "tearDown",
-fn: function () {
-    var self = this;
-    return self;
-}
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { return self}, self, "tearDown", [], smalltalk.TestCase)}
 }),
 smalltalk.TestCase);
 
@@ -204,17 +204,17 @@ smalltalk.addMethod(
 "_allTestSelectors",
 smalltalk.method({
 selector: "allTestSelectors",
-fn: function () {
-    var self = this;
-    var $1;
-    var selectors;
-    selectors = smalltalk.send(self, "_testSelectors", []);
-    $1 = smalltalk.send(self, "_shouldInheritSelectors", []);
-    if (smalltalk.assert($1)) {
-        smalltalk.send(selectors, "_addAll_", [smalltalk.send(smalltalk.send(self, "_superclass", []), "_allTestSelectors", [])]);
-    }
-    return selectors;
-}
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { var $1;
+var selectors;
+selectors=_st(self)._testSelectors();
+$1=_st(self)._shouldInheritSelectors();
+if(smalltalk.assert($1)){
+_st(selectors)._addAll_(_st(_st(self)._superclass())._allTestSelectors());
+};
+return selectors;
+}, self, "allTestSelectors", [], smalltalk.TestCase.klass)}
 }),
 smalltalk.TestCase.klass);
 
@@ -222,12 +222,14 @@ smalltalk.addMethod(
 "_buildSuite",
 smalltalk.method({
 selector: "buildSuite",
-fn: function () {
-    var self = this;
-    var $1;
-    $1 = smalltalk.send(smalltalk.send(self, "_allTestSelectors", []), "_collect_", [function (each) {return smalltalk.send(self, "_selector_", [each]);}]);
-    return $1;
-}
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st(_st(self)._allTestSelectors())._collect_((function(each){
+return _st(self)._selector_(each);
+}));
+return $1;
+}, self, "buildSuite", [], smalltalk.TestCase.klass)}
 }),
 smalltalk.TestCase.klass);
 
@@ -235,12 +237,12 @@ smalltalk.addMethod(
 "_isAbstract",
 smalltalk.method({
 selector: "isAbstract",
-fn: function () {
-    var self = this;
-    var $1;
-    $1 = smalltalk.send(smalltalk.send(self, "_name", []), "__eq", ["TestCase"]);
-    return $1;
-}
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st(_st(self)._name()).__eq("TestCase");
+return $1;
+}, self, "isAbstract", [], smalltalk.TestCase.klass)}
 }),
 smalltalk.TestCase.klass);
 
@@ -248,10 +250,10 @@ smalltalk.addMethod(
 "_lookupHierarchyRoot",
 smalltalk.method({
 selector: "lookupHierarchyRoot",
-fn: function () {
-    var self = this;
-    return smalltalk.TestCase || TestCase;
-}
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { return (smalltalk.TestCase || TestCase);
+}, self, "lookupHierarchyRoot", [], smalltalk.TestCase.klass)}
 }),
 smalltalk.TestCase.klass);
 
@@ -259,15 +261,15 @@ smalltalk.addMethod(
 "_selector_",
 smalltalk.method({
 selector: "selector:",
-fn: function (aSelector) {
-    var self = this;
-    var $2, $3, $1;
-    $2 = smalltalk.send(self, "_new", []);
-    smalltalk.send($2, "_setTestSelector_", [aSelector]);
-    $3 = smalltalk.send($2, "_yourself", []);
-    $1 = $3;
-    return $1;
-}
+fn: function (aSelector){
+var self=this;
+return smalltalk.withContext(function($ctx) { var $2,$3,$1;
+$2=_st(self)._new();
+_st($2)._setTestSelector_(aSelector);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, self, "selector:", [aSelector], smalltalk.TestCase.klass)}
 }),
 smalltalk.TestCase.klass);
 
@@ -275,12 +277,12 @@ smalltalk.addMethod(
 "_shouldInheritSelectors",
 smalltalk.method({
 selector: "shouldInheritSelectors",
-fn: function () {
-    var self = this;
-    var $1;
-    $1 = smalltalk.send(self, "_~_eq", [smalltalk.send(self, "_lookupHierarchyRoot", [])]);
-    return $1;
-}
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st(self).__tild_eq(_st(self)._lookupHierarchyRoot());
+return $1;
+}, self, "shouldInheritSelectors", [], smalltalk.TestCase.klass)}
 }),
 smalltalk.TestCase.klass);
 
@@ -288,12 +290,14 @@ smalltalk.addMethod(
 "_testSelectors",
 smalltalk.method({
 selector: "testSelectors",
-fn: function () {
-    var self = this;
-    var $1;
-    $1 = smalltalk.send(smalltalk.send(smalltalk.send(self, "_methodDictionary", []), "_keys", []), "_select_", [function (each) {return smalltalk.send(each, "_match_", ["^test"]);}]);
-    return $1;
-}
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st(_st(_st(self)._methodDictionary())._keys())._select_((function(each){
+return _st(each)._match_("^test");
+}));
+return $1;
+}, self, "testSelectors", [], smalltalk.TestCase.klass)}
 }),
 smalltalk.TestCase.klass);
 
@@ -306,11 +310,10 @@ smalltalk.addMethod(
 "_addError_",
 smalltalk.method({
 selector: "addError:",
-fn: function (anError) {
-    var self = this;
-    smalltalk.send(smalltalk.send(self, "_errors", []), "_add_", [anError]);
-    return self;
-}
+fn: function (anError){
+var self=this;
+return smalltalk.withContext(function($ctx) { _st(_st(self)._errors())._add_(anError);
+return self}, self, "addError:", [anError], smalltalk.TestResult)}
 }),
 smalltalk.TestResult);
 
@@ -318,11 +321,10 @@ smalltalk.addMethod(
 "_addFailure_",
 smalltalk.method({
 selector: "addFailure:",
-fn: function (aFailure) {
-    var self = this;
-    smalltalk.send(smalltalk.send(self, "_failures", []), "_add_", [aFailure]);
-    return self;
-}
+fn: function (aFailure){
+var self=this;
+return smalltalk.withContext(function($ctx) { _st(_st(self)._failures())._add_(aFailure);
+return self}, self, "addFailure:", [aFailure], smalltalk.TestResult)}
 }),
 smalltalk.TestResult);
 
@@ -330,10 +332,10 @@ smalltalk.addMethod(
 "_errors",
 smalltalk.method({
 selector: "errors",
-fn: function () {
-    var self = this;
-    return self['@errors'];
-}
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { return self["@errors"];
+}, self, "errors", [], smalltalk.TestResult)}
 }),
 smalltalk.TestResult);
 
@@ -341,10 +343,10 @@ smalltalk.addMethod(
 "_failures",
 smalltalk.method({
 selector: "failures",
-fn: function () {
-    var self = this;
-    return self['@failures'];
-}
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { return self["@failures"];
+}, self, "failures", [], smalltalk.TestResult)}
 }),
 smalltalk.TestResult);
 
@@ -352,11 +354,10 @@ smalltalk.addMethod(
 "_increaseRuns",
 smalltalk.method({
 selector: "increaseRuns",
-fn: function () {
-    var self = this;
-    self['@runs'] = smalltalk.send(self['@runs'], "__plus", [1]);
-    return self;
-}
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { self["@runs"]=_st(self["@runs"]).__plus((1));
+return self}, self, "increaseRuns", [], smalltalk.TestResult)}
 }),
 smalltalk.TestResult);
 
@@ -364,16 +365,15 @@ smalltalk.addMethod(
 "_initialize",
 smalltalk.method({
 selector: "initialize",
-fn: function () {
-    var self = this;
-    smalltalk.send(self, "_initialize", [], smalltalk.Object);
-    self['@timestamp'] = smalltalk.send(smalltalk.Date || Date, "_now", []);
-    self['@runs'] = 0;
-    self['@errors'] = smalltalk.send(smalltalk.Array || Array, "_new", []);
-    self['@failures'] = smalltalk.send(smalltalk.Array || Array, "_new", []);
-    self['@total'] = 0;
-    return self;
-}
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
+self["@timestamp"]=_st((smalltalk.Date || Date))._now();
+self["@runs"]=(0);
+self["@errors"]=_st((smalltalk.Array || Array))._new();
+self["@failures"]=_st((smalltalk.Array || Array))._new();
+self["@total"]=(0);
+return self}, self, "initialize", [], smalltalk.TestResult)}
 }),
 smalltalk.TestResult);
 
@@ -383,13 +383,13 @@ smalltalk.method({
 selector: "nextRunDo:",
 fn: function (aBlock){
 var self=this;
-var $2,$1;
-$2=smalltalk.send(smalltalk.send(self,"_runs",[]),"__eq_eq",[smalltalk.send(self,"_total",[])]);
+return smalltalk.withContext(function($ctx) { var $2,$1;
+$2=_st(_st(self)._runs()).__eq_eq(_st(self)._total());
 if(! smalltalk.assert($2)){
-$1=smalltalk.send(aBlock,"_value_",[smalltalk.send(smalltalk.send(self,"_runs",[]),"__plus",[(1)])]);
+$1=_st(aBlock)._value_(_st(_st(self)._runs()).__plus((1)));
 };
 return $1;
-}
+}, self, "nextRunDo:", [aBlock], smalltalk.TestResult)}
 }),
 smalltalk.TestResult);
 
@@ -399,17 +399,17 @@ smalltalk.method({
 selector: "runCase:",
 fn: function (aTestCase){
 var self=this;
-smalltalk.send((function(){
-return smalltalk.send((function(){
-smalltalk.send(self,"_increaseRuns",[]);
-return smalltalk.send(aTestCase,"_runCase",[]);
-}),"_on_do_",[(smalltalk.TestFailure || TestFailure),(function(ex){
-return smalltalk.send(self,"_addFailure_",[aTestCase]);
-})]);
-}),"_on_do_",[(smalltalk.Error || Error),(function(ex){
-return smalltalk.send(self,"_addError_",[aTestCase]);
-})]);
-return self}
+return smalltalk.withContext(function($ctx) { _st((function(){
+return _st((function(){
+_st(self)._increaseRuns();
+return _st(aTestCase)._runCase();
+}))._on_do_((smalltalk.TestFailure || TestFailure),(function(ex){
+return _st(self)._addFailure_(aTestCase);
+}));
+}))._on_do_((smalltalk.Error || Error),(function(ex){
+return _st(self)._addError_(aTestCase);
+}));
+return self}, self, "runCase:", [aTestCase], smalltalk.TestResult)}
 }),
 smalltalk.TestResult);
 
@@ -417,10 +417,10 @@ smalltalk.addMethod(
 "_runs",
 smalltalk.method({
 selector: "runs",
-fn: function () {
-    var self = this;
-    return self['@runs'];
-}
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { return self["@runs"];
+}, self, "runs", [], smalltalk.TestResult)}
 }),
 smalltalk.TestResult);
 
@@ -428,22 +428,22 @@ smalltalk.addMethod(
 "_status",
 smalltalk.method({
 selector: "status",
-fn: function () {
-    var self = this;
-    var $2, $3, $1;
-    $2 = smalltalk.send(smalltalk.send(self, "_errors", []), "_isEmpty", []);
-    if (smalltalk.assert($2)) {
-        $3 = smalltalk.send(smalltalk.send(self, "_failures", []), "_isEmpty", []);
-        if (smalltalk.assert($3)) {
-            $1 = "success";
-        } else {
-            $1 = "failure";
-        }
-    } else {
-        $1 = "error";
-    }
-    return $1;
-}
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { var $2,$3,$1;
+$2=_st(_st(self)._errors())._isEmpty();
+if(smalltalk.assert($2)){
+$3=_st(_st(self)._failures())._isEmpty();
+if(smalltalk.assert($3)){
+$1="success";
+} else {
+$1="failure";
+};
+} else {
+$1="error";
+};
+return $1;
+}, self, "status", [], smalltalk.TestResult)}
 }),
 smalltalk.TestResult);
 
@@ -451,10 +451,10 @@ smalltalk.addMethod(
 "_timestamp",
 smalltalk.method({
 selector: "timestamp",
-fn: function () {
-    var self = this;
-    return self['@timestamp'];
-}
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { return self["@timestamp"];
+}, self, "timestamp", [], smalltalk.TestResult)}
 }),
 smalltalk.TestResult);
 
@@ -462,10 +462,10 @@ smalltalk.addMethod(
 "_total",
 smalltalk.method({
 selector: "total",
-fn: function () {
-    var self = this;
-    return self['@total'];
-}
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { return self["@total"];
+}, self, "total", [], smalltalk.TestResult)}
 }),
 smalltalk.TestResult);
 
@@ -473,11 +473,10 @@ smalltalk.addMethod(
 "_total_",
 smalltalk.method({
 selector: "total:",
-fn: function (aNumber) {
-    var self = this;
-    self['@total'] = aNumber;
-    return self;
-}
+fn: function (aNumber){
+var self=this;
+return smalltalk.withContext(function($ctx) { self["@total"]=aNumber;
+return self}, self, "total:", [aNumber], smalltalk.TestResult)}
 }),
 smalltalk.TestResult);
 
@@ -490,8 +489,8 @@ smalltalk.method({
 selector: "announcer",
 fn: function (){
 var self=this;
-return self["@announcer"];
-}
+return smalltalk.withContext(function($ctx) { return self["@announcer"];
+}, self, "announcer", [], smalltalk.TestSuiteRunner)}
 }),
 smalltalk.TestSuiteRunner);
 
@@ -501,10 +500,10 @@ smalltalk.method({
 selector: "initialize",
 fn: function (){
 var self=this;
-smalltalk.send(self,"_initialize",[],smalltalk.Object);
-self["@announcer"]=smalltalk.send((smalltalk.Announcer || Announcer),"_new",[]);
-self["@result"]=smalltalk.send((smalltalk.TestResult || TestResult),"_new",[]);
-return self}
+return smalltalk.withContext(function($ctx) { smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
+self["@announcer"]=_st((smalltalk.Announcer || Announcer))._new();
+self["@result"]=_st((smalltalk.TestResult || TestResult))._new();
+return self}, self, "initialize", [], smalltalk.TestSuiteRunner)}
 }),
 smalltalk.TestSuiteRunner);
 
@@ -514,8 +513,8 @@ smalltalk.method({
 selector: "result",
 fn: function (){
 var self=this;
-return self["@result"];
-}
+return smalltalk.withContext(function($ctx) { return self["@result"];
+}, self, "result", [], smalltalk.TestSuiteRunner)}
 }),
 smalltalk.TestSuiteRunner);
 
@@ -525,23 +524,23 @@ smalltalk.method({
 selector: "run",
 fn: function (){
 var self=this;
-var worker;
-smalltalk.send(self["@result"],"_total_",[smalltalk.send(self["@suite"],"_size",[])]);
-smalltalk.send(self["@announcer"],"_announce_",[smalltalk.send(smalltalk.send((smalltalk.ResultAnnouncement || ResultAnnouncement),"_new",[]),"_result_",[self["@result"]])]);
+return smalltalk.withContext(function($ctx) { var worker;
+_st(self["@result"])._total_(_st(self["@suite"])._size());
+_st(self["@announcer"])._announce_(_st(_st((smalltalk.ResultAnnouncement || ResultAnnouncement))._new())._result_(self["@result"]));
 worker=(function(){
-return smalltalk.send(self["@result"],"_nextRunDo_",[(function(index){
-return smalltalk.send((function(){
-return smalltalk.send(self["@result"],"_runCase_",[smalltalk.send(self["@suite"],"_at_",[index])]);
-}),"_ensure_",[(function(){
-smalltalk.send(worker,"_valueWithTimeout_",[(0)]);
-return smalltalk.send(self["@announcer"],"_announce_",[smalltalk.send(smalltalk.send((smalltalk.ResultAnnouncement || ResultAnnouncement),"_new",[]),"_result_",[self["@result"]])]);
-})]);
-})]);
+return _st(self["@result"])._nextRunDo_((function(index){
+return _st((function(){
+return _st(self["@result"])._runCase_(_st(self["@suite"])._at_(index));
+}))._ensure_((function(){
+_st(worker)._valueWithTimeout_((0));
+return _st(self["@announcer"])._announce_(_st(_st((smalltalk.ResultAnnouncement || ResultAnnouncement))._new())._result_(self["@result"]));
+}));
+}));
 });
-smalltalk.send(smalltalk.send(smalltalk.send(self["@suite"],"_size",[]),"_min_",[(25)]),"_timesRepeat_",[(function(){
-return smalltalk.send(worker,"_valueWithTimeout_",[(0)]);
-})]);
-return self}
+_st(_st(_st(self["@suite"])._size())._min_((25)))._timesRepeat_((function(){
+return _st(worker)._valueWithTimeout_((0));
+}));
+return self}, self, "run", [], smalltalk.TestSuiteRunner)}
 }),
 smalltalk.TestSuiteRunner);
 
@@ -551,8 +550,8 @@ smalltalk.method({
 selector: "suite:",
 fn: function (aCollection){
 var self=this;
-self["@suite"]=aCollection;
-return self}
+return smalltalk.withContext(function($ctx) { self["@suite"]=aCollection;
+return self}, self, "suite:", [aCollection], smalltalk.TestSuiteRunner)}
 }),
 smalltalk.TestSuiteRunner);
 
@@ -563,8 +562,8 @@ smalltalk.method({
 selector: "new",
 fn: function (){
 var self=this;
-smalltalk.send(self,"_shouldNotImplement",[]);
-return self}
+return smalltalk.withContext(function($ctx) { _st(self)._shouldNotImplement();
+return self}, self, "new", [], smalltalk.TestSuiteRunner.klass)}
 }),
 smalltalk.TestSuiteRunner.klass);
 
@@ -574,10 +573,10 @@ smalltalk.method({
 selector: "on:",
 fn: function (aCollection){
 var self=this;
-var $1;
-$1=smalltalk.send(smalltalk.send(self,"_new",[],smalltalk.Object.klass),"_suite_",[aCollection]);
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st(smalltalk.Object.klass.fn.prototype._new.apply(_st(self), []))._suite_(aCollection);
 return $1;
-}
+}, self, "on:", [aCollection], smalltalk.TestSuiteRunner.klass)}
 }),
 smalltalk.TestSuiteRunner.klass);
 

+ 234 - 235
js/SUnit.js

@@ -7,8 +7,8 @@ selector: "result",
 category: 'accessing',
 fn: function (){
 var self=this;
-return self["@result"];
-},
+return smalltalk.withContext(function($ctx) { return self["@result"];
+}, self, "result", [], smalltalk.ResultAnnouncement)},
 args: [],
 source: "result\x0a\x09^result",
 messageSends: [],
@@ -23,8 +23,8 @@ selector: "result:",
 category: 'accessing',
 fn: function (aTestResult){
 var self=this;
-self["@result"]=aTestResult;
-return self},
+return smalltalk.withContext(function($ctx) { self["@result"]=aTestResult;
+return self}, self, "result:", [aTestResult], smalltalk.ResultAnnouncement)},
 args: ["aTestResult"],
 source: "result: aTestResult\x0a\x09result := aTestResult",
 messageSends: [],
@@ -40,11 +40,10 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "assert:",
 category: 'testing',
-fn: function (aBoolean) {
-    var self = this;
-    smalltalk.send(self, "_assert_description_", [aBoolean, "Assertion failed"]);
-    return self;
-},
+fn: function (aBoolean){
+var self=this;
+return smalltalk.withContext(function($ctx) { _st(self)._assert_description_(aBoolean,"Assertion failed");
+return self}, self, "assert:", [aBoolean], smalltalk.TestCase)},
 args: ["aBoolean"],
 source: "assert: aBoolean\x0a\x09self assert: aBoolean description: 'Assertion failed'",
 messageSends: ["assert:description:"],
@@ -57,13 +56,12 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "assert:description:",
 category: 'testing',
-fn: function (aBoolean, aString) {
-    var self = this;
-    if (!smalltalk.assert(aBoolean)) {
-        smalltalk.send(self, "_signalFailure_", [aString]);
-    }
-    return self;
-},
+fn: function (aBoolean,aString){
+var self=this;
+return smalltalk.withContext(function($ctx) { if(! smalltalk.assert(aBoolean)){
+_st(self)._signalFailure_(aString);
+};
+return self}, self, "assert:description:", [aBoolean,aString], smalltalk.TestCase)},
 args: ["aBoolean", "aString"],
 source: "assert: aBoolean description: aString\x0a\x09aBoolean ifFalse: [self signalFailure: aString]",
 messageSends: ["ifFalse:", "signalFailure:"],
@@ -76,12 +74,12 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "assert:equals:",
 category: 'testing',
-fn: function (expected, actual) {
-    var self = this;
-    var $1;
-    $1 = smalltalk.send(self, "_assert_description_", [smalltalk.send(expected, "__eq", [actual]), smalltalk.send(smalltalk.send(smalltalk.send("Expected: ", "__comma", [smalltalk.send(expected, "_asString", [])]), "__comma", [" but was: "]), "__comma", [smalltalk.send(actual, "_asString", [])])]);
-    return $1;
-},
+fn: function (expected,actual){
+var self=this;
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st(self)._assert_description_(_st(expected).__eq(actual),_st(_st(_st("Expected: ").__comma(_st(expected)._asString())).__comma(" but was: ")).__comma(_st(actual)._asString()));
+return $1;
+}, self, "assert:equals:", [expected,actual], smalltalk.TestCase)},
 args: ["expected", "actual"],
 source: "assert: expected equals: actual\x0a\x09^ self assert: (expected = actual) description: 'Expected: ', expected asString, ' but was: ', actual asString",
 messageSends: ["assert:description:", "=", ",", "asString"],
@@ -94,11 +92,10 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "deny:",
 category: 'testing',
-fn: function (aBoolean) {
-    var self = this;
-    smalltalk.send(self, "_assert_", [smalltalk.send(aBoolean, "_not", [])]);
-    return self;
-},
+fn: function (aBoolean){
+var self=this;
+return smalltalk.withContext(function($ctx) { _st(self)._assert_(_st(aBoolean)._not());
+return self}, self, "deny:", [aBoolean], smalltalk.TestCase)},
 args: ["aBoolean"],
 source: "deny: aBoolean\x0a\x09self assert: aBoolean not",
 messageSends: ["assert:", "not"],
@@ -113,8 +110,8 @@ selector: "performTest",
 category: 'running',
 fn: function (){
 var self=this;
-smalltalk.send(self,"_perform_",[smalltalk.send(self,"_selector",[])]);
-return self},
+return smalltalk.withContext(function($ctx) { _st(self)._perform_(_st(self)._selector());
+return self}, self, "performTest", [], smalltalk.TestCase)},
 args: [],
 source: "performTest\x0a\x09self perform: self selector\x0a",
 messageSends: ["perform:", "selector"],
@@ -129,13 +126,13 @@ selector: "runCase",
 category: 'running',
 fn: function (){
 var self=this;
-smalltalk.send((function(){
-smalltalk.send(self,"_setUp",[]);
-return smalltalk.send(self,"_performTest",[]);
-}),"_ensure_",[(function(){
-return smalltalk.send(self,"_tearDown",[]);
-})]);
-return self},
+return smalltalk.withContext(function($ctx) { _st((function(){
+_st(self)._setUp();
+return _st(self)._performTest();
+}))._ensure_((function(){
+return _st(self)._tearDown();
+}));
+return self}, self, "runCase", [], smalltalk.TestCase)},
 args: [],
 source: "runCase\x0a\x09[\x09self setUp.\x0a\x09\x09self performTest ] ensure: [\x0a\x09\x09self tearDown.\x0a\x09\x09\x22self cleanUpInstanceVariables\x22 ]\x0a",
 messageSends: ["ensure:", "tearDown", "setUp", "performTest"],
@@ -148,10 +145,10 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "selector",
 category: 'accessing',
-fn: function () {
-    var self = this;
-    return self['@testSelector'];
-},
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { return self["@testSelector"];
+}, self, "selector", [], smalltalk.TestCase)},
 args: [],
 source: "selector\x0a\x09^testSelector",
 messageSends: [],
@@ -164,11 +161,10 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "setTestSelector:",
 category: 'accessing',
-fn: function (aSelector) {
-    var self = this;
-    self['@testSelector'] = aSelector;
-    return self;
-},
+fn: function (aSelector){
+var self=this;
+return smalltalk.withContext(function($ctx) { self["@testSelector"]=aSelector;
+return self}, self, "setTestSelector:", [aSelector], smalltalk.TestCase)},
 args: ["aSelector"],
 source: "setTestSelector: aSelector\x0a\x09testSelector := aSelector",
 messageSends: [],
@@ -181,10 +177,9 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "setUp",
 category: 'running',
-fn: function () {
-    var self = this;
-    return self;
-},
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { return self}, self, "setUp", [], smalltalk.TestCase)},
 args: [],
 source: "setUp",
 messageSends: [],
@@ -197,11 +192,10 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "should:",
 category: 'testing',
-fn: function (aBlock) {
-    var self = this;
-    smalltalk.send(self, "_assert_", [smalltalk.send(aBlock, "_value", [])]);
-    return self;
-},
+fn: function (aBlock){
+var self=this;
+return smalltalk.withContext(function($ctx) { _st(self)._assert_(_st(aBlock)._value());
+return self}, self, "should:", [aBlock], smalltalk.TestCase)},
 args: ["aBlock"],
 source: "should: aBlock\x0a\x09self assert: aBlock value",
 messageSends: ["assert:", "value"],
@@ -214,11 +208,15 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "should:raise:",
 category: 'testing',
-fn: function (aBlock, anExceptionClass) {
-    var self = this;
-    smalltalk.send(self, "_assert_", [smalltalk.send(function () {smalltalk.send(aBlock, "_value", []);return false;}, "_on_do_", [anExceptionClass, function (ex) {return true;}])]);
-    return self;
-},
+fn: function (aBlock,anExceptionClass){
+var self=this;
+return smalltalk.withContext(function($ctx) { _st(self)._assert_(_st((function(){
+_st(aBlock)._value();
+return false;
+}))._on_do_(anExceptionClass,(function(ex){
+return true;
+})));
+return self}, self, "should:raise:", [aBlock,anExceptionClass], smalltalk.TestCase)},
 args: ["aBlock", "anExceptionClass"],
 source: "should: aBlock raise: anExceptionClass\x0a\x09self assert: ([aBlock value. false] \x0a\x09\x09on: anExceptionClass \x0a\x09\x09do: [:ex | true])",
 messageSends: ["assert:", "on:do:", "value"],
@@ -231,11 +229,15 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "shouldnt:raise:",
 category: 'testing',
-fn: function (aBlock, anExceptionClass) {
-    var self = this;
-    smalltalk.send(self, "_assert_", [smalltalk.send(function () {smalltalk.send(aBlock, "_value", []);return true;}, "_on_do_", [anExceptionClass, function (ex) {return false;}])]);
-    return self;
-},
+fn: function (aBlock,anExceptionClass){
+var self=this;
+return smalltalk.withContext(function($ctx) { _st(self)._assert_(_st((function(){
+_st(aBlock)._value();
+return true;
+}))._on_do_(anExceptionClass,(function(ex){
+return false;
+})));
+return self}, self, "shouldnt:raise:", [aBlock,anExceptionClass], smalltalk.TestCase)},
 args: ["aBlock", "anExceptionClass"],
 source: "shouldnt: aBlock raise: anExceptionClass\x0a\x09self assert: ([aBlock value. true] \x0a\x09\x09on: anExceptionClass \x0a\x09\x09do: [:ex | false])",
 messageSends: ["assert:", "on:do:", "value"],
@@ -248,14 +250,13 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "signalFailure:",
 category: 'private',
-fn: function (aString) {
-    var self = this;
-    var $1, $2;
-    $1 = smalltalk.send(smalltalk.TestFailure || TestFailure, "_new", []);
-    smalltalk.send($1, "_messageText_", [aString]);
-    $2 = smalltalk.send($1, "_signal", []);
-    return self;
-},
+fn: function (aString){
+var self=this;
+return smalltalk.withContext(function($ctx) { var $1,$2;
+$1=_st((smalltalk.TestFailure || TestFailure))._new();
+_st($1)._messageText_(aString);
+$2=_st($1)._signal();
+return self}, self, "signalFailure:", [aString], smalltalk.TestCase)},
 args: ["aString"],
 source: "signalFailure: aString\x0a\x09TestFailure new\x0a\x09\x09messageText: aString;\x0a\x09\x09signal",
 messageSends: ["messageText:", "new", "signal"],
@@ -268,10 +269,9 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "tearDown",
 category: 'running',
-fn: function () {
-    var self = this;
-    return self;
-},
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { return self}, self, "tearDown", [], smalltalk.TestCase)},
 args: [],
 source: "tearDown",
 messageSends: [],
@@ -285,17 +285,17 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "allTestSelectors",
 category: 'accessing',
-fn: function () {
-    var self = this;
-    var $1;
-    var selectors;
-    selectors = smalltalk.send(self, "_testSelectors", []);
-    $1 = smalltalk.send(self, "_shouldInheritSelectors", []);
-    if (smalltalk.assert($1)) {
-        smalltalk.send(selectors, "_addAll_", [smalltalk.send(smalltalk.send(self, "_superclass", []), "_allTestSelectors", [])]);
-    }
-    return selectors;
-},
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { var $1;
+var selectors;
+selectors=_st(self)._testSelectors();
+$1=_st(self)._shouldInheritSelectors();
+if(smalltalk.assert($1)){
+_st(selectors)._addAll_(_st(_st(self)._superclass())._allTestSelectors());
+};
+return selectors;
+}, self, "allTestSelectors", [], smalltalk.TestCase.klass)},
 args: [],
 source: "allTestSelectors\x0a\x09| selectors |\x0a\x09selectors := self testSelectors.\x0a\x09self shouldInheritSelectors ifTrue: [\x0a\x09\x09selectors addAll: self superclass allTestSelectors].\x0a\x09^selectors",
 messageSends: ["testSelectors", "ifTrue:", "addAll:", "allTestSelectors", "superclass", "shouldInheritSelectors"],
@@ -308,12 +308,14 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "buildSuite",
 category: 'accessing',
-fn: function () {
-    var self = this;
-    var $1;
-    $1 = smalltalk.send(smalltalk.send(self, "_allTestSelectors", []), "_collect_", [function (each) {return smalltalk.send(self, "_selector_", [each]);}]);
-    return $1;
-},
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st(_st(self)._allTestSelectors())._collect_((function(each){
+return _st(self)._selector_(each);
+}));
+return $1;
+}, self, "buildSuite", [], smalltalk.TestCase.klass)},
 args: [],
 source: "buildSuite\x0a\x09^self allTestSelectors collect: [:each | self selector: each]",
 messageSends: ["collect:", "selector:", "allTestSelectors"],
@@ -326,12 +328,12 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "isAbstract",
 category: 'testing',
-fn: function () {
-    var self = this;
-    var $1;
-    $1 = smalltalk.send(smalltalk.send(self, "_name", []), "__eq", ["TestCase"]);
-    return $1;
-},
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st(_st(self)._name()).__eq("TestCase");
+return $1;
+}, self, "isAbstract", [], smalltalk.TestCase.klass)},
 args: [],
 source: "isAbstract\x0a\x09^ self name = 'TestCase'",
 messageSends: ["=", "name"],
@@ -344,10 +346,10 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "lookupHierarchyRoot",
 category: 'accessing',
-fn: function () {
-    var self = this;
-    return smalltalk.TestCase || TestCase;
-},
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { return (smalltalk.TestCase || TestCase);
+}, self, "lookupHierarchyRoot", [], smalltalk.TestCase.klass)},
 args: [],
 source: "lookupHierarchyRoot\x0a\x09^TestCase",
 messageSends: [],
@@ -360,15 +362,15 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "selector:",
 category: 'accessing',
-fn: function (aSelector) {
-    var self = this;
-    var $2, $3, $1;
-    $2 = smalltalk.send(self, "_new", []);
-    smalltalk.send($2, "_setTestSelector_", [aSelector]);
-    $3 = smalltalk.send($2, "_yourself", []);
-    $1 = $3;
-    return $1;
-},
+fn: function (aSelector){
+var self=this;
+return smalltalk.withContext(function($ctx) { var $2,$3,$1;
+$2=_st(self)._new();
+_st($2)._setTestSelector_(aSelector);
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, self, "selector:", [aSelector], smalltalk.TestCase.klass)},
 args: ["aSelector"],
 source: "selector: aSelector\x0a\x09^self new\x0a\x09\x09setTestSelector: aSelector;\x0a\x09\x09yourself",
 messageSends: ["setTestSelector:", "new", "yourself"],
@@ -381,12 +383,12 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "shouldInheritSelectors",
 category: 'testing',
-fn: function () {
-    var self = this;
-    var $1;
-    $1 = smalltalk.send(self, "_~_eq", [smalltalk.send(self, "_lookupHierarchyRoot", [])]);
-    return $1;
-},
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st(self).__tild_eq(_st(self)._lookupHierarchyRoot());
+return $1;
+}, self, "shouldInheritSelectors", [], smalltalk.TestCase.klass)},
 args: [],
 source: "shouldInheritSelectors\x0a\x09^self ~= self lookupHierarchyRoot",
 messageSends: ["~=", "lookupHierarchyRoot"],
@@ -399,12 +401,14 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "testSelectors",
 category: 'accessing',
-fn: function () {
-    var self = this;
-    var $1;
-    $1 = smalltalk.send(smalltalk.send(smalltalk.send(self, "_methodDictionary", []), "_keys", []), "_select_", [function (each) {return smalltalk.send(each, "_match_", ["^test"]);}]);
-    return $1;
-},
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st(_st(_st(self)._methodDictionary())._keys())._select_((function(each){
+return _st(each)._match_("^test");
+}));
+return $1;
+}, self, "testSelectors", [], smalltalk.TestCase.klass)},
 args: [],
 source: "testSelectors\x0a\x09^self methodDictionary keys select: [:each | each match: '^test']",
 messageSends: ["select:", "match:", "keys", "methodDictionary"],
@@ -422,11 +426,10 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "addError:",
 category: 'accessing',
-fn: function (anError) {
-    var self = this;
-    smalltalk.send(smalltalk.send(self, "_errors", []), "_add_", [anError]);
-    return self;
-},
+fn: function (anError){
+var self=this;
+return smalltalk.withContext(function($ctx) { _st(_st(self)._errors())._add_(anError);
+return self}, self, "addError:", [anError], smalltalk.TestResult)},
 args: ["anError"],
 source: "addError: anError\x0a\x09self errors add: anError",
 messageSends: ["add:", "errors"],
@@ -439,11 +442,10 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "addFailure:",
 category: 'accessing',
-fn: function (aFailure) {
-    var self = this;
-    smalltalk.send(smalltalk.send(self, "_failures", []), "_add_", [aFailure]);
-    return self;
-},
+fn: function (aFailure){
+var self=this;
+return smalltalk.withContext(function($ctx) { _st(_st(self)._failures())._add_(aFailure);
+return self}, self, "addFailure:", [aFailure], smalltalk.TestResult)},
 args: ["aFailure"],
 source: "addFailure: aFailure\x0a\x09self failures add: aFailure",
 messageSends: ["add:", "failures"],
@@ -456,10 +458,10 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "errors",
 category: 'accessing',
-fn: function () {
-    var self = this;
-    return self['@errors'];
-},
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { return self["@errors"];
+}, self, "errors", [], smalltalk.TestResult)},
 args: [],
 source: "errors\x0a\x09^errors",
 messageSends: [],
@@ -472,10 +474,10 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "failures",
 category: 'accessing',
-fn: function () {
-    var self = this;
-    return self['@failures'];
-},
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { return self["@failures"];
+}, self, "failures", [], smalltalk.TestResult)},
 args: [],
 source: "failures\x0a\x09^failures",
 messageSends: [],
@@ -488,11 +490,10 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "increaseRuns",
 category: 'accessing',
-fn: function () {
-    var self = this;
-    self['@runs'] = smalltalk.send(self['@runs'], "__plus", [1]);
-    return self;
-},
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { self["@runs"]=_st(self["@runs"]).__plus((1));
+return self}, self, "increaseRuns", [], smalltalk.TestResult)},
 args: [],
 source: "increaseRuns\x0a\x09runs := runs + 1",
 messageSends: ["+"],
@@ -505,16 +506,15 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "initialize",
 category: 'initialization',
-fn: function () {
-    var self = this;
-    smalltalk.send(self, "_initialize", [], smalltalk.Object);
-    self['@timestamp'] = smalltalk.send(smalltalk.Date || Date, "_now", []);
-    self['@runs'] = 0;
-    self['@errors'] = smalltalk.send(smalltalk.Array || Array, "_new", []);
-    self['@failures'] = smalltalk.send(smalltalk.Array || Array, "_new", []);
-    self['@total'] = 0;
-    return self;
-},
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
+self["@timestamp"]=_st((smalltalk.Date || Date))._now();
+self["@runs"]=(0);
+self["@errors"]=_st((smalltalk.Array || Array))._new();
+self["@failures"]=_st((smalltalk.Array || Array))._new();
+self["@total"]=(0);
+return self}, self, "initialize", [], smalltalk.TestResult)},
 args: [],
 source: "initialize\x0a\x09super initialize.\x0a\x09timestamp := Date now.\x0a\x09runs := 0.\x0a\x09errors := Array new.\x0a\x09failures := Array new.\x0a\x09total := 0",
 messageSends: ["initialize", "now", "new"],
@@ -529,13 +529,13 @@ selector: "nextRunDo:",
 category: 'running',
 fn: function (aBlock){
 var self=this;
-var $2,$1;
-$2=smalltalk.send(smalltalk.send(self,"_runs",[]),"__eq_eq",[smalltalk.send(self,"_total",[])]);
+return smalltalk.withContext(function($ctx) { var $2,$1;
+$2=_st(_st(self)._runs()).__eq_eq(_st(self)._total());
 if(! smalltalk.assert($2)){
-$1=smalltalk.send(aBlock,"_value_",[smalltalk.send(smalltalk.send(self,"_runs",[]),"__plus",[(1)])]);
+$1=_st(aBlock)._value_(_st(_st(self)._runs()).__plus((1)));
 };
 return $1;
-},
+}, self, "nextRunDo:", [aBlock], smalltalk.TestResult)},
 args: ["aBlock"],
 source: "nextRunDo: aBlock\x0a\x22Runs aBlock with index of next run\x0aor does nothing if no more runs\x22\x0a^self runs == self total\x0a\x09ifFalse: [ aBlock value: self runs + 1 ]",
 messageSends: ["ifFalse:", "value:", "+", "runs", "==", "total"],
@@ -550,17 +550,17 @@ selector: "runCase:",
 category: 'running',
 fn: function (aTestCase){
 var self=this;
-smalltalk.send((function(){
-return smalltalk.send((function(){
-smalltalk.send(self,"_increaseRuns",[]);
-return smalltalk.send(aTestCase,"_runCase",[]);
-}),"_on_do_",[(smalltalk.TestFailure || TestFailure),(function(ex){
-return smalltalk.send(self,"_addFailure_",[aTestCase]);
-})]);
-}),"_on_do_",[(smalltalk.Error || Error),(function(ex){
-return smalltalk.send(self,"_addError_",[aTestCase]);
-})]);
-return self},
+return smalltalk.withContext(function($ctx) { _st((function(){
+return _st((function(){
+_st(self)._increaseRuns();
+return _st(aTestCase)._runCase();
+}))._on_do_((smalltalk.TestFailure || TestFailure),(function(ex){
+return _st(self)._addFailure_(aTestCase);
+}));
+}))._on_do_((smalltalk.Error || Error),(function(ex){
+return _st(self)._addError_(aTestCase);
+}));
+return self}, self, "runCase:", [aTestCase], smalltalk.TestResult)},
 args: ["aTestCase"],
 source: "runCase: aTestCase\x0a\x09[[\x09self increaseRuns.\x0a    \x09aTestCase runCase]\x0a\x09on: TestFailure do: [:ex | self addFailure: aTestCase]]\x0a\x09on: Error do: [:ex | self addError: aTestCase]\x0a",
 messageSends: ["on:do:", "addError:", "addFailure:", "increaseRuns", "runCase"],
@@ -573,10 +573,10 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "runs",
 category: 'accessing',
-fn: function () {
-    var self = this;
-    return self['@runs'];
-},
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { return self["@runs"];
+}, self, "runs", [], smalltalk.TestResult)},
 args: [],
 source: "runs\x0a\x09^runs",
 messageSends: [],
@@ -589,22 +589,22 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "status",
 category: 'accessing',
-fn: function () {
-    var self = this;
-    var $2, $3, $1;
-    $2 = smalltalk.send(smalltalk.send(self, "_errors", []), "_isEmpty", []);
-    if (smalltalk.assert($2)) {
-        $3 = smalltalk.send(smalltalk.send(self, "_failures", []), "_isEmpty", []);
-        if (smalltalk.assert($3)) {
-            $1 = "success";
-        } else {
-            $1 = "failure";
-        }
-    } else {
-        $1 = "error";
-    }
-    return $1;
-},
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { var $2,$3,$1;
+$2=_st(_st(self)._errors())._isEmpty();
+if(smalltalk.assert($2)){
+$3=_st(_st(self)._failures())._isEmpty();
+if(smalltalk.assert($3)){
+$1="success";
+} else {
+$1="failure";
+};
+} else {
+$1="error";
+};
+return $1;
+}, self, "status", [], smalltalk.TestResult)},
 args: [],
 source: "status\x0a\x09^self errors isEmpty \x0a\x09\x09ifTrue: [\x0a\x09\x09\x09self failures isEmpty \x0a\x09\x09\x09\x09ifTrue: ['success']\x0a\x09\x09\x09\x09ifFalse: ['failure']]\x0a\x09\x09ifFalse: ['error']",
 messageSends: ["ifTrue:ifFalse:", "isEmpty", "failures", "errors"],
@@ -617,10 +617,10 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "timestamp",
 category: 'accessing',
-fn: function () {
-    var self = this;
-    return self['@timestamp'];
-},
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { return self["@timestamp"];
+}, self, "timestamp", [], smalltalk.TestResult)},
 args: [],
 source: "timestamp\x0a\x09^timestamp",
 messageSends: [],
@@ -633,10 +633,10 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "total",
 category: 'accessing',
-fn: function () {
-    var self = this;
-    return self['@total'];
-},
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx) { return self["@total"];
+}, self, "total", [], smalltalk.TestResult)},
 args: [],
 source: "total\x0a\x09^total",
 messageSends: [],
@@ -649,11 +649,10 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "total:",
 category: 'accessing',
-fn: function (aNumber) {
-    var self = this;
-    self['@total'] = aNumber;
-    return self;
-},
+fn: function (aNumber){
+var self=this;
+return smalltalk.withContext(function($ctx) { self["@total"]=aNumber;
+return self}, self, "total:", [aNumber], smalltalk.TestResult)},
 args: ["aNumber"],
 source: "total: aNumber\x0a\x09total := aNumber",
 messageSends: [],
@@ -671,8 +670,8 @@ selector: "announcer",
 category: 'accessing',
 fn: function (){
 var self=this;
-return self["@announcer"];
-},
+return smalltalk.withContext(function($ctx) { return self["@announcer"];
+}, self, "announcer", [], smalltalk.TestSuiteRunner)},
 args: [],
 source: "announcer\x0a\x09^announcer",
 messageSends: [],
@@ -687,10 +686,10 @@ selector: "initialize",
 category: 'initialization',
 fn: function (){
 var self=this;
-smalltalk.send(self,"_initialize",[],smalltalk.Object);
-self["@announcer"]=smalltalk.send((smalltalk.Announcer || Announcer),"_new",[]);
-self["@result"]=smalltalk.send((smalltalk.TestResult || TestResult),"_new",[]);
-return self},
+return smalltalk.withContext(function($ctx) { smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
+self["@announcer"]=_st((smalltalk.Announcer || Announcer))._new();
+self["@result"]=_st((smalltalk.TestResult || TestResult))._new();
+return self}, self, "initialize", [], smalltalk.TestSuiteRunner)},
 args: [],
 source: "initialize\x0a\x09super initialize.\x0a\x09announcer := Announcer new.\x0a    result := TestResult new",
 messageSends: ["initialize", "new"],
@@ -705,8 +704,8 @@ selector: "result",
 category: 'accessing',
 fn: function (){
 var self=this;
-return self["@result"];
-},
+return smalltalk.withContext(function($ctx) { return self["@result"];
+}, self, "result", [], smalltalk.TestSuiteRunner)},
 args: [],
 source: "result\x0a\x09^result",
 messageSends: [],
@@ -721,23 +720,23 @@ selector: "run",
 category: 'actions',
 fn: function (){
 var self=this;
-var worker;
-smalltalk.send(self["@result"],"_total_",[smalltalk.send(self["@suite"],"_size",[])]);
-smalltalk.send(self["@announcer"],"_announce_",[smalltalk.send(smalltalk.send((smalltalk.ResultAnnouncement || ResultAnnouncement),"_new",[]),"_result_",[self["@result"]])]);
+return smalltalk.withContext(function($ctx) { var worker;
+_st(self["@result"])._total_(_st(self["@suite"])._size());
+_st(self["@announcer"])._announce_(_st(_st((smalltalk.ResultAnnouncement || ResultAnnouncement))._new())._result_(self["@result"]));
 worker=(function(){
-return smalltalk.send(self["@result"],"_nextRunDo_",[(function(index){
-return smalltalk.send((function(){
-return smalltalk.send(self["@result"],"_runCase_",[smalltalk.send(self["@suite"],"_at_",[index])]);
-}),"_ensure_",[(function(){
-smalltalk.send(worker,"_valueWithTimeout_",[(0)]);
-return smalltalk.send(self["@announcer"],"_announce_",[smalltalk.send(smalltalk.send((smalltalk.ResultAnnouncement || ResultAnnouncement),"_new",[]),"_result_",[self["@result"]])]);
-})]);
-})]);
+return _st(self["@result"])._nextRunDo_((function(index){
+return _st((function(){
+return _st(self["@result"])._runCase_(_st(self["@suite"])._at_(index));
+}))._ensure_((function(){
+_st(worker)._valueWithTimeout_((0));
+return _st(self["@announcer"])._announce_(_st(_st((smalltalk.ResultAnnouncement || ResultAnnouncement))._new())._result_(self["@result"]));
+}));
+}));
 });
-smalltalk.send(smalltalk.send(smalltalk.send(self["@suite"],"_size",[]),"_min_",[(25)]),"_timesRepeat_",[(function(){
-return smalltalk.send(worker,"_valueWithTimeout_",[(0)]);
-})]);
-return self},
+_st(_st(_st(self["@suite"])._size())._min_((25)))._timesRepeat_((function(){
+return _st(worker)._valueWithTimeout_((0));
+}));
+return self}, self, "run", [], smalltalk.TestSuiteRunner)},
 args: [],
 source: "run\x0a\x09| worker |\x0a\x09result total: suite size.\x0a    announcer announce: (ResultAnnouncement new result: result).\x0a    worker := [ result nextRunDo: [ :index |\x0a\x09\x09[ result runCase: (suite at: index) ]\x0a\x09\x09ensure: [ worker valueWithTimeout: 0.\x0a        \x09announcer announce: (ResultAnnouncement new result: result) ]]].\x0a\x09(suite size min: 25) timesRepeat: [ worker valueWithTimeout: 0 ]",
 messageSends: ["total:", "size", "announce:", "result:", "new", "nextRunDo:", "ensure:", "valueWithTimeout:", "runCase:", "at:", "timesRepeat:", "min:"],
@@ -752,8 +751,8 @@ selector: "suite:",
 category: 'accessing',
 fn: function (aCollection){
 var self=this;
-self["@suite"]=aCollection;
-return self},
+return smalltalk.withContext(function($ctx) { self["@suite"]=aCollection;
+return self}, self, "suite:", [aCollection], smalltalk.TestSuiteRunner)},
 args: ["aCollection"],
 source: "suite: aCollection\x0a\x09suite := aCollection",
 messageSends: [],
@@ -769,8 +768,8 @@ selector: "new",
 category: 'instance creation',
 fn: function (){
 var self=this;
-smalltalk.send(self,"_shouldNotImplement",[]);
-return self},
+return smalltalk.withContext(function($ctx) { _st(self)._shouldNotImplement();
+return self}, self, "new", [], smalltalk.TestSuiteRunner.klass)},
 args: [],
 source: "new\x0a\x09self shouldNotImplement",
 messageSends: ["shouldNotImplement"],
@@ -785,10 +784,10 @@ selector: "on:",
 category: 'instance creation',
 fn: function (aCollection){
 var self=this;
-var $1;
-$1=smalltalk.send(smalltalk.send(self,"_new",[],smalltalk.Object.klass),"_suite_",[aCollection]);
+return smalltalk.withContext(function($ctx) { var $1;
+$1=_st(smalltalk.Object.klass.fn.prototype._new.apply(_st(self), []))._suite_(aCollection);
 return $1;
-},
+}, self, "on:", [aCollection], smalltalk.TestSuiteRunner.klass)},
 args: ["aCollection"],
 source: "on: aCollection\x0a\x09^super new suite: aCollection",
 messageSends: ["suite:", "new"],

+ 11 - 4
js/boot.js

@@ -499,6 +499,7 @@ function Smalltalk() {
     };
 
 	/* Handles unhandled errors during message sends */
+    // TODO: simply send the message ans handle #dnu:
 
 	st.send = function(receiver, selector, args, klass) {
 		if(st.thisContext) {
@@ -518,6 +519,7 @@ function Smalltalk() {
 		}
 	};
 
+    //TODO: remove
 	function withContextSend(receiver, selector, args, klass) {
 		var call, method;
 		if(receiver == null) {
@@ -536,6 +538,7 @@ function Smalltalk() {
 
 	st.withContext = function(fn, receiver, selector, args, lookupClass) {
 		if(st.thisContext) {
+            st.thisContext.pc++;
 			return inContext(fn, receiver, selector, args, lookupClass);
 		} else {
 			try {return inContext(fn, receiver, selector, args, lookupClass)}
@@ -634,11 +637,12 @@ function Smalltalk() {
 
 		}
 		st.oldContext = null;
+
 		c.homeContext = tc;
-        c.pc          = 1;
 		c.receiver    = receiver;
         c.selector    = selector || "";
 		c.locals      = locals || {};
+        c.lookupClass = lookupClass;
 		return st.thisContext = c;
 	}
 
@@ -751,12 +755,13 @@ function Smalltalk() {
 
 inherits(Smalltalk, SmalltalkObject);
 
-function SmalltalkMethodContext(receiver, selector, locals, home, lookupClass) {
+function SmalltalkMethodContext(receiver, selector, locals, home, lookupClass, pc) {
 	this.receiver    = receiver;
     this.selector    = selector;
 	this.locals      = locals || {};
 	this.homeContext = home;
     this.lookupClass = lookupClass;
+    this.pc          = pc || 0;
 }
 
 inherits(SmalltalkMethodContext, SmalltalkObject);
@@ -767,8 +772,10 @@ SmalltalkMethodContext.prototype.copy = function() {
 	return new SmalltalkMethodContext(
 		this.receiver,
         this.selector,
-		this.temps,
-		home
+		this.locals,
+		home,
+        this.lookupClass,
+        this.pc
 	);
 };
 

+ 1 - 1
js/parser.js

@@ -1466,7 +1466,7 @@ smalltalk.parser = (function(){
           result0 = null;
         }
         if (result0 !== null) {
-          result0 = (function(offset, line, column, bin) {return bin.join("").replace(/\\/g, '\\\\')})(pos0.offset, pos0.line, pos0.column, result0);
+          result0 = (function(offset, line, column, bin) {return bin.join("")})(pos0.offset, pos0.line, pos0.column, result0);
         }
         if (result0 === null) {
           pos = clone(pos0);

+ 1 - 1
js/parser.pegjs

@@ -69,7 +69,7 @@ reference      = variable / classReference
 
 keywordPair    = key:keyword ws arg:binarySend ws {return {key:key, arg: arg}}
 
-binarySelector = bin:[\\+*/=><,@%~|&-]+ {return bin.join("").replace(/\\/g, '\\\\')}
+binarySelector = bin:[\\+*/=><,@%~|&-]+ {return bin.join("")}
 unarySelector  = identifier
 
 keywordPattern = pairs:(ws key:keyword ws arg:identifier {return {key:key, arg: arg}})+ {

+ 0 - 539
st/Compiler-Core.st

@@ -294,542 +294,3 @@ translator
 		yourself
 ! !
 
-AbstractCodeGenerator subclass: #FunCodeGenerator
-	instanceVariableNames: 'stream nestedBlocks earlyReturn currentSelector unknownVariables tempVariables messageSends referencedClasses classReferenced argVariables'
-	package: 'Compiler-Core'!
-
-!FunCodeGenerator methodsFor: 'accessing'!
-
-argVariables
-	^argVariables copy
-!
-
-knownVariables
-	^self pseudoVariables 
-		addAll: self tempVariables;
-		addAll: self argVariables;
-		yourself
-!
-
-tempVariables
-	^tempVariables copy
-!
-
-unknownVariables
-	^unknownVariables copy
-! !
-
-!FunCodeGenerator methodsFor: 'compiling'!
-
-compileNode: aNode
-	stream := '' writeStream.
-	self visit: aNode.
-	^stream contents
-! !
-
-!FunCodeGenerator methodsFor: 'initialization'!
-
-initialize
-	super initialize.
-	stream := '' writeStream. 
-	unknownVariables := #().
-	tempVariables := #().
-	argVariables := #().
-	messageSends := #().
-	classReferenced := #()
-! !
-
-!FunCodeGenerator methodsFor: 'optimizations'!
-
-checkClass: aClassName for: receiver
-        stream nextPutAll: '((($receiver = ', receiver, ').klass === smalltalk.', aClassName, ') ? '
-!
-
-inline: aSelector receiver: receiver argumentNodes: aCollection
-        | inlined |
-        inlined := false.
-
-	"-- Booleans --"
-
-	(aSelector = 'ifFalse:') ifTrue: [
-		aCollection first isBlockNode ifTrue: [
-                	self checkClass: 'Boolean' for: receiver.
-                	stream nextPutAll: '(!! $receiver ? '.
-                	self visit: aCollection first.
-          		stream nextPutAll: '() : nil)'.
-                	inlined := true]].
-
-	(aSelector = 'ifTrue:') ifTrue: [
-		aCollection first isBlockNode ifTrue: [
-                	self checkClass: 'Boolean' for: receiver.
-                	stream nextPutAll: '($receiver ? '.
-                	self visit: aCollection first.
-          		stream nextPutAll: '() : nil)'.
-                	inlined := true]].
-
-	(aSelector = 'ifTrue:ifFalse:') ifTrue: [
-		(aCollection first isBlockNode and: [aCollection second isBlockNode]) ifTrue: [
-                	self checkClass: 'Boolean' for: receiver.
-                	stream nextPutAll: '($receiver ? '.
-                	self visit: aCollection first.
-          		stream nextPutAll: '() : '.
-          		self visit: aCollection second.
-          		stream nextPutAll: '())'.
-                	inlined := true]].
-
-	(aSelector = 'ifFalse:ifTrue:') ifTrue: [
-		(aCollection first isBlockNode and: [aCollection second isBlockNode]) ifTrue: [
-                	self checkClass: 'Boolean' for: receiver.
-                	stream nextPutAll: '(!! $receiver ? '.
-                	self visit: aCollection first.
-          		stream nextPutAll: '() : '.
-          		self visit: aCollection second.
-          		stream nextPutAll: '())'.
-                	inlined := true]].
-
-	"-- Numbers --"
-
-	(aSelector = '<') ifTrue: [
-                self checkClass: 'Number' for: receiver.
-                stream nextPutAll: '$receiver <'.
-                self visit: aCollection first.
-                inlined := true].
-
-	(aSelector = '<=') ifTrue: [
-                self checkClass: 'Number' for: receiver.
-                stream nextPutAll: '$receiver <='.
-                self visit: aCollection first.
-                inlined := true].
-
-	(aSelector = '>') ifTrue: [ 
-                self checkClass: 'Number' for: receiver.
-                stream nextPutAll: '$receiver >'.
-                self visit: aCollection first.
-                inlined := true].
-
-	(aSelector = '>=') ifTrue: [
-                self checkClass: 'Number' for: receiver.
-                stream nextPutAll: '$receiver >='.
-                self visit: aCollection first.
-                inlined := true].
-
-        (aSelector = '+') ifTrue: [
-                self checkClass: 'Number' for: receiver.
-                stream nextPutAll: '$receiver +'.
-                self visit: aCollection first.
-                inlined := true].
-
-        (aSelector = '-') ifTrue: [
-                self checkClass: 'Number' for: receiver.
-                stream nextPutAll: '$receiver -'.
-                self visit: aCollection first.
-                inlined := true].
-
-        (aSelector = '*') ifTrue: [
-                self checkClass: 'Number' for: receiver.
-                stream nextPutAll: '$receiver *'.
-                self visit: aCollection first.
-                inlined := true].
-
-        (aSelector = '/') ifTrue: [
-                self checkClass: 'Number' for: receiver.
-                stream nextPutAll: '$receiver /'.
-                self visit: aCollection first.
-                inlined := true].
-
-        ^inlined
-!
-
-inlineLiteral: aSelector receiverNode: anObject argumentNodes: aCollection
-        | inlined |
-        inlined := false.
- 
-	"-- BlockClosures --"
-
-	(aSelector = 'whileTrue:') ifTrue: [
-          	(anObject isBlockNode and: [aCollection first isBlockNode]) ifTrue: [
-                	stream nextPutAll: '(function(){while('.
-                  	self visit: anObject.
-                  	stream nextPutAll: '()) {'.
-                	self visit: aCollection first.
-          		stream nextPutAll: '()}})()'.
-                	inlined := true]].
-
-	(aSelector = 'whileFalse:') ifTrue: [
-          	(anObject isBlockNode and: [aCollection first isBlockNode]) ifTrue: [
-                	stream nextPutAll: '(function(){while(!!'.
-                  	self visit: anObject.
-                  	stream nextPutAll: '()) {'.
-                	self visit: aCollection first.
-          		stream nextPutAll: '()}})()'.
-                	inlined := true]].
-
-	(aSelector = 'whileTrue') ifTrue: [
-          	anObject isBlockNode ifTrue: [
-                	stream nextPutAll: '(function(){while('.
-                  	self visit: anObject.
-                  	stream nextPutAll: '()) {}})()'.
-                	inlined := true]].
-
-	(aSelector = 'whileFalse') ifTrue: [
-          	anObject isBlockNode ifTrue: [
-                	stream nextPutAll: '(function(){while(!!'.
-                  	self visit: anObject.
-                  	stream nextPutAll: '()) {}})()'.
-                	inlined := true]].
-
-	"-- Numbers --"
-
-	(aSelector = '+') ifTrue: [
-          	(self isNode: anObject ofClass: Number) ifTrue: [
-                  	self visit: anObject.
-                  	stream nextPutAll: ' + '.
-                	self visit: aCollection first.
-                	inlined := true]].
-
-	(aSelector = '-') ifTrue: [
-          	(self isNode: anObject ofClass: Number) ifTrue: [
-                  	self visit: anObject.
-                  	stream nextPutAll: ' - '.
-                	self visit: aCollection first.
-                	inlined := true]].
-
-	(aSelector = '*') ifTrue: [
-          	(self isNode: anObject ofClass: Number) ifTrue: [
-                  	self visit: anObject.
-                  	stream nextPutAll: ' * '.
-                	self visit: aCollection first.
-                	inlined := true]].
-
-	(aSelector = '/') ifTrue: [
-          	(self isNode: anObject ofClass: Number) ifTrue: [
-                  	self visit: anObject.
-                  	stream nextPutAll: ' / '.
-                	self visit: aCollection first.
-                	inlined := true]].
-
-	(aSelector = '<') ifTrue: [
-          	(self isNode: anObject ofClass: Number) ifTrue: [
-                  	self visit: anObject.
-                  	stream nextPutAll: ' < '.
-                	self visit: aCollection first.
-                	inlined := true]].
-
-	(aSelector = '<=') ifTrue: [
-          	(self isNode: anObject ofClass: Number) ifTrue: [
-                  	self visit: anObject.
-                  	stream nextPutAll: ' <= '.
-                	self visit: aCollection first.
-                	inlined := true]].
-
-	(aSelector = '>') ifTrue: [
-          	(self isNode: anObject ofClass: Number) ifTrue: [
-                  	self visit: anObject.
-                  	stream nextPutAll: ' > '.
-                	self visit: aCollection first.
-                	inlined := true]].
-
-	(aSelector = '>=') ifTrue: [
-          	(self isNode: anObject ofClass: Number) ifTrue: [
-                  	self visit: anObject.
-                  	stream nextPutAll: ' >= '.
-                	self visit: aCollection first.
-                	inlined := true]].
-                	   
-	"-- UndefinedObject --"
-
-	(aSelector = 'ifNil:') ifTrue: [
-		aCollection first isBlockNode ifTrue: [
-          		stream nextPutAll: '(($receiver = '.
-          		self visit: anObject.
-          		stream nextPutAll: ') == nil || $receiver == undefined) ? '.
-                  	self visit: aCollection first.
-                  	stream nextPutAll: '() : $receiver'.
-                  	inlined := true]].
-
-	(aSelector = 'ifNotNil:') ifTrue: [
-		aCollection first isBlockNode ifTrue: [
-          		stream nextPutAll: '(($receiver = '.
-          		self visit: anObject.
-          		stream nextPutAll: ') !!= nil && $receiver !!= undefined) ? '.
-                  	self visit: aCollection first.
-                  	stream nextPutAll: '() : nil'.
-                  	inlined := true]].
-
-	(aSelector = 'ifNil:ifNotNil:') ifTrue: [
-		(aCollection first isBlockNode and: [aCollection second isBlockNode]) ifTrue: [
-          		stream nextPutAll: '(($receiver = '.
-          		self visit: anObject.
-          		stream nextPutAll: ') == nil || $receiver == undefined) ? '.
-                  	self visit: aCollection first.
-                  	stream nextPutAll: '() : '.
-                  	self visit: aCollection second.
-                  	stream nextPutAll: '()'.
-                  	inlined := true]].
-
-	(aSelector = 'ifNotNil:ifNil:') ifTrue: [
-		(aCollection first isBlockNode and: [aCollection second isBlockNode]) ifTrue: [
-          		stream nextPutAll: '(($receiver = '.
-          		self visit: anObject.
-          		stream nextPutAll: ') == nil || $receiver == undefined) ? '.
-                  	self visit: aCollection second.
-                  	stream nextPutAll: '() : '.
-                  	self visit: aCollection first.
-                  	stream nextPutAll: '()'.
-                  	inlined := true]].
-                 
-        ^inlined
-!
-
-isNode: aNode ofClass: aClass
-	^aNode isValueNode and: [
-          	aNode value class = aClass or: [
-          		aNode value = 'self' and: [self currentClass = aClass]]]
-! !
-
-!FunCodeGenerator methodsFor: 'testing'!
-
-performOptimizations
-	^self class performOptimizations
-! !
-
-!FunCodeGenerator methodsFor: 'visiting'!
-
-send: aSelector to: aReceiver arguments: aCollection superSend: aBoolean
-	^String streamContents: [:str || tmp |
-        	tmp := stream.
-		str nextPutAll: 'smalltalk.send('.
-		str nextPutAll: aReceiver.
-		str nextPutAll: ', "', aSelector asSelector, '", ['.
-                stream := str.
-		aCollection
-	    		do: [:each | self visit: each]
-	    		separatedBy: [stream nextPutAll: ', '].
-                stream := tmp.
-                str nextPutAll: ']'.
-		aBoolean ifTrue: [
-			str nextPutAll: ', smalltalk.', (self classNameFor: self currentClass), '.superclass || nil'].
-		str nextPutAll: ')']
-!
-
-visit: aNode
-	aNode accept: self
-!
-
-visitAssignmentNode: aNode
-	stream nextPutAll: '('.
-	self visit: aNode left.
-	stream nextPutAll: '='.
-	self visit: aNode right.
-	stream nextPutAll: ')'
-!
-
-visitBlockNode: aNode
-	stream nextPutAll: '(function('.
-	aNode parameters 
-	    do: [:each |
-		tempVariables add: each.
-		stream nextPutAll: each]
-	    separatedBy: [stream nextPutAll: ', '].
-	stream nextPutAll: '){'.
-	aNode nodes do: [:each | self visit: each].
-	stream nextPutAll: '})'
-!
-
-visitBlockSequenceNode: aNode
-	| index |
-	nestedBlocks := nestedBlocks + 1.
-	aNode nodes isEmpty
-	    ifTrue: [
-		stream nextPutAll: 'return nil;']
-	    ifFalse: [
-		aNode temps do: [:each | | temp |
-                    temp := self safeVariableNameFor: each.
-		    tempVariables add: temp.
-		    stream nextPutAll: 'var ', temp, '=nil;'; lf].
-		index := 0.
-		aNode nodes do: [:each |
-		    index := index + 1.
-		    index = aNode nodes size ifTrue: [
-			stream nextPutAll: 'return '].
-		    self visit: each.
-		    stream nextPutAll: ';']].
-	nestedBlocks := nestedBlocks - 1
-!
-
-visitCascadeNode: aNode
-	| index |
-	index := 0.
-	(tempVariables includes: '$rec') ifFalse: [
-		tempVariables add: '$rec'].
-	stream nextPutAll: '(function($rec){'.
-	aNode nodes do: [:each |
-	    index := index + 1.
-	    index = aNode nodes size ifTrue: [
-		stream nextPutAll: 'return '].
-	    each receiver: (VariableNode new value: '$rec').
-	    self visit: each.
-	    stream nextPutAll: ';'].
-	stream nextPutAll: '})('.
-	self visit: aNode receiver.
-	stream nextPutAll: ')'
-!
-
-visitClassReferenceNode: aNode
-	(referencedClasses includes: aNode value) ifFalse: [
-		referencedClasses add: aNode value].
-	stream nextPutAll: '(smalltalk.', aNode value, ' || ', aNode value, ')'
-!
-
-visitDynamicArrayNode: aNode
-	stream nextPutAll: '['.
-	aNode nodes 
-		do: [:each | self visit: each]
-		separatedBy: [stream nextPutAll: ','].
-	stream nextPutAll: ']'
-!
-
-visitDynamicDictionaryNode: aNode
-	stream nextPutAll: 'smalltalk.HashedCollection._fromPairs_(['.
-		aNode nodes 
-			do: [:each | self visit: each]
-			separatedBy: [stream nextPutAll: ','].
-		stream nextPutAll: '])'
-!
-
-visitFailure: aFailure
-	self error: aFailure asString
-!
-
-visitJSStatementNode: aNode
-	stream nextPutAll: aNode source
-!
-
-visitMethodNode: aNode
-	| str currentSelector | 
-	currentSelector := aNode selector asSelector.
-	nestedBlocks := 0.
-	earlyReturn := false.
-	messageSends := #().
-	referencedClasses := #().
-	unknownVariables := #().
-	tempVariables := #().
-	argVariables := #().
-	stream 
-	    nextPutAll: 'smalltalk.method({'; lf;
-	    nextPutAll: 'selector: "', aNode selector, '",'; lf.
-	stream nextPutAll: 'source: ', self source asJavascript, ',';lf.
-	stream nextPutAll: 'fn: function('.
-	aNode arguments 
-	    do: [:each | 
-		argVariables add: each.
-		stream nextPutAll: each]
-	    separatedBy: [stream nextPutAll: ', '].
-	stream 
-	    nextPutAll: '){'; lf;
-	    nextPutAll: 'var self=this;'; lf.
-	str := stream.
-	stream := '' writeStream.
-	aNode nodes do: [:each |
-	    self visit: each].
-	earlyReturn ifTrue: [
-	    str nextPutAll: 'var $early={};'; lf; nextPutAll: 'try{'].
-	str nextPutAll: stream contents.
-	stream := str.
-	stream 
-	    lf; 
-	    nextPutAll: 'return self;'.
-	earlyReturn ifTrue: [
-	    stream lf; nextPutAll: '} catch(e) {if(e===$early)return e[0]; throw e}'].
-	stream nextPutAll: '}'.
-	stream 
-		nextPutAll: ',', String lf, 'messageSends: ';
-		nextPutAll: messageSends asJavascript, ','; lf;
-          	nextPutAll: 'args: ', argVariables asJavascript, ','; lf;
-		nextPutAll: 'referencedClasses: ['.
-	referencedClasses 
-		do: [:each | stream nextPutAll: each printString]
-		separatedBy: [stream nextPutAll: ','].
-	stream nextPutAll: ']'.
-	stream nextPutAll: '})'
-!
-
-visitReturnNode: aNode
-	nestedBlocks > 0 ifTrue: [
-	    earlyReturn := true].
-	nestedBlocks > 0
-	    ifTrue: [
-		stream
-		    nextPutAll: '(function(){throw $early=[']
-	    ifFalse: [stream nextPutAll: 'return '].
-	aNode nodes do: [:each |
-	    self visit: each].
-	nestedBlocks > 0 ifTrue: [
-	    stream nextPutAll: ']})()']
-!
-
-visitSendNode: aNode
-        | str receiver superSend inlined |
-        str := stream.
-        (messageSends includes: aNode selector) ifFalse: [
-                messageSends add: aNode selector].
-        stream := '' writeStream.
-        self visit: aNode receiver.
-        superSend := stream contents = 'super'.
-        receiver := superSend ifTrue: ['self'] ifFalse: [stream contents].
-        stream := str.
-	
-	self performOptimizations 
-		ifTrue: [
-			(self inlineLiteral: aNode selector receiverNode: aNode receiver argumentNodes: aNode arguments) ifFalse: [
-				(self inline: aNode selector receiver: receiver argumentNodes: aNode arguments)
-                			ifTrue: [stream nextPutAll: ' : ', (self send: aNode selector to: '$receiver' arguments: aNode arguments superSend: superSend), ')']
-                			ifFalse: [stream nextPutAll: (self send: aNode selector to: receiver arguments: aNode arguments superSend: superSend)]]]
-		ifFalse: [stream nextPutAll: (self send: aNode selector to: receiver arguments: aNode arguments superSend: superSend)]
-!
-
-visitSequenceNode: aNode
-	aNode temps do: [:each || temp |
-            temp := self safeVariableNameFor: each.
-	    tempVariables add: temp.
-	    stream nextPutAll: 'var ', temp, '=nil;'; lf].
-	aNode nodes do: [:each |
-	    self visit: each.
-	    stream nextPutAll: ';']
-	    separatedBy: [stream lf]
-!
-
-visitValueNode: aNode
-	stream nextPutAll: aNode value asJavascript
-!
-
-visitVariableNode: aNode
-	| varName |
-	(self currentClass allInstanceVariableNames includes: aNode value) 
-		ifTrue: [stream nextPutAll: 'self[''@', aNode value, ''']']
-		ifFalse: [
-                  	varName := self safeVariableNameFor: aNode value.
-			(self knownVariables includes: varName) 
-                  		ifFalse: [
-                                  	unknownVariables add: aNode value.
-                                  	aNode assigned 
-                                  		ifTrue: [stream nextPutAll: varName]
-                                  		ifFalse: [stream nextPutAll: '(typeof ', varName, ' == ''undefined'' ? nil : ', varName, ')']]
-                  		ifTrue: [
-                                  	aNode value = 'thisContext'
-                                  		ifTrue: [stream nextPutAll: '(smalltalk.getThisContext())']
-                				ifFalse: [stream nextPutAll: varName]]]
-! !
-
-FunCodeGenerator class instanceVariableNames: 'performOptimizations'!
-
-!FunCodeGenerator class methodsFor: 'accessing'!
-
-performOptimizations
-	^performOptimizations ifNil: [true]
-!
-
-performOptimizations: aBoolean
-	performOptimizations := aBoolean
-! !
-

+ 19 - 5
st/Compiler-IR.st

@@ -151,6 +151,7 @@ visitMethodNode: aNode
 
 	self method: (IRMethod new
 		source: self source;
+        theClass: self theClass;
 		arguments: aNode arguments;
 		selector: aNode selector;
 		messageSends: aNode messageSends;
@@ -409,7 +410,7 @@ accept: aVisitor
 ! !
 
 IRScopedInstruction subclass: #IRMethod
-	instanceVariableNames: 'source selector classReferences messageSends superSends arguments internalVariables'
+	instanceVariableNames: 'theClass source selector classReferences messageSends superSends arguments internalVariables'
 	package: 'Compiler-IR'!
 !IRMethod commentStamp!
 I am a method instruction!
@@ -471,6 +472,14 @@ superSends
 
 superSends: aCollection
 	superSends := aCollection
+!
+
+theClass
+	^ theClass
+!
+
+theClass: aClass
+	theClass := aClass
 ! !
 
 !IRMethod methodsFor: 'visiting'!
@@ -871,6 +880,7 @@ visitIRMethod: anIRMethod
 		nextPutMethodDeclaration: anIRMethod 
 		with: [ self stream 
 			nextPutFunctionWith: [ 
+            	self stream nextPutContextFor: anIRMethod during: [
 				anIRMethod internalVariables notEmpty ifTrue: [
 					self stream nextPutVars: (anIRMethod internalVariables asArray collect: [ :each |
 						each variable alias ]) ].
@@ -878,7 +888,7 @@ visitIRMethod: anIRMethod
 					ifTrue: [
 						self stream nextPutNonLocalReturnHandlingWith: [
 							super visitIRMethod: anIRMethod ]]
-					ifFalse: [ super visitIRMethod: anIRMethod ]]
+					ifFalse: [ super visitIRMethod: anIRMethod ]]]
 			arguments: anIRMethod arguments ]
 !
 
@@ -1006,12 +1016,16 @@ nextPutClosureWith: aBlock arguments: anArray
 !
 
 nextPutContextFor: aMethod during: aBlock
-	self nextPutAll: 'return smalltalk.withContext(function() {'.
+	self nextPutAll: 'return smalltalk.withContext(function($ctx) { '.
     aBlock value.
     self 
     	nextPutAll: '}, self, ';
-        nextPutAll: aMethod selector asJavascript, ', ';
-        nextPutAll: aMethod arguments asJavascript;
+        nextPutAll: aMethod selector asJavascript, ', ['.
+    aMethod arguments 
+    	do: [ :each | self nextPutAll: each ]
+      	separatedBy: [ self nextPutAll: ','  ].
+    self nextPutAll: '], ';
+        nextPutAll: aMethod theClass asJavascript;
         nextPutAll: ')'
 !
 

+ 21 - 4
st/Compiler-Interpreter.st

@@ -46,6 +46,21 @@ visitBlockNode: aNode
     ^ [ self interpretNode: aNode nodes first ]
 !
 
+visitCascadeNode: aNode
+
+    aNode nodes allButLast
+    	do: [ :each | 
+        	each receiver: aNode receiver.
+			self interpretNode: each ].
+            
+	aNode nodes last receiver: aNode receiver.
+    ^ self interpretNode: aNode nodes last
+!
+
+visitJSStatementNode: aNode
+	self halt
+!
+
 visitReturnNode: aNode
 	shouldReturn := true.
     ^ self interpretNode: aNode nodes first
@@ -73,11 +88,11 @@ visitValueNode: aNode
 	^ aNode value
 ! !
 
-TestCase subclass: #ASTInterpretorTest
+TestCase subclass: #ASTInterpreterTest
 	instanceVariableNames: ''
 	package: 'Compiler-Interpreter'!
 
-!ASTInterpretorTest methodsFor: 'accessing'!
+!ASTInterpreterTest methodsFor: 'accessing'!
 
 analyze: aNode forClass: aClass
 	(SemanticAnalyzer on: aClass) visit: aNode.
@@ -99,13 +114,15 @@ parse: aString forClass: aClass
 	^ self analyze: (self parse: aString) forClass: aClass
 ! !
 
-!ASTInterpretorTest methodsFor: 'tests'!
+!ASTInterpreterTest methodsFor: 'tests'!
 
 testBinarySend
 	self assert: (self interpret: 'foo 2+3+4') equals: 9
 !
 
 testBlockLiteral
-	self assert: false
+	self assert: (self interpret: 'foo ^ true ifTrue: [ 1 ] ifFalse: [ 2 ]') equals: 1.
+    self assert: (self interpret: 'foo true ifTrue: [ ^ 1 ] ifFalse: [ 2 ]') equals: 1.
+    self assert: (self interpret: 'foo ^ false ifTrue: [ 1 ] ifFalse: [ 2 ]') equals: 2
 ! !
 

+ 0 - 36
st/Compiler-Tests.st

@@ -1,40 +1,4 @@
 Smalltalk current createPackage: 'Compiler-Tests' properties: #{}!
-TestCase subclass: #ASTInterpretorTest
-	instanceVariableNames: ''
-	package: 'Compiler-Interpreter'!
-
-!ASTInterpretorTest methodsFor: 'accessing'!
-
-analyze: aNode forClass: aClass
-	(SemanticAnalyzer on: aClass) visit: aNode.
-    ^ aNode
-!
-
-interpret: aString
-	"the food is a methodNode. Interpret the sequenceNode only"
-    ^ ASTInterpreter new
-    	interpret: (self parse: aString forClass: Object) 
-        	nodes first
-!
-
-parse: aString
-	^ Smalltalk current parse: aString
-!
-
-parse: aString forClass: aClass
-	^ self analyze: (self parse: aString) forClass: aClass
-! !
-
-!ASTInterpretorTest methodsFor: 'tests'!
-
-testBinarySend
-	self assert: (self interpret: 'foo 2+3+4') equals: 9
-!
-
-testBlockLiteral
-	self assert: false
-! !
-
 TestCase subclass: #CodeGeneratorTest
 	instanceVariableNames: 'receiver'
 	package: 'Compiler-Tests'!

+ 1 - 19
st/IDE.st

@@ -1333,7 +1333,7 @@ label
 !
 
 method
-	^selectedContext receiver class methodAt: selectedContext selector
+	^selectedContext method
 !
 
 receiver
@@ -2390,24 +2390,6 @@ inspectOn: anInspector
 		setVariables: variables
 ! !
 
-!Date methodsFor: '*IDE'!
-
-inspectOn: anInspector
-	| variables |
-	variables := Dictionary new.
-	variables at: '#self' put: self.
-	variables at: '#year' put: self year.
-	variables at: '#month' put: self month.
-	variables at: '#day' put: self day.
-	variables at: '#hours' put: self hours.
-	variables at: '#minutes' put: self minutes.
-	variables at: '#seconds' put: self seconds.
-	variables at: '#milliseconds' put: self milliseconds.
-	anInspector 
-		setLabel: self printString;
-		setVariables: variables
-! !
-
 !MethodContext methodsFor: '*IDE'!
 
 inspectOn: anInspector

+ 9 - 1
st/Kernel-Methods.st

@@ -286,6 +286,14 @@ home
 	<return self.homeContext>
 !
 
+locals
+	<return self.locals>
+!
+
+method
+	<return self.method()>
+!
+
 pc
 	<return self.pc>
 !
@@ -303,6 +311,6 @@ selector
 !
 
 temps
-	<return self.temps>
+	^ self locals
 ! !
 

+ 4 - 0
st/Kernel-Objects.st

@@ -845,6 +845,10 @@ identityHash
 	<return self % aNumber>
 !
 
+\\ aNumber
+	<return self % aNumber>
+!
+
 abs
 	^ <Math.abs(self);>
 !

部分文件因为文件数量过多而无法显示