resin 0.3.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. data/amber/bin/amberc +10 -350
  2. data/amber/js/Benchfib.deploy.js +80 -89
  3. data/amber/js/Benchfib.js +80 -89
  4. data/amber/js/Canvas.deploy.js +558 -545
  5. data/amber/js/Canvas.js +563 -545
  6. data/amber/js/Compiler-AST.deploy.js +431 -243
  7. data/amber/js/Compiler-AST.js +487 -244
  8. data/amber/js/Compiler-Core.deploy.js +201 -1045
  9. data/amber/js/Compiler-Core.js +208 -1207
  10. data/amber/js/Compiler-Exceptions.deploy.js +37 -18
  11. data/amber/js/Compiler-Exceptions.js +42 -18
  12. data/amber/js/Compiler-IR.deploy.js +1071 -774
  13. data/amber/js/Compiler-IR.js +1194 -848
  14. data/amber/js/Compiler-Inlining.deploy.js +395 -373
  15. data/amber/js/Compiler-Inlining.js +395 -373
  16. data/amber/js/Compiler-Interpreter.deploy.js +1202 -0
  17. data/amber/js/Compiler-Interpreter.js +1631 -0
  18. data/amber/js/Compiler-Semantic.deploy.js +695 -600
  19. data/amber/js/Compiler-Semantic.js +721 -611
  20. data/amber/js/Compiler-Tests.deploy.js +699 -376
  21. data/amber/js/Compiler-Tests.js +834 -381
  22. data/amber/js/Compiler.deploy.js +8563 -1805
  23. data/amber/js/Compiler.js +11476 -2633
  24. data/amber/js/Examples.deploy.js +29 -29
  25. data/amber/js/Examples.js +29 -29
  26. data/amber/js/IDE.deploy.js +3292 -2649
  27. data/amber/js/IDE.js +3318 -2710
  28. data/amber/js/Importer-Exporter.deploy.js +393 -349
  29. data/amber/js/Importer-Exporter.js +398 -354
  30. data/amber/js/Kernel-Announcements.deploy.js +53 -44
  31. data/amber/js/Kernel-Announcements.js +55 -44
  32. data/amber/js/Kernel-Classes.deploy.js +566 -368
  33. data/amber/js/Kernel-Classes.js +660 -402
  34. data/amber/js/Kernel-Collections.deploy.js +1149 -1098
  35. data/amber/js/Kernel-Collections.js +1183 -1116
  36. data/amber/js/Kernel-Exceptions.deploy.js +173 -75
  37. data/amber/js/Kernel-Exceptions.js +215 -77
  38. data/amber/js/Kernel-Methods.deploy.js +530 -313
  39. data/amber/js/Kernel-Methods.js +632 -338
  40. data/amber/js/Kernel-Objects.deploy.js +1734 -1577
  41. data/amber/js/Kernel-Objects.js +1867 -1654
  42. data/amber/js/Kernel-Tests.deploy.js +1416 -973
  43. data/amber/js/Kernel-Tests.js +1495 -981
  44. data/amber/js/Kernel-Transcript.deploy.js +23 -24
  45. data/amber/js/Kernel-Transcript.js +25 -26
  46. data/amber/js/SUnit-Tests.deploy.js +402 -0
  47. data/amber/js/SUnit-Tests.js +518 -0
  48. data/amber/js/SUnit.deploy.js +535 -237
  49. data/amber/js/SUnit.js +634 -246
  50. data/amber/js/amber.js +90 -53
  51. data/amber/js/boot.js +441 -255
  52. data/amber/js/init.js +1 -3
  53. data/amber/js/lib/CodeMirror/codemirror.css +3 -0
  54. data/amber/js/lib/CodeMirror/codemirror.js +104 -55
  55. data/amber/js/lib/peg-0.7.0.min.js +9 -0
  56. data/amber/js/parser.js +1504 -802
  57. data/amber/js/parser.pegjs +170 -165
  58. data/amber/st/Canvas.st +6 -0
  59. data/amber/st/Compiler-AST.st +54 -3
  60. data/amber/st/Compiler-Core.st +6 -551
  61. data/amber/st/Compiler-Exceptions.st +4 -0
  62. data/amber/st/Compiler-IR.st +205 -87
  63. data/amber/st/Compiler-Interpreter.st +597 -0
  64. data/amber/st/Compiler-Semantic.st +46 -21
  65. data/amber/st/Compiler-Tests.st +254 -7
  66. data/amber/st/Compiler.st +3172 -1541
  67. data/amber/st/IDE.st +57 -93
  68. data/amber/st/Importer-Exporter.st +4 -7
  69. data/amber/st/Kernel-Announcements.st +8 -0
  70. data/amber/st/Kernel-Classes.st +149 -40
  71. data/amber/st/Kernel-Collections.st +43 -32
  72. data/amber/st/Kernel-Exceptions.st +70 -1
  73. data/amber/st/Kernel-Methods.st +165 -27
  74. data/amber/st/Kernel-Objects.st +215 -140
  75. data/amber/st/Kernel-Tests.st +195 -10
  76. data/amber/st/Kernel-Transcript.st +1 -3
  77. data/amber/st/SUnit-Tests.st +186 -0
  78. data/amber/st/SUnit.st +186 -14
  79. data/bin/resin +6 -0
  80. data/lib/resin/cli.rb +19 -0
  81. metadata +41 -25
  82. data/amber/js/lib/peg-0.6.2.min.js +0 -2
  83. data/bin/resin-compile +0 -6
  84. data/bin/runresin +0 -12
@@ -8,14 +8,15 @@ selector: "codeGeneratorClass",
8
8
  category: 'accessing',
9
9
  fn: function (){
10
10
  var self=this;
11
- var $1;
12
- if(($receiver = self["@codeGeneratorClass"]) == nil || $receiver == undefined){
11
+ return smalltalk.withContext(function($ctx1) {
12
+ $2=self["@codeGeneratorClass"];
13
+ if(($receiver = $2) == nil || $receiver == undefined){
13
14
  $1=(smalltalk.InliningCodeGenerator || InliningCodeGenerator);
14
15
  } else {
15
- $1=self["@codeGeneratorClass"];
16
+ $1=$2;
16
17
  };
17
18
  return $1;
18
- },
19
+ }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{}, smalltalk.Compiler)})},
19
20
  args: [],
20
21
  source: "codeGeneratorClass\x0a\x09^codeGeneratorClass ifNil: [InliningCodeGenerator]",
21
22
  messageSends: ["ifNil:"],
@@ -30,8 +31,8 @@ selector: "codeGeneratorClass:",
30
31
  category: 'accessing',
31
32
  fn: function (aClass){
32
33
  var self=this;
33
- self["@codeGeneratorClass"]=aClass;
34
- return self},
34
+ return smalltalk.withContext(function($ctx1) {
35
+ return self}, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass:",{aClass:aClass}, smalltalk.Compiler)})},
35
36
  args: ["aClass"],
36
37
  source: "codeGeneratorClass: aClass\x0a\x09codeGeneratorClass := aClass",
37
38
  messageSends: [],
@@ -46,10 +47,10 @@ selector: "compile:",
46
47
  category: 'compiling',
47
48
  fn: function (aString){
48
49
  var self=this;
49
- var $1;
50
- $1=smalltalk.send(self,"_compileNode_",[smalltalk.send(self,"_parse_",[aString])]);
50
+ return smalltalk.withContext(function($ctx1) {
51
+ $1=_st(self)._compileNode_(_st(self)._parse_(aString));
51
52
  return $1;
52
- },
53
+ }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString}, smalltalk.Compiler)})},
53
54
  args: ["aString"],
54
55
  source: "compile: aString\x0a\x09^self compileNode: (self parse: aString)",
55
56
  messageSends: ["compileNode:", "parse:"],
@@ -64,12 +65,12 @@ selector: "compile:forClass:",
64
65
  category: 'compiling',
65
66
  fn: function (aString,aClass){
66
67
  var self=this;
67
- var $1;
68
- smalltalk.send(self,"_currentClass_",[aClass]);
69
- smalltalk.send(self,"_source_",[aString]);
70
- $1=smalltalk.send(self,"_compile_",[aString]);
68
+ return smalltalk.withContext(function($ctx1) {
69
+ _st(self)._currentClass_(aClass);
70
+ _st(self)._source_(aString);
71
+ $1=_st(self)._compile_(aString);
71
72
  return $1;
72
- },
73
+ }, function($ctx1) {$ctx1.fill(self,"compile:forClass:",{aString:aString,aClass:aClass}, smalltalk.Compiler)})},
73
74
  args: ["aString", "aClass"],
74
75
  source: "compile: aString forClass: aClass\x0a\x09self currentClass: aClass.\x0a\x09self source: aString.\x0a\x09^self compile: aString",
75
76
  messageSends: ["currentClass:", "source:", "compile:"],
@@ -84,12 +85,12 @@ selector: "compileExpression:",
84
85
  category: 'compiling',
85
86
  fn: function (aString){
86
87
  var self=this;
87
- var $1;
88
- smalltalk.send(self,"_currentClass_",[(smalltalk.DoIt || DoIt)]);
89
- smalltalk.send(self,"_source_",[smalltalk.send(smalltalk.send("doIt ^[","__comma",[aString]),"__comma",["] value"])]);
90
- $1=smalltalk.send(self,"_compileNode_",[smalltalk.send(self,"_parse_",[smalltalk.send(self,"_source",[])])]);
88
+ return smalltalk.withContext(function($ctx1) {
89
+ _st(self)._currentClass_((smalltalk.DoIt || DoIt));
90
+ _st(self)._source_(_st(_st("doIt ^[").__comma(aString)).__comma("] value"));
91
+ $1=_st(self)._compileNode_(_st(self)._parse_(_st(self)._source()));
91
92
  return $1;
92
- },
93
+ }, function($ctx1) {$ctx1.fill(self,"compileExpression:",{aString:aString}, smalltalk.Compiler)})},
93
94
  args: ["aString"],
94
95
  source: "compileExpression: aString\x0a\x09self currentClass: DoIt.\x0a\x09self source: 'doIt ^[', aString, '] value'.\x0a\x09^self compileNode: (self parse: self source)",
95
96
  messageSends: ["currentClass:", "source:", ",", "compileNode:", "parse:", "source"],
@@ -104,16 +105,17 @@ selector: "compileNode:",
104
105
  category: 'compiling',
105
106
  fn: function (aNode){
106
107
  var self=this;
107
- var $1;
108
- var generator;
109
- var result;
110
- generator=smalltalk.send(smalltalk.send(self,"_codeGeneratorClass",[]),"_new",[]);
111
- smalltalk.send(generator,"_source_",[smalltalk.send(self,"_source",[])]);
112
- $1=smalltalk.send(generator,"_currentClass_",[smalltalk.send(self,"_currentClass",[])]);
113
- result=smalltalk.send(generator,"_compileNode_",[aNode]);
114
- smalltalk.send(self,"_unknownVariables_",[[]]);
115
- return result;
116
- },
108
+ var generator,result;
109
+ return smalltalk.withContext(function($ctx1) {
110
+ generator=_st(_st(self)._codeGeneratorClass())._new();
111
+ $1=generator;
112
+ _st($1)._source_(_st(self)._source());
113
+ $2=_st($1)._currentClass_(_st(self)._currentClass());
114
+ result=_st(generator)._compileNode_(aNode);
115
+ _st(self)._unknownVariables_([]);
116
+ $3=result;
117
+ return $3;
118
+ }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,generator:generator,result:result}, smalltalk.Compiler)})},
117
119
  args: ["aNode"],
118
120
  source: "compileNode: aNode\x0a\x09| generator result |\x0a\x09generator := self codeGeneratorClass new.\x0a\x09generator\x0a\x09\x09source: self source;\x0a\x09\x09currentClass: self currentClass.\x0a\x09result := generator compileNode: aNode.\x0a\x09self unknownVariables: #().\x0a\x09^result",
119
121
  messageSends: ["new", "codeGeneratorClass", "source:", "source", "currentClass:", "currentClass", "compileNode:", "unknownVariables:"],
@@ -128,8 +130,10 @@ selector: "currentClass",
128
130
  category: 'accessing',
129
131
  fn: function (){
130
132
  var self=this;
131
- return self["@currentClass"];
132
- },
133
+ return smalltalk.withContext(function($ctx1) {
134
+ $1=self["@currentClass"];
135
+ return $1;
136
+ }, function($ctx1) {$ctx1.fill(self,"currentClass",{}, smalltalk.Compiler)})},
133
137
  args: [],
134
138
  source: "currentClass\x0a\x09^currentClass",
135
139
  messageSends: [],
@@ -144,8 +148,8 @@ selector: "currentClass:",
144
148
  category: 'accessing',
145
149
  fn: function (aClass){
146
150
  var self=this;
147
- self["@currentClass"]=aClass;
148
- return self},
151
+ return smalltalk.withContext(function($ctx1) {
152
+ return self}, function($ctx1) {$ctx1.fill(self,"currentClass:",{aClass:aClass}, smalltalk.Compiler)})},
149
153
  args: ["aClass"],
150
154
  source: "currentClass: aClass\x0a\x09currentClass := aClass",
151
155
  messageSends: [],
@@ -160,9 +164,8 @@ selector: "eval:",
160
164
  category: 'compiling',
161
165
  fn: function (aString){
162
166
  var self=this;
163
- return eval(aString);
164
- ;
165
- return self},
167
+ return smalltalk.withContext(function($ctx1) {
168
+ return self}, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString}, smalltalk.Compiler)})},
166
169
  args: ["aString"],
167
170
  source: "eval: aString\x0a\x09<return eval(aString)>",
168
171
  messageSends: [],
@@ -178,11 +181,13 @@ category: 'compiling',
178
181
  fn: function (aString){
179
182
  var self=this;
180
183
  var result;
181
- smalltalk.send((smalltalk.DoIt || DoIt),"_addCompiledMethod_",[smalltalk.send(self,"_eval_",[smalltalk.send(self,"_compileExpression_",[aString])])]);
182
- result=smalltalk.send(smalltalk.send((smalltalk.DoIt || DoIt),"_new",[]),"_doIt",[]);
183
- smalltalk.send((smalltalk.DoIt || DoIt),"_removeCompiledMethod_",[smalltalk.send(smalltalk.send((smalltalk.DoIt || DoIt),"_methodDictionary",[]),"_at_",["doIt"])]);
184
- return result;
185
- },
184
+ return smalltalk.withContext(function($ctx1) {
185
+ _st((smalltalk.DoIt || DoIt))._addCompiledMethod_(_st(self)._eval_(_st(self)._compileExpression_(aString)));
186
+ result=_st(_st((smalltalk.DoIt || DoIt))._new())._doIt();
187
+ _st((smalltalk.DoIt || DoIt))._removeCompiledMethod_(_st(_st((smalltalk.DoIt || DoIt))._methodDictionary())._at_("doIt"));
188
+ $1=result;
189
+ return $1;
190
+ }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:",{aString:aString,result:result}, smalltalk.Compiler)})},
186
191
  args: ["aString"],
187
192
  source: "evaluateExpression: aString\x0a\x09\x22Unlike #eval: evaluate a Smalltalk expression and answer the returned object\x22\x0a\x09| result |\x0a\x09DoIt addCompiledMethod: (self eval: (self compileExpression: aString)).\x0a\x09result := DoIt new doIt.\x0a\x09DoIt removeCompiledMethod: (DoIt methodDictionary at: 'doIt').\x0a\x09^result",
188
193
  messageSends: ["addCompiledMethod:", "eval:", "compileExpression:", "doIt", "new", "removeCompiledMethod:", "at:", "methodDictionary"],
@@ -197,17 +202,14 @@ selector: "install:forClass:category:",
197
202
  category: 'compiling',
198
203
  fn: function (aString,aBehavior,anotherString){
199
204
  var self=this;
200
- var compiled;
201
- compiled=smalltalk.send(self,"_eval_",[smalltalk.send(self,"_compile_forClass_",[aString,aBehavior])]);
202
- smalltalk.send(compiled,"_category_",[anotherString]);
203
- smalltalk.send(aBehavior,"_addCompiledMethod_",[compiled]);
204
- smalltalk.send(self,"_setupClass_",[aBehavior]);
205
- return compiled;
206
- },
205
+ return smalltalk.withContext(function($ctx1) {
206
+ $1=_st(_st((smalltalk.ClassBuilder || ClassBuilder))._new())._installMethod_forClass_category_(_st(self)._eval_(_st(self)._compile_forClass_(aString,aBehavior)),aBehavior,anotherString);
207
+ return $1;
208
+ }, function($ctx1) {$ctx1.fill(self,"install:forClass:category:",{aString:aString,aBehavior:aBehavior,anotherString:anotherString}, smalltalk.Compiler)})},
207
209
  args: ["aString", "aBehavior", "anotherString"],
208
- source: "install: aString forClass: aBehavior category: anotherString\x0a\x09| compiled |\x0a\x09compiled := self eval: (self compile: aString forClass: aBehavior).\x0a\x09compiled category: anotherString.\x0a\x09aBehavior addCompiledMethod: compiled.\x0a self setupClass: aBehavior.\x0a\x09^compiled",
209
- messageSends: ["eval:", "compile:forClass:", "category:", "addCompiledMethod:", "setupClass:"],
210
- referencedClasses: []
210
+ source: "install: aString forClass: aBehavior category: anotherString\x0a \x09^ ClassBuilder new\x0a \x09installMethod: (self eval: (self compile: aString forClass: aBehavior))\x0a forClass: aBehavior\x0a category: anotherString",
211
+ messageSends: ["installMethod:forClass:category:", "eval:", "compile:forClass:", "new"],
212
+ referencedClasses: ["ClassBuilder"]
211
213
  }),
212
214
  smalltalk.Compiler);
213
215
 
@@ -218,10 +220,10 @@ selector: "parse:",
218
220
  category: 'compiling',
219
221
  fn: function (aString){
220
222
  var self=this;
221
- var $1;
222
- $1=smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk),"_current",[]),"_parse_",[aString]);
223
+ return smalltalk.withContext(function($ctx1) {
224
+ $1=_st(_st((smalltalk.Smalltalk || Smalltalk))._current())._parse_(aString);
223
225
  return $1;
224
- },
226
+ }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString}, smalltalk.Compiler)})},
225
227
  args: ["aString"],
226
228
  source: "parse: aString\x0a ^Smalltalk current parse: aString",
227
229
  messageSends: ["parse:", "current"],
@@ -236,10 +238,10 @@ selector: "parseExpression:",
236
238
  category: 'compiling',
237
239
  fn: function (aString){
238
240
  var self=this;
239
- var $1;
240
- $1=smalltalk.send(self,"_parse_",[smalltalk.send(smalltalk.send("doIt ^[","__comma",[aString]),"__comma",["] value"])]);
241
+ return smalltalk.withContext(function($ctx1) {
242
+ $1=_st(self)._parse_(_st(_st("doIt ^[").__comma(aString)).__comma("] value"));
241
243
  return $1;
242
- },
244
+ }, function($ctx1) {$ctx1.fill(self,"parseExpression:",{aString:aString}, smalltalk.Compiler)})},
243
245
  args: ["aString"],
244
246
  source: "parseExpression: aString\x0a ^self parse: 'doIt ^[', aString, '] value'",
245
247
  messageSends: ["parse:", ","],
@@ -254,20 +256,19 @@ selector: "recompile:",
254
256
  category: 'compiling',
255
257
  fn: function (aClass){
256
258
  var self=this;
257
- var $1;
258
- smalltalk.send(smalltalk.send(aClass,"_methodDictionary",[]),"_do_",[(function(each){
259
- smalltalk.send(console,"_log_",[smalltalk.send(smalltalk.send(smalltalk.send(aClass,"_name",[]),"__comma",[" >> "]),"__comma",[smalltalk.send(each,"_selector",[])])]);
260
- return smalltalk.send(self,"_install_forClass_category_",[smalltalk.send(each,"_source",[]),aClass,smalltalk.send(each,"_category",[])]);
261
- })]);
262
- smalltalk.send(self,"_setupClass_",[aClass]);
263
- $1=smalltalk.send(aClass,"_isMetaclass",[]);
259
+ return smalltalk.withContext(function($ctx1) {
260
+ _st(_st(aClass)._methodDictionary())._do_((function(each){
261
+ return smalltalk.withContext(function($ctx2) {
262
+ return _st(self)._install_forClass_category_(_st(each)._source(),aClass,_st(each)._category());
263
+ }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
264
+ $1=_st(aClass)._isMetaclass();
264
265
  if(! smalltalk.assert($1)){
265
- smalltalk.send(self,"_recompile_",[smalltalk.send(aClass,"_class",[])]);
266
+ _st(self)._recompile_(_st(aClass)._class());
266
267
  };
267
- return self},
268
+ return self}, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass}, smalltalk.Compiler)})},
268
269
  args: ["aClass"],
269
- source: "recompile: aClass\x0a\x09aClass methodDictionary do: [:each |\x0a\x09\x09console log: aClass name, ' >> ', each selector.\x0a\x09\x09self install: each source forClass: aClass category: each category].\x0a\x09self setupClass: aClass.\x0a\x09aClass isMetaclass ifFalse: [self recompile: aClass class]",
270
- messageSends: ["do:", "log:", ",", "selector", "name", "install:forClass:category:", "source", "category", "methodDictionary", "setupClass:", "ifFalse:", "recompile:", "class", "isMetaclass"],
270
+ source: "recompile: aClass\x0a\x09aClass methodDictionary do: [:each |\x0a\x09\x09console log: aClass name, ' >> ', each selector.\x0a\x09\x09self install: each source forClass: aClass category: each category].\x0a\x09\x22self setupClass: aClass.\x22\x0a\x09aClass isMetaclass ifFalse: [self recompile: aClass class]",
271
+ messageSends: ["do:", "log:", ",", "selector", "name", "install:forClass:category:", "source", "category", "methodDictionary", "ifFalse:", "recompile:", "class", "isMetaclass"],
271
272
  referencedClasses: []
272
273
  }),
273
274
  smalltalk.Compiler);
@@ -279,16 +280,17 @@ selector: "recompileAll",
279
280
  category: 'compiling',
280
281
  fn: function (){
281
282
  var self=this;
282
- var $1;
283
- smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk),"_current",[]),"_classes",[]),"_do_",[(function(each){
284
- smalltalk.send((smalltalk.Transcript || Transcript),"_show_",[each]);
285
- $1=smalltalk.send((smalltalk.Transcript || Transcript),"_cr",[]);
286
- $1;
287
- return smalltalk.send((function(){
288
- return smalltalk.send(self,"_recompile_",[each]);
289
- }),"_valueWithTimeout_",[(100)]);
290
- })]);
291
- return self},
283
+ return smalltalk.withContext(function($ctx1) {
284
+ _st(_st(_st((smalltalk.Smalltalk || Smalltalk))._current())._classes())._do_((function(each){
285
+ return smalltalk.withContext(function($ctx2) {
286
+ _st($1)._show_(each);
287
+ $2=_st($1)._cr();
288
+ $2;
289
+ return _st((function(){
290
+ return smalltalk.withContext(function($ctx3) {
291
+ }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}))._valueWithTimeout_((100));
292
+ }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
293
+ return self}, function($ctx1) {$ctx1.fill(self,"recompileAll",{}, smalltalk.Compiler)})},
292
294
  args: [],
293
295
  source: "recompileAll\x0a\x09Smalltalk current classes do: [:each |\x0a\x09\x09Transcript show: each; cr.\x0a\x09\x09[self recompile: each] valueWithTimeout: 100]",
294
296
  messageSends: ["do:", "show:", "cr", "valueWithTimeout:", "recompile:", "classes", "current"],
@@ -296,23 +298,6 @@ referencedClasses: ["Transcript", "Smalltalk"]
296
298
  }),
297
299
  smalltalk.Compiler);
298
300
 
299
- smalltalk.addMethod(
300
- "_setupClass_",
301
- smalltalk.method({
302
- selector: "setupClass:",
303
- category: 'compiling',
304
- fn: function (aClass){
305
- var self=this;
306
- smalltalk.init(aClass);
307
- ;
308
- return self},
309
- args: ["aClass"],
310
- source: "setupClass: aClass\x0a\x09<smalltalk.init(aClass)>",
311
- messageSends: [],
312
- referencedClasses: []
313
- }),
314
- smalltalk.Compiler);
315
-
316
301
  smalltalk.addMethod(
317
302
  "_source",
318
303
  smalltalk.method({
@@ -320,14 +305,15 @@ selector: "source",
320
305
  category: 'accessing',
321
306
  fn: function (){
322
307
  var self=this;
323
- var $1;
324
- if(($receiver = self["@source"]) == nil || $receiver == undefined){
308
+ return smalltalk.withContext(function($ctx1) {
309
+ $2=self["@source"];
310
+ if(($receiver = $2) == nil || $receiver == undefined){
325
311
  $1="";
326
312
  } else {
327
- $1=self["@source"];
313
+ $1=$2;
328
314
  };
329
315
  return $1;
330
- },
316
+ }, function($ctx1) {$ctx1.fill(self,"source",{}, smalltalk.Compiler)})},
331
317
  args: [],
332
318
  source: "source\x0a\x09^source ifNil: ['']",
333
319
  messageSends: ["ifNil:"],
@@ -342,8 +328,8 @@ selector: "source:",
342
328
  category: 'accessing',
343
329
  fn: function (aString){
344
330
  var self=this;
345
- self["@source"]=aString;
346
- return self},
331
+ return smalltalk.withContext(function($ctx1) {
332
+ return self}, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString}, smalltalk.Compiler)})},
347
333
  args: ["aString"],
348
334
  source: "source: aString\x0a\x09source := aString",
349
335
  messageSends: [],
@@ -358,8 +344,10 @@ selector: "unknownVariables",
358
344
  category: 'accessing',
359
345
  fn: function (){
360
346
  var self=this;
361
- return self["@unknownVariables"];
362
- },
347
+ return smalltalk.withContext(function($ctx1) {
348
+ $1=self["@unknownVariables"];
349
+ return $1;
350
+ }, function($ctx1) {$ctx1.fill(self,"unknownVariables",{}, smalltalk.Compiler)})},
363
351
  args: [],
364
352
  source: "unknownVariables\x0a\x09^unknownVariables",
365
353
  messageSends: [],
@@ -374,8 +362,8 @@ selector: "unknownVariables:",
374
362
  category: 'accessing',
375
363
  fn: function (aCollection){
376
364
  var self=this;
377
- self["@unknownVariables"]=aCollection;
378
- return self},
365
+ return smalltalk.withContext(function($ctx1) {
366
+ return self}, function($ctx1) {$ctx1.fill(self,"unknownVariables:",{aCollection:aCollection}, smalltalk.Compiler)})},
379
367
  args: ["aCollection"],
380
368
  source: "unknownVariables: aCollection\x0a\x09unknownVariables := aCollection",
381
369
  messageSends: [],
@@ -391,8 +379,8 @@ selector: "recompile:",
391
379
  category: 'compiling',
392
380
  fn: function (aClass){
393
381
  var self=this;
394
- smalltalk.send(smalltalk.send(self,"_new",[]),"_recompile_",[aClass]);
395
- return self},
382
+ return smalltalk.withContext(function($ctx1) {
383
+ return self}, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass}, smalltalk.Compiler.klass)})},
396
384
  args: ["aClass"],
397
385
  source: "recompile: aClass\x0a\x09self new recompile: aClass",
398
386
  messageSends: ["recompile:", "new"],
@@ -407,10 +395,10 @@ selector: "recompileAll",
407
395
  category: 'compiling',
408
396
  fn: function (){
409
397
  var self=this;
410
- smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk),"_current",[]),"_classes",[]),"_do_",[(function(each){
411
- return smalltalk.send(self,"_recompile_",[each]);
412
- })]);
413
- return self},
398
+ return smalltalk.withContext(function($ctx1) {
399
+ return smalltalk.withContext(function($ctx2) {
400
+ }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
401
+ return self}, function($ctx1) {$ctx1.fill(self,"recompileAll",{}, smalltalk.Compiler.klass)})},
414
402
  args: [],
415
403
  source: "recompileAll\x0a\x09Smalltalk current classes do: [:each |\x0a\x09\x09self recompile: each]",
416
404
  messageSends: ["do:", "recompile:", "classes", "current"],
@@ -432,10 +420,10 @@ selector: "visit:",
432
420
  category: 'visiting',
433
421
  fn: function (aNode){
434
422
  var self=this;
435
- var $1;
436
- $1=smalltalk.send(aNode,"_accept_",[self]);
423
+ return smalltalk.withContext(function($ctx1) {
424
+ $1=_st(aNode)._accept_(self);
437
425
  return $1;
438
- },
426
+ }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode}, smalltalk.NodeVisitor)})},
439
427
  args: ["aNode"],
440
428
  source: "visit: aNode\x0a\x09^ aNode accept: self",
441
429
  messageSends: ["accept:"],
@@ -450,15 +438,15 @@ selector: "visitAll:",
450
438
  category: 'visiting',
451
439
  fn: function (aCollection){
452
440
  var self=this;
453
- var $1;
454
- $1=smalltalk.send(aCollection,"_do_",[(function(each){
455
- return smalltalk.send(self,"_visit_",[each]);
456
- })]);
441
+ return smalltalk.withContext(function($ctx1) {
442
+ $1=_st(aCollection)._collect_((function(each){
443
+ return smalltalk.withContext(function($ctx2) {
444
+ }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
457
445
  return $1;
458
- },
446
+ }, function($ctx1) {$ctx1.fill(self,"visitAll:",{aCollection:aCollection}, smalltalk.NodeVisitor)})},
459
447
  args: ["aCollection"],
460
- source: "visitAll: aCollection\x0a\x09^ aCollection do: [ :each | self visit: each ]",
461
- messageSends: ["do:", "visit:"],
448
+ source: "visitAll: aCollection\x0a\x09^ aCollection collect: [ :each | self visit: each ]",
449
+ messageSends: ["collect:", "visit:"],
462
450
  referencedClasses: []
463
451
  }),
464
452
  smalltalk.NodeVisitor);
@@ -470,10 +458,10 @@ selector: "visitAssignmentNode:",
470
458
  category: 'visiting',
471
459
  fn: function (aNode){
472
460
  var self=this;
473
- var $1;
474
- $1=smalltalk.send(self,"_visitNode_",[aNode]);
461
+ return smalltalk.withContext(function($ctx1) {
462
+ $1=_st(self)._visitNode_(aNode);
475
463
  return $1;
476
- },
464
+ }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode}, smalltalk.NodeVisitor)})},
477
465
  args: ["aNode"],
478
466
  source: "visitAssignmentNode: aNode\x0a\x09^ self visitNode: aNode",
479
467
  messageSends: ["visitNode:"],
@@ -488,10 +476,10 @@ selector: "visitBlockNode:",
488
476
  category: 'visiting',
489
477
  fn: function (aNode){
490
478
  var self=this;
491
- var $1;
492
- $1=smalltalk.send(self,"_visitNode_",[aNode]);
479
+ return smalltalk.withContext(function($ctx1) {
480
+ $1=_st(self)._visitNode_(aNode);
493
481
  return $1;
494
- },
482
+ }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode}, smalltalk.NodeVisitor)})},
495
483
  args: ["aNode"],
496
484
  source: "visitBlockNode: aNode\x0a\x09^ self visitNode: aNode",
497
485
  messageSends: ["visitNode:"],
@@ -506,10 +494,10 @@ selector: "visitBlockSequenceNode:",
506
494
  category: 'visiting',
507
495
  fn: function (aNode){
508
496
  var self=this;
509
- var $1;
510
- $1=smalltalk.send(self,"_visitSequenceNode_",[aNode]);
497
+ return smalltalk.withContext(function($ctx1) {
498
+ $1=_st(self)._visitSequenceNode_(aNode);
511
499
  return $1;
512
- },
500
+ }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode}, smalltalk.NodeVisitor)})},
513
501
  args: ["aNode"],
514
502
  source: "visitBlockSequenceNode: aNode\x0a\x09^ self visitSequenceNode: aNode",
515
503
  messageSends: ["visitSequenceNode:"],
@@ -524,10 +512,10 @@ selector: "visitCascadeNode:",
524
512
  category: 'visiting',
525
513
  fn: function (aNode){
526
514
  var self=this;
527
- var $1;
528
- $1=smalltalk.send(self,"_visitNode_",[aNode]);
515
+ return smalltalk.withContext(function($ctx1) {
516
+ $1=_st(self)._visitNode_(aNode);
529
517
  return $1;
530
- },
518
+ }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode}, smalltalk.NodeVisitor)})},
531
519
  args: ["aNode"],
532
520
  source: "visitCascadeNode: aNode\x0a\x09^ self visitNode: aNode",
533
521
  messageSends: ["visitNode:"],
@@ -542,10 +530,10 @@ selector: "visitClassReferenceNode:",
542
530
  category: 'visiting',
543
531
  fn: function (aNode){
544
532
  var self=this;
545
- var $1;
546
- $1=smalltalk.send(self,"_visitVariableNode_",[aNode]);
533
+ return smalltalk.withContext(function($ctx1) {
534
+ $1=_st(self)._visitVariableNode_(aNode);
547
535
  return $1;
548
- },
536
+ }, function($ctx1) {$ctx1.fill(self,"visitClassReferenceNode:",{aNode:aNode}, smalltalk.NodeVisitor)})},
549
537
  args: ["aNode"],
550
538
  source: "visitClassReferenceNode: aNode\x0a\x09^ self visitVariableNode: aNode",
551
539
  messageSends: ["visitVariableNode:"],
@@ -560,10 +548,10 @@ selector: "visitDynamicArrayNode:",
560
548
  category: 'visiting',
561
549
  fn: function (aNode){
562
550
  var self=this;
563
- var $1;
564
- $1=smalltalk.send(self,"_visitNode_",[aNode]);
551
+ return smalltalk.withContext(function($ctx1) {
552
+ $1=_st(self)._visitNode_(aNode);
565
553
  return $1;
566
- },
554
+ }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode}, smalltalk.NodeVisitor)})},
567
555
  args: ["aNode"],
568
556
  source: "visitDynamicArrayNode: aNode\x0a\x09^ self visitNode: aNode",
569
557
  messageSends: ["visitNode:"],
@@ -578,10 +566,10 @@ selector: "visitDynamicDictionaryNode:",
578
566
  category: 'visiting',
579
567
  fn: function (aNode){
580
568
  var self=this;
581
- var $1;
582
- $1=smalltalk.send(self,"_visitNode_",[aNode]);
569
+ return smalltalk.withContext(function($ctx1) {
570
+ $1=_st(self)._visitNode_(aNode);
583
571
  return $1;
584
- },
572
+ }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode}, smalltalk.NodeVisitor)})},
585
573
  args: ["aNode"],
586
574
  source: "visitDynamicDictionaryNode: aNode\x0a\x09^ self visitNode: aNode",
587
575
  messageSends: ["visitNode:"],
@@ -596,10 +584,10 @@ selector: "visitJSStatementNode:",
596
584
  category: 'visiting',
597
585
  fn: function (aNode){
598
586
  var self=this;
599
- var $1;
600
- $1=smalltalk.send(self,"_visitNode_",[aNode]);
587
+ return smalltalk.withContext(function($ctx1) {
588
+ $1=_st(self)._visitNode_(aNode);
601
589
  return $1;
602
- },
590
+ }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode}, smalltalk.NodeVisitor)})},
603
591
  args: ["aNode"],
604
592
  source: "visitJSStatementNode: aNode\x0a\x09^ self visitNode: aNode",
605
593
  messageSends: ["visitNode:"],
@@ -614,10 +602,10 @@ selector: "visitMethodNode:",
614
602
  category: 'visiting',
615
603
  fn: function (aNode){
616
604
  var self=this;
617
- var $1;
618
- $1=smalltalk.send(self,"_visitNode_",[aNode]);
605
+ return smalltalk.withContext(function($ctx1) {
606
+ $1=_st(self)._visitNode_(aNode);
619
607
  return $1;
620
- },
608
+ }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode}, smalltalk.NodeVisitor)})},
621
609
  args: ["aNode"],
622
610
  source: "visitMethodNode: aNode\x0a\x09^ self visitNode: aNode",
623
611
  messageSends: ["visitNode:"],
@@ -632,10 +620,10 @@ selector: "visitNode:",
632
620
  category: 'visiting',
633
621
  fn: function (aNode){
634
622
  var self=this;
635
- var $1;
636
- $1=smalltalk.send(self,"_visitAll_",[smalltalk.send(aNode,"_nodes",[])]);
623
+ return smalltalk.withContext(function($ctx1) {
624
+ $1=_st(self)._visitAll_(_st(aNode)._nodes());
637
625
  return $1;
638
- },
626
+ }, function($ctx1) {$ctx1.fill(self,"visitNode:",{aNode:aNode}, smalltalk.NodeVisitor)})},
639
627
  args: ["aNode"],
640
628
  source: "visitNode: aNode\x0a\x09^ self visitAll: aNode nodes",
641
629
  messageSends: ["visitAll:", "nodes"],
@@ -650,10 +638,10 @@ selector: "visitReturnNode:",
650
638
  category: 'visiting',
651
639
  fn: function (aNode){
652
640
  var self=this;
653
- var $1;
654
- $1=smalltalk.send(self,"_visitNode_",[aNode]);
641
+ return smalltalk.withContext(function($ctx1) {
642
+ $1=_st(self)._visitNode_(aNode);
655
643
  return $1;
656
- },
644
+ }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode}, smalltalk.NodeVisitor)})},
657
645
  args: ["aNode"],
658
646
  source: "visitReturnNode: aNode\x0a\x09^ self visitNode: aNode",
659
647
  messageSends: ["visitNode:"],
@@ -668,10 +656,10 @@ selector: "visitSendNode:",
668
656
  category: 'visiting',
669
657
  fn: function (aNode){
670
658
  var self=this;
671
- var $1;
672
- $1=smalltalk.send(self,"_visitNode_",[aNode]);
659
+ return smalltalk.withContext(function($ctx1) {
660
+ $1=_st(self)._visitNode_(aNode);
673
661
  return $1;
674
- },
662
+ }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode}, smalltalk.NodeVisitor)})},
675
663
  args: ["aNode"],
676
664
  source: "visitSendNode: aNode\x0a\x09^ self visitNode: aNode",
677
665
  messageSends: ["visitNode:"],
@@ -686,10 +674,10 @@ selector: "visitSequenceNode:",
686
674
  category: 'visiting',
687
675
  fn: function (aNode){
688
676
  var self=this;
689
- var $1;
690
- $1=smalltalk.send(self,"_visitNode_",[aNode]);
677
+ return smalltalk.withContext(function($ctx1) {
678
+ $1=_st(self)._visitNode_(aNode);
691
679
  return $1;
692
- },
680
+ }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode}, smalltalk.NodeVisitor)})},
693
681
  args: ["aNode"],
694
682
  source: "visitSequenceNode: aNode\x0a\x09^ self visitNode: aNode",
695
683
  messageSends: ["visitNode:"],
@@ -704,10 +692,10 @@ selector: "visitValueNode:",
704
692
  category: 'visiting',
705
693
  fn: function (aNode){
706
694
  var self=this;
707
- var $1;
708
- $1=smalltalk.send(self,"_visitNode_",[aNode]);
695
+ return smalltalk.withContext(function($ctx1) {
696
+ $1=_st(self)._visitNode_(aNode);
709
697
  return $1;
710
- },
698
+ }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode}, smalltalk.NodeVisitor)})},
711
699
  args: ["aNode"],
712
700
  source: "visitValueNode: aNode\x0a\x09^ self visitNode: aNode",
713
701
  messageSends: ["visitNode:"],
@@ -722,10 +710,10 @@ selector: "visitVariableNode:",
722
710
  category: 'visiting',
723
711
  fn: function (aNode){
724
712
  var self=this;
725
- var $1;
726
- $1=smalltalk.send(self,"_visitNode_",[aNode]);
713
+ return smalltalk.withContext(function($ctx1) {
714
+ $1=_st(self)._visitNode_(aNode);
727
715
  return $1;
728
- },
716
+ }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode}, smalltalk.NodeVisitor)})},
729
717
  args: ["aNode"],
730
718
  source: "visitVariableNode: aNode\x0a\x09^ self visitNode: aNode",
731
719
  messageSends: ["visitNode:"],
@@ -744,20 +732,22 @@ selector: "classNameFor:",
744
732
  category: 'accessing',
745
733
  fn: function (aClass){
746
734
  var self=this;
747
- var $2,$3,$1;
748
- $2=smalltalk.send(aClass,"_isMetaclass",[]);
749
- if(smalltalk.assert($2)){
750
- $1=smalltalk.send(smalltalk.send(smalltalk.send(aClass,"_instanceClass",[]),"_name",[]),"__comma",[".klass"]);
751
- } else {
752
- $3=smalltalk.send(aClass,"_isNil",[]);
753
- if(smalltalk.assert($3)){
754
- $1="nil";
735
+ return smalltalk.withContext(function($ctx1) {
736
+ $2=_st(aClass)._isMetaclass();
737
+ $3=(function(){
738
+ return smalltalk.withContext(function($ctx2) {
739
+ }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})});
740
+ $4=(function(){
741
+ return smalltalk.withContext(function($ctx2) {
742
+ if(smalltalk.assert($5)){
743
+ return "nil";
755
744
  } else {
756
- $1=smalltalk.send(aClass,"_name",[]);
757
- };
745
+ return _st(aClass)._name();
758
746
  };
747
+ }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})});
748
+ $1=_st($2)._ifTrue_ifFalse_($3,$4);
759
749
  return $1;
760
- },
750
+ }, function($ctx1) {$ctx1.fill(self,"classNameFor:",{aClass:aClass}, smalltalk.AbstractCodeGenerator)})},
761
751
  args: ["aClass"],
762
752
  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]]",
763
753
  messageSends: ["ifTrue:ifFalse:", ",", "name", "instanceClass", "isNil", "isMetaclass"],
@@ -772,8 +762,8 @@ selector: "compileNode:",
772
762
  category: 'compiling',
773
763
  fn: function (aNode){
774
764
  var self=this;
775
- smalltalk.send(self,"_subclassResponsibility",[]);
776
- return self},
765
+ return smalltalk.withContext(function($ctx1) {
766
+ return self}, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode}, smalltalk.AbstractCodeGenerator)})},
777
767
  args: ["aNode"],
778
768
  source: "compileNode: aNode\x0a\x09self subclassResponsibility",
779
769
  messageSends: ["subclassResponsibility"],
@@ -788,8 +778,10 @@ selector: "currentClass",
788
778
  category: 'accessing',
789
779
  fn: function (){
790
780
  var self=this;
791
- return self["@currentClass"];
792
- },
781
+ return smalltalk.withContext(function($ctx1) {
782
+ $1=self["@currentClass"];
783
+ return $1;
784
+ }, function($ctx1) {$ctx1.fill(self,"currentClass",{}, smalltalk.AbstractCodeGenerator)})},
793
785
  args: [],
794
786
  source: "currentClass\x0a\x09^currentClass",
795
787
  messageSends: [],
@@ -804,8 +796,8 @@ selector: "currentClass:",
804
796
  category: 'accessing',
805
797
  fn: function (aClass){
806
798
  var self=this;
807
- self["@currentClass"]=aClass;
808
- return self},
799
+ return smalltalk.withContext(function($ctx1) {
800
+ return self}, function($ctx1) {$ctx1.fill(self,"currentClass:",{aClass:aClass}, smalltalk.AbstractCodeGenerator)})},
809
801
  args: ["aClass"],
810
802
  source: "currentClass: aClass\x0a\x09currentClass := aClass",
811
803
  messageSends: [],
@@ -820,8 +812,8 @@ selector: "pseudoVariables",
820
812
  category: 'accessing',
821
813
  fn: function (){
822
814
  var self=this;
823
- return ["self", "super", "true", "false", "nil", "thisContext"];
824
- },
815
+ return smalltalk.withContext(function($ctx1) {
816
+ }, function($ctx1) {$ctx1.fill(self,"pseudoVariables",{}, smalltalk.AbstractCodeGenerator)})},
825
817
  args: [],
826
818
  source: "pseudoVariables\x0a\x09^#('self' 'super' 'true' 'false' 'nil' 'thisContext')",
827
819
  messageSends: [],
@@ -836,15 +828,15 @@ selector: "safeVariableNameFor:",
836
828
  category: 'accessing',
837
829
  fn: function (aString){
838
830
  var self=this;
839
- var $2,$1;
840
- $2=smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk),"_current",[]),"_reservedWords",[]),"_includes_",[aString]);
831
+ return smalltalk.withContext(function($ctx1) {
832
+ $2=_st(_st(_st((smalltalk.Smalltalk || Smalltalk))._current())._reservedWords())._includes_(aString);
841
833
  if(smalltalk.assert($2)){
842
- $1=smalltalk.send(aString,"__comma",["_"]);
834
+ $1=_st(aString).__comma("_");
843
835
  } else {
844
836
  $1=aString;
845
837
  };
846
838
  return $1;
847
- },
839
+ }, function($ctx1) {$ctx1.fill(self,"safeVariableNameFor:",{aString:aString}, smalltalk.AbstractCodeGenerator)})},
848
840
  args: ["aString"],
849
841
  source: "safeVariableNameFor: aString\x0a\x09^(Smalltalk current reservedWords includes: aString)\x0a\x09\x09ifTrue: [aString, '_']\x0a\x09\x09ifFalse: [aString]",
850
842
  messageSends: ["ifTrue:ifFalse:", ",", "includes:", "reservedWords", "current"],
@@ -859,14 +851,15 @@ selector: "source",
859
851
  category: 'accessing',
860
852
  fn: function (){
861
853
  var self=this;
862
- var $1;
863
- if(($receiver = self["@source"]) == nil || $receiver == undefined){
854
+ return smalltalk.withContext(function($ctx1) {
855
+ $2=self["@source"];
856
+ if(($receiver = $2) == nil || $receiver == undefined){
864
857
  $1="";
865
858
  } else {
866
- $1=self["@source"];
859
+ $1=$2;
867
860
  };
868
861
  return $1;
869
- },
862
+ }, function($ctx1) {$ctx1.fill(self,"source",{}, smalltalk.AbstractCodeGenerator)})},
870
863
  args: [],
871
864
  source: "source\x0a\x09^source ifNil: ['']",
872
865
  messageSends: ["ifNil:"],
@@ -881,8 +874,8 @@ selector: "source:",
881
874
  category: 'accessing',
882
875
  fn: function (aString){
883
876
  var self=this;
884
- self["@source"]=aString;
885
- return self},
877
+ return smalltalk.withContext(function($ctx1) {
878
+ return self}, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString}, smalltalk.AbstractCodeGenerator)})},
886
879
  args: ["aString"],
887
880
  source: "source: aString\x0a\x09source := aString",
888
881
  messageSends: [],
@@ -901,17 +894,16 @@ selector: "compileNode:",
901
894
  category: 'compiling',
902
895
  fn: function (aNode){
903
896
  var self=this;
904
- var $2,$3,$1;
905
- var ir;
906
- var stream;
907
- smalltalk.send(smalltalk.send(self,"_semanticAnalyzer",[]),"_visit_",[aNode]);
908
- ir=smalltalk.send(smalltalk.send(self,"_translator",[]),"_visit_",[aNode]);
909
- $2=smalltalk.send(self,"_irTranslator",[]);
910
- smalltalk.send($2,"_visit_",[ir]);
911
- $3=smalltalk.send($2,"_contents",[]);
897
+ var ir,stream;
898
+ return smalltalk.withContext(function($ctx1) {
899
+ _st(_st(self)._semanticAnalyzer())._visit_(aNode);
900
+ ir=_st(_st(self)._translator())._visit_(aNode);
901
+ $2=_st(self)._irTranslator();
902
+ _st($2)._visit_(ir);
903
+ $3=_st($2)._contents();
912
904
  $1=$3;
913
905
  return $1;
914
- },
906
+ }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,ir:ir,stream:stream}, smalltalk.CodeGenerator)})},
915
907
  args: ["aNode"],
916
908
  source: "compileNode: aNode\x0a\x09| ir stream |\x0a\x09self semanticAnalyzer visit: aNode.\x0a\x09ir := self translator visit: aNode.\x0a\x09^ self irTranslator\x0a\x09\x09visit: ir;\x0a\x09\x09contents",
917
909
  messageSends: ["visit:", "semanticAnalyzer", "translator", "irTranslator", "contents"],
@@ -926,10 +918,10 @@ selector: "irTranslator",
926
918
  category: 'compiling',
927
919
  fn: function (){
928
920
  var self=this;
929
- var $1;
930
- $1=smalltalk.send((smalltalk.IRJSTranslator || IRJSTranslator),"_new",[]);
921
+ return smalltalk.withContext(function($ctx1) {
922
+ $1=_st((smalltalk.IRJSTranslator || IRJSTranslator))._new();
931
923
  return $1;
932
- },
924
+ }, function($ctx1) {$ctx1.fill(self,"irTranslator",{}, smalltalk.CodeGenerator)})},
933
925
  args: [],
934
926
  source: "irTranslator\x0a\x09^ IRJSTranslator new",
935
927
  messageSends: ["new"],
@@ -944,10 +936,10 @@ selector: "semanticAnalyzer",
944
936
  category: 'compiling',
945
937
  fn: function (){
946
938
  var self=this;
947
- var $1;
948
- $1=smalltalk.send((smalltalk.SemanticAnalyzer || SemanticAnalyzer),"_on_",[smalltalk.send(self,"_currentClass",[])]);
939
+ return smalltalk.withContext(function($ctx1) {
940
+ $1=_st((smalltalk.SemanticAnalyzer || SemanticAnalyzer))._on_(_st(self)._currentClass());
949
941
  return $1;
950
- },
942
+ }, function($ctx1) {$ctx1.fill(self,"semanticAnalyzer",{}, smalltalk.CodeGenerator)})},
951
943
  args: [],
952
944
  source: "semanticAnalyzer\x0a\x09^ SemanticAnalyzer on: self currentClass",
953
945
  messageSends: ["on:", "currentClass"],
@@ -962,14 +954,14 @@ selector: "translator",
962
954
  category: 'compiling',
963
955
  fn: function (){
964
956
  var self=this;
965
- var $2,$3,$1;
966
- $2=smalltalk.send((smalltalk.IRASTTranslator || IRASTTranslator),"_new",[]);
967
- smalltalk.send($2,"_source_",[smalltalk.send(self,"_source",[])]);
968
- smalltalk.send($2,"_theClass_",[smalltalk.send(self,"_currentClass",[])]);
969
- $3=smalltalk.send($2,"_yourself",[]);
957
+ return smalltalk.withContext(function($ctx1) {
958
+ $2=_st((smalltalk.IRASTTranslator || IRASTTranslator))._new();
959
+ _st($2)._source_(_st(self)._source());
960
+ _st($2)._theClass_(_st(self)._currentClass());
961
+ $3=_st($2)._yourself();
970
962
  $1=$3;
971
963
  return $1;
972
- },
964
+ }, function($ctx1) {$ctx1.fill(self,"translator",{}, smalltalk.CodeGenerator)})},
973
965
  args: [],
974
966
  source: "translator\x0a\x09^ IRASTTranslator new\x0a\x09\x09source: self source;\x0a\x09\x09theClass: self currentClass;\x0a\x09\x09yourself",
975
967
  messageSends: ["source:", "source", "new", "theClass:", "currentClass", "yourself"],
@@ -979,994 +971,3 @@ smalltalk.CodeGenerator);
979
971
 
980
972
 
981
973
 
982
- smalltalk.addClass('FunCodeGenerator', smalltalk.AbstractCodeGenerator, ['stream', 'nestedBlocks', 'earlyReturn', 'currentSelector', 'unknownVariables', 'tempVariables', 'messageSends', 'referencedClasses', 'classReferenced', 'argVariables'], 'Compiler-Core');
983
- smalltalk.addMethod(
984
- "_argVariables",
985
- smalltalk.method({
986
- selector: "argVariables",
987
- category: 'accessing',
988
- fn: function (){
989
- var self=this;
990
- var $1;
991
- $1=smalltalk.send(self["@argVariables"],"_copy",[]);
992
- return $1;
993
- },
994
- args: [],
995
- source: "argVariables\x0a\x09^argVariables copy",
996
- messageSends: ["copy"],
997
- referencedClasses: []
998
- }),
999
- smalltalk.FunCodeGenerator);
1000
-
1001
- smalltalk.addMethod(
1002
- "_checkClass_for_",
1003
- smalltalk.method({
1004
- selector: "checkClass:for:",
1005
- category: 'optimizations',
1006
- fn: function (aClassName,receiver){
1007
- var self=this;
1008
- smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send("((($receiver = ","__comma",[receiver]),"__comma",[").klass === smalltalk."]),"__comma",[aClassName]),"__comma",[") ? "])]);
1009
- return self},
1010
- args: ["aClassName", "receiver"],
1011
- source: "checkClass: aClassName for: receiver\x0a stream nextPutAll: '((($receiver = ', receiver, ').klass === smalltalk.', aClassName, ') ? '",
1012
- messageSends: ["nextPutAll:", ","],
1013
- referencedClasses: []
1014
- }),
1015
- smalltalk.FunCodeGenerator);
1016
-
1017
- smalltalk.addMethod(
1018
- "_compileNode_",
1019
- smalltalk.method({
1020
- selector: "compileNode:",
1021
- category: 'compiling',
1022
- fn: function (aNode){
1023
- var self=this;
1024
- var $1;
1025
- self["@stream"]=smalltalk.send("","_writeStream",[]);
1026
- smalltalk.send(self,"_visit_",[aNode]);
1027
- $1=smalltalk.send(self["@stream"],"_contents",[]);
1028
- return $1;
1029
- },
1030
- args: ["aNode"],
1031
- source: "compileNode: aNode\x0a\x09stream := '' writeStream.\x0a\x09self visit: aNode.\x0a\x09^stream contents",
1032
- messageSends: ["writeStream", "visit:", "contents"],
1033
- referencedClasses: []
1034
- }),
1035
- smalltalk.FunCodeGenerator);
1036
-
1037
- smalltalk.addMethod(
1038
- "_initialize",
1039
- smalltalk.method({
1040
- selector: "initialize",
1041
- category: 'initialization',
1042
- fn: function (){
1043
- var self=this;
1044
- smalltalk.send(self,"_initialize",[],smalltalk.AbstractCodeGenerator);
1045
- self["@stream"]=smalltalk.send("","_writeStream",[]);
1046
- self["@unknownVariables"]=[];
1047
- self["@tempVariables"]=[];
1048
- self["@argVariables"]=[];
1049
- self["@messageSends"]=[];
1050
- self["@classReferenced"]=[];
1051
- return self},
1052
- args: [],
1053
- source: "initialize\x0a\x09super initialize.\x0a\x09stream := '' writeStream. \x0a\x09unknownVariables := #().\x0a\x09tempVariables := #().\x0a\x09argVariables := #().\x0a\x09messageSends := #().\x0a\x09classReferenced := #()",
1054
- messageSends: ["initialize", "writeStream"],
1055
- referencedClasses: []
1056
- }),
1057
- smalltalk.FunCodeGenerator);
1058
-
1059
- smalltalk.addMethod(
1060
- "_inline_receiver_argumentNodes_",
1061
- smalltalk.method({
1062
- selector: "inline:receiver:argumentNodes:",
1063
- category: 'optimizations',
1064
- fn: function (aSelector,receiver,aCollection){
1065
- var self=this;
1066
- var $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16;
1067
- var inlined;
1068
- inlined=false;
1069
- $1=smalltalk.send(aSelector,"__eq",["ifFalse:"]);
1070
- if(smalltalk.assert($1)){
1071
- $2=smalltalk.send(smalltalk.send(aCollection,"_first",[]),"_isBlockNode",[]);
1072
- if(smalltalk.assert($2)){
1073
- smalltalk.send(self,"_checkClass_for_",["Boolean",receiver]);
1074
- smalltalk.send(self["@stream"],"_nextPutAll_",["(! $receiver ? "]);
1075
- smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
1076
- smalltalk.send(self["@stream"],"_nextPutAll_",["() : nil)"]);
1077
- inlined=true;
1078
- inlined;
1079
- };
1080
- };
1081
- $3=smalltalk.send(aSelector,"__eq",["ifTrue:"]);
1082
- if(smalltalk.assert($3)){
1083
- $4=smalltalk.send(smalltalk.send(aCollection,"_first",[]),"_isBlockNode",[]);
1084
- if(smalltalk.assert($4)){
1085
- smalltalk.send(self,"_checkClass_for_",["Boolean",receiver]);
1086
- smalltalk.send(self["@stream"],"_nextPutAll_",["($receiver ? "]);
1087
- smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
1088
- smalltalk.send(self["@stream"],"_nextPutAll_",["() : nil)"]);
1089
- inlined=true;
1090
- inlined;
1091
- };
1092
- };
1093
- $5=smalltalk.send(aSelector,"__eq",["ifTrue:ifFalse:"]);
1094
- if(smalltalk.assert($5)){
1095
- $6=smalltalk.send(smalltalk.send(smalltalk.send(aCollection,"_first",[]),"_isBlockNode",[]),"_and_",[(function(){
1096
- return smalltalk.send(smalltalk.send(aCollection,"_second",[]),"_isBlockNode",[]);
1097
- })]);
1098
- if(smalltalk.assert($6)){
1099
- smalltalk.send(self,"_checkClass_for_",["Boolean",receiver]);
1100
- smalltalk.send(self["@stream"],"_nextPutAll_",["($receiver ? "]);
1101
- smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
1102
- smalltalk.send(self["@stream"],"_nextPutAll_",["() : "]);
1103
- smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_second",[])]);
1104
- smalltalk.send(self["@stream"],"_nextPutAll_",["())"]);
1105
- inlined=true;
1106
- inlined;
1107
- };
1108
- };
1109
- $7=smalltalk.send(aSelector,"__eq",["ifFalse:ifTrue:"]);
1110
- if(smalltalk.assert($7)){
1111
- $8=smalltalk.send(smalltalk.send(smalltalk.send(aCollection,"_first",[]),"_isBlockNode",[]),"_and_",[(function(){
1112
- return smalltalk.send(smalltalk.send(aCollection,"_second",[]),"_isBlockNode",[]);
1113
- })]);
1114
- if(smalltalk.assert($8)){
1115
- smalltalk.send(self,"_checkClass_for_",["Boolean",receiver]);
1116
- smalltalk.send(self["@stream"],"_nextPutAll_",["(! $receiver ? "]);
1117
- smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
1118
- smalltalk.send(self["@stream"],"_nextPutAll_",["() : "]);
1119
- smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_second",[])]);
1120
- smalltalk.send(self["@stream"],"_nextPutAll_",["())"]);
1121
- inlined=true;
1122
- inlined;
1123
- };
1124
- };
1125
- $9=smalltalk.send(aSelector,"__eq",["<"]);
1126
- if(smalltalk.assert($9)){
1127
- smalltalk.send(self,"_checkClass_for_",["Number",receiver]);
1128
- smalltalk.send(self["@stream"],"_nextPutAll_",["$receiver <"]);
1129
- smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
1130
- inlined=true;
1131
- inlined;
1132
- };
1133
- $10=smalltalk.send(aSelector,"__eq",["<="]);
1134
- if(smalltalk.assert($10)){
1135
- smalltalk.send(self,"_checkClass_for_",["Number",receiver]);
1136
- smalltalk.send(self["@stream"],"_nextPutAll_",["$receiver <="]);
1137
- smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
1138
- inlined=true;
1139
- inlined;
1140
- };
1141
- $11=smalltalk.send(aSelector,"__eq",[">"]);
1142
- if(smalltalk.assert($11)){
1143
- smalltalk.send(self,"_checkClass_for_",["Number",receiver]);
1144
- smalltalk.send(self["@stream"],"_nextPutAll_",["$receiver >"]);
1145
- smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
1146
- inlined=true;
1147
- inlined;
1148
- };
1149
- $12=smalltalk.send(aSelector,"__eq",[">="]);
1150
- if(smalltalk.assert($12)){
1151
- smalltalk.send(self,"_checkClass_for_",["Number",receiver]);
1152
- smalltalk.send(self["@stream"],"_nextPutAll_",["$receiver >="]);
1153
- smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
1154
- inlined=true;
1155
- inlined;
1156
- };
1157
- $13=smalltalk.send(aSelector,"__eq",["+"]);
1158
- if(smalltalk.assert($13)){
1159
- smalltalk.send(self,"_checkClass_for_",["Number",receiver]);
1160
- smalltalk.send(self["@stream"],"_nextPutAll_",["$receiver +"]);
1161
- smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
1162
- inlined=true;
1163
- inlined;
1164
- };
1165
- $14=smalltalk.send(aSelector,"__eq",["-"]);
1166
- if(smalltalk.assert($14)){
1167
- smalltalk.send(self,"_checkClass_for_",["Number",receiver]);
1168
- smalltalk.send(self["@stream"],"_nextPutAll_",["$receiver -"]);
1169
- smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
1170
- inlined=true;
1171
- inlined;
1172
- };
1173
- $15=smalltalk.send(aSelector,"__eq",["*"]);
1174
- if(smalltalk.assert($15)){
1175
- smalltalk.send(self,"_checkClass_for_",["Number",receiver]);
1176
- smalltalk.send(self["@stream"],"_nextPutAll_",["$receiver *"]);
1177
- smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
1178
- inlined=true;
1179
- inlined;
1180
- };
1181
- $16=smalltalk.send(aSelector,"__eq",["/"]);
1182
- if(smalltalk.assert($16)){
1183
- smalltalk.send(self,"_checkClass_for_",["Number",receiver]);
1184
- smalltalk.send(self["@stream"],"_nextPutAll_",["$receiver /"]);
1185
- smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
1186
- inlined=true;
1187
- inlined;
1188
- };
1189
- return inlined;
1190
- },
1191
- args: ["aSelector", "receiver", "aCollection"],
1192
- source: "inline: aSelector receiver: receiver argumentNodes: aCollection\x0a | inlined |\x0a inlined := false.\x0a\x0a\x09\x22-- Booleans --\x22\x0a\x0a\x09(aSelector = 'ifFalse:') ifTrue: [\x0a\x09\x09aCollection first isBlockNode ifTrue: [\x0a \x09self checkClass: 'Boolean' for: receiver.\x0a \x09stream nextPutAll: '(! $receiver ? '.\x0a \x09self visit: aCollection first.\x0a \x09\x09stream nextPutAll: '() : nil)'.\x0a \x09inlined := true]].\x0a\x0a\x09(aSelector = 'ifTrue:') ifTrue: [\x0a\x09\x09aCollection first isBlockNode ifTrue: [\x0a \x09self checkClass: 'Boolean' for: receiver.\x0a \x09stream nextPutAll: '($receiver ? '.\x0a \x09self visit: aCollection first.\x0a \x09\x09stream nextPutAll: '() : nil)'.\x0a \x09inlined := true]].\x0a\x0a\x09(aSelector = 'ifTrue:ifFalse:') ifTrue: [\x0a\x09\x09(aCollection first isBlockNode and: [aCollection second isBlockNode]) ifTrue: [\x0a \x09self checkClass: 'Boolean' for: receiver.\x0a \x09stream nextPutAll: '($receiver ? '.\x0a \x09self visit: aCollection first.\x0a \x09\x09stream nextPutAll: '() : '.\x0a \x09\x09self visit: aCollection second.\x0a \x09\x09stream nextPutAll: '())'.\x0a \x09inlined := true]].\x0a\x0a\x09(aSelector = 'ifFalse:ifTrue:') ifTrue: [\x0a\x09\x09(aCollection first isBlockNode and: [aCollection second isBlockNode]) ifTrue: [\x0a \x09self checkClass: 'Boolean' for: receiver.\x0a \x09stream nextPutAll: '(! $receiver ? '.\x0a \x09self visit: aCollection first.\x0a \x09\x09stream nextPutAll: '() : '.\x0a \x09\x09self visit: aCollection second.\x0a \x09\x09stream nextPutAll: '())'.\x0a \x09inlined := true]].\x0a\x0a\x09\x22-- Numbers --\x22\x0a\x0a\x09(aSelector = '<') ifTrue: [\x0a self checkClass: 'Number' for: receiver.\x0a stream nextPutAll: '$receiver <'.\x0a self visit: aCollection first.\x0a inlined := true].\x0a\x0a\x09(aSelector = '<=') ifTrue: [\x0a self checkClass: 'Number' for: receiver.\x0a stream nextPutAll: '$receiver <='.\x0a self visit: aCollection first.\x0a inlined := true].\x0a\x0a\x09(aSelector = '>') ifTrue: [ \x0a self checkClass: 'Number' for: receiver.\x0a stream nextPutAll: '$receiver >'.\x0a self visit: aCollection first.\x0a inlined := true].\x0a\x0a\x09(aSelector = '>=') ifTrue: [\x0a self checkClass: 'Number' for: receiver.\x0a stream nextPutAll: '$receiver >='.\x0a self visit: aCollection first.\x0a inlined := true].\x0a\x0a (aSelector = '+') ifTrue: [\x0a self checkClass: 'Number' for: receiver.\x0a stream nextPutAll: '$receiver +'.\x0a self visit: aCollection first.\x0a inlined := true].\x0a\x0a (aSelector = '-') ifTrue: [\x0a self checkClass: 'Number' for: receiver.\x0a stream nextPutAll: '$receiver -'.\x0a self visit: aCollection first.\x0a inlined := true].\x0a\x0a (aSelector = '*') ifTrue: [\x0a self checkClass: 'Number' for: receiver.\x0a stream nextPutAll: '$receiver *'.\x0a self visit: aCollection first.\x0a inlined := true].\x0a\x0a (aSelector = '/') ifTrue: [\x0a self checkClass: 'Number' for: receiver.\x0a stream nextPutAll: '$receiver /'.\x0a self visit: aCollection first.\x0a inlined := true].\x0a\x0a ^inlined",
1193
- messageSends: ["ifTrue:", "checkClass:for:", "nextPutAll:", "visit:", "first", "isBlockNode", "=", "second", "and:"],
1194
- referencedClasses: []
1195
- }),
1196
- smalltalk.FunCodeGenerator);
1197
-
1198
- smalltalk.addMethod(
1199
- "_inlineLiteral_receiverNode_argumentNodes_",
1200
- smalltalk.method({
1201
- selector: "inlineLiteral:receiverNode:argumentNodes:",
1202
- category: 'optimizations',
1203
- fn: function (aSelector,anObject,aCollection){
1204
- var self=this;
1205
- var $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$30,$31,$32;
1206
- var inlined;
1207
- inlined=false;
1208
- $1=smalltalk.send(aSelector,"__eq",["whileTrue:"]);
1209
- if(smalltalk.assert($1)){
1210
- $2=smalltalk.send(smalltalk.send(anObject,"_isBlockNode",[]),"_and_",[(function(){
1211
- return smalltalk.send(smalltalk.send(aCollection,"_first",[]),"_isBlockNode",[]);
1212
- })]);
1213
- if(smalltalk.assert($2)){
1214
- smalltalk.send(self["@stream"],"_nextPutAll_",["(function(){while("]);
1215
- smalltalk.send(self,"_visit_",[anObject]);
1216
- smalltalk.send(self["@stream"],"_nextPutAll_",["()) {"]);
1217
- smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
1218
- smalltalk.send(self["@stream"],"_nextPutAll_",["()}})()"]);
1219
- inlined=true;
1220
- inlined;
1221
- };
1222
- };
1223
- $3=smalltalk.send(aSelector,"__eq",["whileFalse:"]);
1224
- if(smalltalk.assert($3)){
1225
- $4=smalltalk.send(smalltalk.send(anObject,"_isBlockNode",[]),"_and_",[(function(){
1226
- return smalltalk.send(smalltalk.send(aCollection,"_first",[]),"_isBlockNode",[]);
1227
- })]);
1228
- if(smalltalk.assert($4)){
1229
- smalltalk.send(self["@stream"],"_nextPutAll_",["(function(){while(!"]);
1230
- smalltalk.send(self,"_visit_",[anObject]);
1231
- smalltalk.send(self["@stream"],"_nextPutAll_",["()) {"]);
1232
- smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
1233
- smalltalk.send(self["@stream"],"_nextPutAll_",["()}})()"]);
1234
- inlined=true;
1235
- inlined;
1236
- };
1237
- };
1238
- $5=smalltalk.send(aSelector,"__eq",["whileTrue"]);
1239
- if(smalltalk.assert($5)){
1240
- $6=smalltalk.send(anObject,"_isBlockNode",[]);
1241
- if(smalltalk.assert($6)){
1242
- smalltalk.send(self["@stream"],"_nextPutAll_",["(function(){while("]);
1243
- smalltalk.send(self,"_visit_",[anObject]);
1244
- smalltalk.send(self["@stream"],"_nextPutAll_",["()) {}})()"]);
1245
- inlined=true;
1246
- inlined;
1247
- };
1248
- };
1249
- $7=smalltalk.send(aSelector,"__eq",["whileFalse"]);
1250
- if(smalltalk.assert($7)){
1251
- $8=smalltalk.send(anObject,"_isBlockNode",[]);
1252
- if(smalltalk.assert($8)){
1253
- smalltalk.send(self["@stream"],"_nextPutAll_",["(function(){while(!"]);
1254
- smalltalk.send(self,"_visit_",[anObject]);
1255
- smalltalk.send(self["@stream"],"_nextPutAll_",["()) {}})()"]);
1256
- inlined=true;
1257
- inlined;
1258
- };
1259
- };
1260
- $9=smalltalk.send(aSelector,"__eq",["+"]);
1261
- if(smalltalk.assert($9)){
1262
- $10=smalltalk.send(self,"_isNode_ofClass_",[anObject,(smalltalk.Number || Number)]);
1263
- if(smalltalk.assert($10)){
1264
- smalltalk.send(self,"_visit_",[anObject]);
1265
- smalltalk.send(self["@stream"],"_nextPutAll_",[" + "]);
1266
- smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
1267
- inlined=true;
1268
- inlined;
1269
- };
1270
- };
1271
- $11=smalltalk.send(aSelector,"__eq",["-"]);
1272
- if(smalltalk.assert($11)){
1273
- $12=smalltalk.send(self,"_isNode_ofClass_",[anObject,(smalltalk.Number || Number)]);
1274
- if(smalltalk.assert($12)){
1275
- smalltalk.send(self,"_visit_",[anObject]);
1276
- smalltalk.send(self["@stream"],"_nextPutAll_",[" - "]);
1277
- smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
1278
- inlined=true;
1279
- inlined;
1280
- };
1281
- };
1282
- $13=smalltalk.send(aSelector,"__eq",["*"]);
1283
- if(smalltalk.assert($13)){
1284
- $14=smalltalk.send(self,"_isNode_ofClass_",[anObject,(smalltalk.Number || Number)]);
1285
- if(smalltalk.assert($14)){
1286
- smalltalk.send(self,"_visit_",[anObject]);
1287
- smalltalk.send(self["@stream"],"_nextPutAll_",[" * "]);
1288
- smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
1289
- inlined=true;
1290
- inlined;
1291
- };
1292
- };
1293
- $15=smalltalk.send(aSelector,"__eq",["/"]);
1294
- if(smalltalk.assert($15)){
1295
- $16=smalltalk.send(self,"_isNode_ofClass_",[anObject,(smalltalk.Number || Number)]);
1296
- if(smalltalk.assert($16)){
1297
- smalltalk.send(self,"_visit_",[anObject]);
1298
- smalltalk.send(self["@stream"],"_nextPutAll_",[" / "]);
1299
- smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
1300
- inlined=true;
1301
- inlined;
1302
- };
1303
- };
1304
- $17=smalltalk.send(aSelector,"__eq",["<"]);
1305
- if(smalltalk.assert($17)){
1306
- $18=smalltalk.send(self,"_isNode_ofClass_",[anObject,(smalltalk.Number || Number)]);
1307
- if(smalltalk.assert($18)){
1308
- smalltalk.send(self,"_visit_",[anObject]);
1309
- smalltalk.send(self["@stream"],"_nextPutAll_",[" < "]);
1310
- smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
1311
- inlined=true;
1312
- inlined;
1313
- };
1314
- };
1315
- $19=smalltalk.send(aSelector,"__eq",["<="]);
1316
- if(smalltalk.assert($19)){
1317
- $20=smalltalk.send(self,"_isNode_ofClass_",[anObject,(smalltalk.Number || Number)]);
1318
- if(smalltalk.assert($20)){
1319
- smalltalk.send(self,"_visit_",[anObject]);
1320
- smalltalk.send(self["@stream"],"_nextPutAll_",[" <= "]);
1321
- smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
1322
- inlined=true;
1323
- inlined;
1324
- };
1325
- };
1326
- $21=smalltalk.send(aSelector,"__eq",[">"]);
1327
- if(smalltalk.assert($21)){
1328
- $22=smalltalk.send(self,"_isNode_ofClass_",[anObject,(smalltalk.Number || Number)]);
1329
- if(smalltalk.assert($22)){
1330
- smalltalk.send(self,"_visit_",[anObject]);
1331
- smalltalk.send(self["@stream"],"_nextPutAll_",[" > "]);
1332
- smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
1333
- inlined=true;
1334
- inlined;
1335
- };
1336
- };
1337
- $23=smalltalk.send(aSelector,"__eq",[">="]);
1338
- if(smalltalk.assert($23)){
1339
- $24=smalltalk.send(self,"_isNode_ofClass_",[anObject,(smalltalk.Number || Number)]);
1340
- if(smalltalk.assert($24)){
1341
- smalltalk.send(self,"_visit_",[anObject]);
1342
- smalltalk.send(self["@stream"],"_nextPutAll_",[" >= "]);
1343
- smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
1344
- inlined=true;
1345
- inlined;
1346
- };
1347
- };
1348
- $25=smalltalk.send(aSelector,"__eq",["ifNil:"]);
1349
- if(smalltalk.assert($25)){
1350
- $26=smalltalk.send(smalltalk.send(aCollection,"_first",[]),"_isBlockNode",[]);
1351
- if(smalltalk.assert($26)){
1352
- smalltalk.send(self["@stream"],"_nextPutAll_",["(($receiver = "]);
1353
- smalltalk.send(self,"_visit_",[anObject]);
1354
- smalltalk.send(self["@stream"],"_nextPutAll_",[") == nil || $receiver == undefined) ? "]);
1355
- smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
1356
- smalltalk.send(self["@stream"],"_nextPutAll_",["() : $receiver"]);
1357
- inlined=true;
1358
- inlined;
1359
- };
1360
- };
1361
- $27=smalltalk.send(aSelector,"__eq",["ifNotNil:"]);
1362
- if(smalltalk.assert($27)){
1363
- $28=smalltalk.send(smalltalk.send(aCollection,"_first",[]),"_isBlockNode",[]);
1364
- if(smalltalk.assert($28)){
1365
- smalltalk.send(self["@stream"],"_nextPutAll_",["(($receiver = "]);
1366
- smalltalk.send(self,"_visit_",[anObject]);
1367
- smalltalk.send(self["@stream"],"_nextPutAll_",[") != nil && $receiver != undefined) ? "]);
1368
- smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
1369
- smalltalk.send(self["@stream"],"_nextPutAll_",["() : nil"]);
1370
- inlined=true;
1371
- inlined;
1372
- };
1373
- };
1374
- $29=smalltalk.send(aSelector,"__eq",["ifNil:ifNotNil:"]);
1375
- if(smalltalk.assert($29)){
1376
- $30=smalltalk.send(smalltalk.send(smalltalk.send(aCollection,"_first",[]),"_isBlockNode",[]),"_and_",[(function(){
1377
- return smalltalk.send(smalltalk.send(aCollection,"_second",[]),"_isBlockNode",[]);
1378
- })]);
1379
- if(smalltalk.assert($30)){
1380
- smalltalk.send(self["@stream"],"_nextPutAll_",["(($receiver = "]);
1381
- smalltalk.send(self,"_visit_",[anObject]);
1382
- smalltalk.send(self["@stream"],"_nextPutAll_",[") == nil || $receiver == undefined) ? "]);
1383
- smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
1384
- smalltalk.send(self["@stream"],"_nextPutAll_",["() : "]);
1385
- smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_second",[])]);
1386
- smalltalk.send(self["@stream"],"_nextPutAll_",["()"]);
1387
- inlined=true;
1388
- inlined;
1389
- };
1390
- };
1391
- $31=smalltalk.send(aSelector,"__eq",["ifNotNil:ifNil:"]);
1392
- if(smalltalk.assert($31)){
1393
- $32=smalltalk.send(smalltalk.send(smalltalk.send(aCollection,"_first",[]),"_isBlockNode",[]),"_and_",[(function(){
1394
- return smalltalk.send(smalltalk.send(aCollection,"_second",[]),"_isBlockNode",[]);
1395
- })]);
1396
- if(smalltalk.assert($32)){
1397
- smalltalk.send(self["@stream"],"_nextPutAll_",["(($receiver = "]);
1398
- smalltalk.send(self,"_visit_",[anObject]);
1399
- smalltalk.send(self["@stream"],"_nextPutAll_",[") == nil || $receiver == undefined) ? "]);
1400
- smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_second",[])]);
1401
- smalltalk.send(self["@stream"],"_nextPutAll_",["() : "]);
1402
- smalltalk.send(self,"_visit_",[smalltalk.send(aCollection,"_first",[])]);
1403
- smalltalk.send(self["@stream"],"_nextPutAll_",["()"]);
1404
- inlined=true;
1405
- inlined;
1406
- };
1407
- };
1408
- return inlined;
1409
- },
1410
- args: ["aSelector", "anObject", "aCollection"],
1411
- source: "inlineLiteral: aSelector receiverNode: anObject argumentNodes: aCollection\x0a | inlined |\x0a inlined := false.\x0a \x0a\x09\x22-- BlockClosures --\x22\x0a\x0a\x09(aSelector = 'whileTrue:') ifTrue: [\x0a \x09(anObject isBlockNode and: [aCollection first isBlockNode]) ifTrue: [\x0a \x09stream nextPutAll: '(function(){while('.\x0a \x09self visit: anObject.\x0a \x09stream nextPutAll: '()) {'.\x0a \x09self visit: aCollection first.\x0a \x09\x09stream nextPutAll: '()}})()'.\x0a \x09inlined := true]].\x0a\x0a\x09(aSelector = 'whileFalse:') ifTrue: [\x0a \x09(anObject isBlockNode and: [aCollection first isBlockNode]) ifTrue: [\x0a \x09stream nextPutAll: '(function(){while(!'.\x0a \x09self visit: anObject.\x0a \x09stream nextPutAll: '()) {'.\x0a \x09self visit: aCollection first.\x0a \x09\x09stream nextPutAll: '()}})()'.\x0a \x09inlined := true]].\x0a\x0a\x09(aSelector = 'whileTrue') ifTrue: [\x0a \x09anObject isBlockNode ifTrue: [\x0a \x09stream nextPutAll: '(function(){while('.\x0a \x09self visit: anObject.\x0a \x09stream nextPutAll: '()) {}})()'.\x0a \x09inlined := true]].\x0a\x0a\x09(aSelector = 'whileFalse') ifTrue: [\x0a \x09anObject isBlockNode ifTrue: [\x0a \x09stream nextPutAll: '(function(){while(!'.\x0a \x09self visit: anObject.\x0a \x09stream nextPutAll: '()) {}})()'.\x0a \x09inlined := true]].\x0a\x0a\x09\x22-- Numbers --\x22\x0a\x0a\x09(aSelector = '+') ifTrue: [\x0a \x09(self isNode: anObject ofClass: Number) ifTrue: [\x0a \x09self visit: anObject.\x0a \x09stream nextPutAll: ' + '.\x0a \x09self visit: aCollection first.\x0a \x09inlined := true]].\x0a\x0a\x09(aSelector = '-') ifTrue: [\x0a \x09(self isNode: anObject ofClass: Number) ifTrue: [\x0a \x09self visit: anObject.\x0a \x09stream nextPutAll: ' - '.\x0a \x09self visit: aCollection first.\x0a \x09inlined := true]].\x0a\x0a\x09(aSelector = '*') ifTrue: [\x0a \x09(self isNode: anObject ofClass: Number) ifTrue: [\x0a \x09self visit: anObject.\x0a \x09stream nextPutAll: ' * '.\x0a \x09self visit: aCollection first.\x0a \x09inlined := true]].\x0a\x0a\x09(aSelector = '/') ifTrue: [\x0a \x09(self isNode: anObject ofClass: Number) ifTrue: [\x0a \x09self visit: anObject.\x0a \x09stream nextPutAll: ' / '.\x0a \x09self visit: aCollection first.\x0a \x09inlined := true]].\x0a\x0a\x09(aSelector = '<') ifTrue: [\x0a \x09(self isNode: anObject ofClass: Number) ifTrue: [\x0a \x09self visit: anObject.\x0a \x09stream nextPutAll: ' < '.\x0a \x09self visit: aCollection first.\x0a \x09inlined := true]].\x0a\x0a\x09(aSelector = '<=') ifTrue: [\x0a \x09(self isNode: anObject ofClass: Number) ifTrue: [\x0a \x09self visit: anObject.\x0a \x09stream nextPutAll: ' <= '.\x0a \x09self visit: aCollection first.\x0a \x09inlined := true]].\x0a\x0a\x09(aSelector = '>') ifTrue: [\x0a \x09(self isNode: anObject ofClass: Number) ifTrue: [\x0a \x09self visit: anObject.\x0a \x09stream nextPutAll: ' > '.\x0a \x09self visit: aCollection first.\x0a \x09inlined := true]].\x0a\x0a\x09(aSelector = '>=') ifTrue: [\x0a \x09(self isNode: anObject ofClass: Number) ifTrue: [\x0a \x09self visit: anObject.\x0a \x09stream nextPutAll: ' >= '.\x0a \x09self visit: aCollection first.\x0a \x09inlined := true]].\x0a \x09 \x0a\x09\x22-- UndefinedObject --\x22\x0a\x0a\x09(aSelector = 'ifNil:') ifTrue: [\x0a\x09\x09aCollection first isBlockNode ifTrue: [\x0a \x09\x09stream nextPutAll: '(($receiver = '.\x0a \x09\x09self visit: anObject.\x0a \x09\x09stream nextPutAll: ') == nil || $receiver == undefined) ? '.\x0a \x09self visit: aCollection first.\x0a \x09stream nextPutAll: '() : $receiver'.\x0a \x09inlined := true]].\x0a\x0a\x09(aSelector = 'ifNotNil:') ifTrue: [\x0a\x09\x09aCollection first isBlockNode ifTrue: [\x0a \x09\x09stream nextPutAll: '(($receiver = '.\x0a \x09\x09self visit: anObject.\x0a \x09\x09stream nextPutAll: ') != nil && $receiver != undefined) ? '.\x0a \x09self visit: aCollection first.\x0a \x09stream nextPutAll: '() : nil'.\x0a \x09inlined := true]].\x0a\x0a\x09(aSelector = 'ifNil:ifNotNil:') ifTrue: [\x0a\x09\x09(aCollection first isBlockNode and: [aCollection second isBlockNode]) ifTrue: [\x0a \x09\x09stream nextPutAll: '(($receiver = '.\x0a \x09\x09self visit: anObject.\x0a \x09\x09stream nextPutAll: ') == nil || $receiver == undefined) ? '.\x0a \x09self visit: aCollection first.\x0a \x09stream nextPutAll: '() : '.\x0a \x09self visit: aCollection second.\x0a \x09stream nextPutAll: '()'.\x0a \x09inlined := true]].\x0a\x0a\x09(aSelector = 'ifNotNil:ifNil:') ifTrue: [\x0a\x09\x09(aCollection first isBlockNode and: [aCollection second isBlockNode]) ifTrue: [\x0a \x09\x09stream nextPutAll: '(($receiver = '.\x0a \x09\x09self visit: anObject.\x0a \x09\x09stream nextPutAll: ') == nil || $receiver == undefined) ? '.\x0a \x09self visit: aCollection second.\x0a \x09stream nextPutAll: '() : '.\x0a \x09self visit: aCollection first.\x0a \x09stream nextPutAll: '()'.\x0a \x09inlined := true]].\x0a \x0a ^inlined",
1412
- messageSends: ["ifTrue:", "nextPutAll:", "visit:", "first", "and:", "isBlockNode", "=", "isNode:ofClass:", "second"],
1413
- referencedClasses: ["Number"]
1414
- }),
1415
- smalltalk.FunCodeGenerator);
1416
-
1417
- smalltalk.addMethod(
1418
- "_isNode_ofClass_",
1419
- smalltalk.method({
1420
- selector: "isNode:ofClass:",
1421
- category: 'optimizations',
1422
- fn: function (aNode,aClass){
1423
- var self=this;
1424
- var $1;
1425
- $1=smalltalk.send(smalltalk.send(aNode,"_isValueNode",[]),"_and_",[(function(){
1426
- return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aNode,"_value",[]),"_class",[]),"__eq",[aClass]),"_or_",[(function(){
1427
- return smalltalk.send(smalltalk.send(smalltalk.send(aNode,"_value",[]),"__eq",["self"]),"_and_",[(function(){
1428
- return smalltalk.send(smalltalk.send(self,"_currentClass",[]),"__eq",[aClass]);
1429
- })]);
1430
- })]);
1431
- })]);
1432
- return $1;
1433
- },
1434
- args: ["aNode", "aClass"],
1435
- source: "isNode: aNode ofClass: aClass\x0a\x09^aNode isValueNode and: [\x0a \x09aNode value class = aClass or: [\x0a \x09\x09aNode value = 'self' and: [self currentClass = aClass]]]",
1436
- messageSends: ["and:", "or:", "=", "currentClass", "value", "class", "isValueNode"],
1437
- referencedClasses: []
1438
- }),
1439
- smalltalk.FunCodeGenerator);
1440
-
1441
- smalltalk.addMethod(
1442
- "_knownVariables",
1443
- smalltalk.method({
1444
- selector: "knownVariables",
1445
- category: 'accessing',
1446
- fn: function (){
1447
- var self=this;
1448
- var $2,$3,$1;
1449
- $2=smalltalk.send(self,"_pseudoVariables",[]);
1450
- smalltalk.send($2,"_addAll_",[smalltalk.send(self,"_tempVariables",[])]);
1451
- smalltalk.send($2,"_addAll_",[smalltalk.send(self,"_argVariables",[])]);
1452
- $3=smalltalk.send($2,"_yourself",[]);
1453
- $1=$3;
1454
- return $1;
1455
- },
1456
- args: [],
1457
- source: "knownVariables\x0a\x09^self pseudoVariables \x0a\x09\x09addAll: self tempVariables;\x0a\x09\x09addAll: self argVariables;\x0a\x09\x09yourself",
1458
- messageSends: ["addAll:", "tempVariables", "pseudoVariables", "argVariables", "yourself"],
1459
- referencedClasses: []
1460
- }),
1461
- smalltalk.FunCodeGenerator);
1462
-
1463
- smalltalk.addMethod(
1464
- "_performOptimizations",
1465
- smalltalk.method({
1466
- selector: "performOptimizations",
1467
- category: 'testing',
1468
- fn: function (){
1469
- var self=this;
1470
- var $1;
1471
- $1=smalltalk.send(smalltalk.send(self,"_class",[]),"_performOptimizations",[]);
1472
- return $1;
1473
- },
1474
- args: [],
1475
- source: "performOptimizations\x0a\x09^self class performOptimizations",
1476
- messageSends: ["performOptimizations", "class"],
1477
- referencedClasses: []
1478
- }),
1479
- smalltalk.FunCodeGenerator);
1480
-
1481
- smalltalk.addMethod(
1482
- "_send_to_arguments_superSend_",
1483
- smalltalk.method({
1484
- selector: "send:to:arguments:superSend:",
1485
- category: 'visiting',
1486
- fn: function (aSelector,aReceiver,aCollection,aBoolean){
1487
- var self=this;
1488
- var $1;
1489
- $1=smalltalk.send((smalltalk.String || String),"_streamContents_",[(function(str){
1490
- var tmp;
1491
- tmp=self["@stream"];
1492
- tmp;
1493
- smalltalk.send(str,"_nextPutAll_",["smalltalk.send("]);
1494
- smalltalk.send(str,"_nextPutAll_",[aReceiver]);
1495
- smalltalk.send(str,"_nextPutAll_",[smalltalk.send(smalltalk.send(", \x22","__comma",[smalltalk.send(aSelector,"_asSelector",[])]),"__comma",["\x22, ["])]);
1496
- self["@stream"]=str;
1497
- self["@stream"];
1498
- smalltalk.send(aCollection,"_do_separatedBy_",[(function(each){
1499
- return smalltalk.send(self,"_visit_",[each]);
1500
- }),(function(){
1501
- return smalltalk.send(self["@stream"],"_nextPutAll_",[", "]);
1502
- })]);
1503
- self["@stream"]=tmp;
1504
- self["@stream"];
1505
- smalltalk.send(str,"_nextPutAll_",["]"]);
1506
- if(smalltalk.assert(aBoolean)){
1507
- smalltalk.send(str,"_nextPutAll_",[smalltalk.send(smalltalk.send(", smalltalk.","__comma",[smalltalk.send(self,"_classNameFor_",[smalltalk.send(self,"_currentClass",[])])]),"__comma",[".superclass || nil"])]);
1508
- };
1509
- return smalltalk.send(str,"_nextPutAll_",[")"]);
1510
- })]);
1511
- return $1;
1512
- },
1513
- args: ["aSelector", "aReceiver", "aCollection", "aBoolean"],
1514
- source: "send: aSelector to: aReceiver arguments: aCollection superSend: aBoolean\x0a\x09^String streamContents: [:str || tmp |\x0a \x09tmp := stream.\x0a\x09\x09str nextPutAll: 'smalltalk.send('.\x0a\x09\x09str nextPutAll: aReceiver.\x0a\x09\x09str nextPutAll: ', \x22', aSelector asSelector, '\x22, ['.\x0a stream := str.\x0a\x09\x09aCollection\x0a\x09 \x09\x09do: [:each | self visit: each]\x0a\x09 \x09\x09separatedBy: [stream nextPutAll: ', '].\x0a stream := tmp.\x0a str nextPutAll: ']'.\x0a\x09\x09aBoolean ifTrue: [\x0a\x09\x09\x09str nextPutAll: ', smalltalk.', (self classNameFor: self currentClass), '.superclass || nil'].\x0a\x09\x09str nextPutAll: ')']",
1515
- messageSends: ["streamContents:", "nextPutAll:", ",", "asSelector", "do:separatedBy:", "visit:", "ifTrue:", "classNameFor:", "currentClass"],
1516
- referencedClasses: ["String"]
1517
- }),
1518
- smalltalk.FunCodeGenerator);
1519
-
1520
- smalltalk.addMethod(
1521
- "_tempVariables",
1522
- smalltalk.method({
1523
- selector: "tempVariables",
1524
- category: 'accessing',
1525
- fn: function (){
1526
- var self=this;
1527
- var $1;
1528
- $1=smalltalk.send(self["@tempVariables"],"_copy",[]);
1529
- return $1;
1530
- },
1531
- args: [],
1532
- source: "tempVariables\x0a\x09^tempVariables copy",
1533
- messageSends: ["copy"],
1534
- referencedClasses: []
1535
- }),
1536
- smalltalk.FunCodeGenerator);
1537
-
1538
- smalltalk.addMethod(
1539
- "_unknownVariables",
1540
- smalltalk.method({
1541
- selector: "unknownVariables",
1542
- category: 'accessing',
1543
- fn: function (){
1544
- var self=this;
1545
- var $1;
1546
- $1=smalltalk.send(self["@unknownVariables"],"_copy",[]);
1547
- return $1;
1548
- },
1549
- args: [],
1550
- source: "unknownVariables\x0a\x09^unknownVariables copy",
1551
- messageSends: ["copy"],
1552
- referencedClasses: []
1553
- }),
1554
- smalltalk.FunCodeGenerator);
1555
-
1556
- smalltalk.addMethod(
1557
- "_visit_",
1558
- smalltalk.method({
1559
- selector: "visit:",
1560
- category: 'visiting',
1561
- fn: function (aNode){
1562
- var self=this;
1563
- smalltalk.send(aNode,"_accept_",[self]);
1564
- return self},
1565
- args: ["aNode"],
1566
- source: "visit: aNode\x0a\x09aNode accept: self",
1567
- messageSends: ["accept:"],
1568
- referencedClasses: []
1569
- }),
1570
- smalltalk.FunCodeGenerator);
1571
-
1572
- smalltalk.addMethod(
1573
- "_visitAssignmentNode_",
1574
- smalltalk.method({
1575
- selector: "visitAssignmentNode:",
1576
- category: 'visiting',
1577
- fn: function (aNode){
1578
- var self=this;
1579
- smalltalk.send(self["@stream"],"_nextPutAll_",["("]);
1580
- smalltalk.send(self,"_visit_",[smalltalk.send(aNode,"_left",[])]);
1581
- smalltalk.send(self["@stream"],"_nextPutAll_",["="]);
1582
- smalltalk.send(self,"_visit_",[smalltalk.send(aNode,"_right",[])]);
1583
- smalltalk.send(self["@stream"],"_nextPutAll_",[")"]);
1584
- return self},
1585
- args: ["aNode"],
1586
- source: "visitAssignmentNode: aNode\x0a\x09stream nextPutAll: '('.\x0a\x09self visit: aNode left.\x0a\x09stream nextPutAll: '='.\x0a\x09self visit: aNode right.\x0a\x09stream nextPutAll: ')'",
1587
- messageSends: ["nextPutAll:", "visit:", "left", "right"],
1588
- referencedClasses: []
1589
- }),
1590
- smalltalk.FunCodeGenerator);
1591
-
1592
- smalltalk.addMethod(
1593
- "_visitBlockNode_",
1594
- smalltalk.method({
1595
- selector: "visitBlockNode:",
1596
- category: 'visiting',
1597
- fn: function (aNode){
1598
- var self=this;
1599
- smalltalk.send(self["@stream"],"_nextPutAll_",["(function("]);
1600
- smalltalk.send(smalltalk.send(aNode,"_parameters",[]),"_do_separatedBy_",[(function(each){
1601
- smalltalk.send(self["@tempVariables"],"_add_",[each]);
1602
- return smalltalk.send(self["@stream"],"_nextPutAll_",[each]);
1603
- }),(function(){
1604
- return smalltalk.send(self["@stream"],"_nextPutAll_",[", "]);
1605
- })]);
1606
- smalltalk.send(self["@stream"],"_nextPutAll_",["){"]);
1607
- smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_do_",[(function(each){
1608
- return smalltalk.send(self,"_visit_",[each]);
1609
- })]);
1610
- smalltalk.send(self["@stream"],"_nextPutAll_",["})"]);
1611
- return self},
1612
- args: ["aNode"],
1613
- source: "visitBlockNode: aNode\x0a\x09stream nextPutAll: '(function('.\x0a\x09aNode parameters \x0a\x09 do: [:each |\x0a\x09\x09tempVariables add: each.\x0a\x09\x09stream nextPutAll: each]\x0a\x09 separatedBy: [stream nextPutAll: ', '].\x0a\x09stream nextPutAll: '){'.\x0a\x09aNode nodes do: [:each | self visit: each].\x0a\x09stream nextPutAll: '})'",
1614
- messageSends: ["nextPutAll:", "do:separatedBy:", "add:", "parameters", "do:", "visit:", "nodes"],
1615
- referencedClasses: []
1616
- }),
1617
- smalltalk.FunCodeGenerator);
1618
-
1619
- smalltalk.addMethod(
1620
- "_visitBlockSequenceNode_",
1621
- smalltalk.method({
1622
- selector: "visitBlockSequenceNode:",
1623
- category: 'visiting',
1624
- fn: function (aNode){
1625
- var self=this;
1626
- var $1,$2,$3;
1627
- var index;
1628
- self["@nestedBlocks"]=smalltalk.send(self["@nestedBlocks"],"__plus",[(1)]);
1629
- $1=smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_isEmpty",[]);
1630
- if(smalltalk.assert($1)){
1631
- smalltalk.send(self["@stream"],"_nextPutAll_",["return nil;"]);
1632
- } else {
1633
- smalltalk.send(smalltalk.send(aNode,"_temps",[]),"_do_",[(function(each){
1634
- var temp;
1635
- temp=smalltalk.send(self,"_safeVariableNameFor_",[each]);
1636
- temp;
1637
- smalltalk.send(self["@tempVariables"],"_add_",[temp]);
1638
- smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(smalltalk.send("var ","__comma",[temp]),"__comma",["=nil;"])]);
1639
- $2=smalltalk.send(self["@stream"],"_lf",[]);
1640
- return $2;
1641
- })]);
1642
- index=(0);
1643
- index;
1644
- smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_do_",[(function(each){
1645
- index=smalltalk.send(index,"__plus",[(1)]);
1646
- index;
1647
- $3=smalltalk.send(index,"__eq",[smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_size",[])]);
1648
- if(smalltalk.assert($3)){
1649
- smalltalk.send(self["@stream"],"_nextPutAll_",["return "]);
1650
- };
1651
- smalltalk.send(self,"_visit_",[each]);
1652
- return smalltalk.send(self["@stream"],"_nextPutAll_",[";"]);
1653
- })]);
1654
- };
1655
- self["@nestedBlocks"]=smalltalk.send(self["@nestedBlocks"],"__minus",[(1)]);
1656
- return self},
1657
- args: ["aNode"],
1658
- source: "visitBlockSequenceNode: aNode\x0a\x09| index |\x0a\x09nestedBlocks := nestedBlocks + 1.\x0a\x09aNode nodes isEmpty\x0a\x09 ifTrue: [\x0a\x09\x09stream nextPutAll: 'return nil;']\x0a\x09 ifFalse: [\x0a\x09\x09aNode temps do: [:each | | temp |\x0a temp := self safeVariableNameFor: each.\x0a\x09\x09 tempVariables add: temp.\x0a\x09\x09 stream nextPutAll: 'var ', temp, '=nil;'; lf].\x0a\x09\x09index := 0.\x0a\x09\x09aNode nodes do: [:each |\x0a\x09\x09 index := index + 1.\x0a\x09\x09 index = aNode nodes size ifTrue: [\x0a\x09\x09\x09stream nextPutAll: 'return '].\x0a\x09\x09 self visit: each.\x0a\x09\x09 stream nextPutAll: ';']].\x0a\x09nestedBlocks := nestedBlocks - 1",
1659
- messageSends: ["+", "ifTrue:ifFalse:", "nextPutAll:", "do:", "safeVariableNameFor:", "add:", ",", "lf", "temps", "ifTrue:", "=", "size", "nodes", "visit:", "isEmpty", "-"],
1660
- referencedClasses: []
1661
- }),
1662
- smalltalk.FunCodeGenerator);
1663
-
1664
- smalltalk.addMethod(
1665
- "_visitCascadeNode_",
1666
- smalltalk.method({
1667
- selector: "visitCascadeNode:",
1668
- category: 'visiting',
1669
- fn: function (aNode){
1670
- var self=this;
1671
- var $1,$2;
1672
- var index;
1673
- index=(0);
1674
- $1=smalltalk.send(self["@tempVariables"],"_includes_",["$rec"]);
1675
- if(! smalltalk.assert($1)){
1676
- smalltalk.send(self["@tempVariables"],"_add_",["$rec"]);
1677
- };
1678
- smalltalk.send(self["@stream"],"_nextPutAll_",["(function($rec){"]);
1679
- smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_do_",[(function(each){
1680
- index=smalltalk.send(index,"__plus",[(1)]);
1681
- index;
1682
- $2=smalltalk.send(index,"__eq",[smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_size",[])]);
1683
- if(smalltalk.assert($2)){
1684
- smalltalk.send(self["@stream"],"_nextPutAll_",["return "]);
1685
- };
1686
- smalltalk.send(each,"_receiver_",[smalltalk.send(smalltalk.send((smalltalk.VariableNode || VariableNode),"_new",[]),"_value_",["$rec"])]);
1687
- smalltalk.send(self,"_visit_",[each]);
1688
- return smalltalk.send(self["@stream"],"_nextPutAll_",[";"]);
1689
- })]);
1690
- smalltalk.send(self["@stream"],"_nextPutAll_",["})("]);
1691
- smalltalk.send(self,"_visit_",[smalltalk.send(aNode,"_receiver",[])]);
1692
- smalltalk.send(self["@stream"],"_nextPutAll_",[")"]);
1693
- return self},
1694
- args: ["aNode"],
1695
- source: "visitCascadeNode: aNode\x0a\x09| index |\x0a\x09index := 0.\x0a\x09(tempVariables includes: '$rec') ifFalse: [\x0a\x09\x09tempVariables add: '$rec'].\x0a\x09stream nextPutAll: '(function($rec){'.\x0a\x09aNode nodes do: [:each |\x0a\x09 index := index + 1.\x0a\x09 index = aNode nodes size ifTrue: [\x0a\x09\x09stream nextPutAll: 'return '].\x0a\x09 each receiver: (VariableNode new value: '$rec').\x0a\x09 self visit: each.\x0a\x09 stream nextPutAll: ';'].\x0a\x09stream nextPutAll: '})('.\x0a\x09self visit: aNode receiver.\x0a\x09stream nextPutAll: ')'",
1696
- messageSends: ["ifFalse:", "add:", "includes:", "nextPutAll:", "do:", "+", "ifTrue:", "=", "size", "nodes", "receiver:", "value:", "new", "visit:", "receiver"],
1697
- referencedClasses: ["VariableNode"]
1698
- }),
1699
- smalltalk.FunCodeGenerator);
1700
-
1701
- smalltalk.addMethod(
1702
- "_visitClassReferenceNode_",
1703
- smalltalk.method({
1704
- selector: "visitClassReferenceNode:",
1705
- category: 'visiting',
1706
- fn: function (aNode){
1707
- var self=this;
1708
- var $1;
1709
- $1=smalltalk.send(self["@referencedClasses"],"_includes_",[smalltalk.send(aNode,"_value",[])]);
1710
- if(! smalltalk.assert($1)){
1711
- smalltalk.send(self["@referencedClasses"],"_add_",[smalltalk.send(aNode,"_value",[])]);
1712
- };
1713
- smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send("(smalltalk.","__comma",[smalltalk.send(aNode,"_value",[])]),"__comma",[" || "]),"__comma",[smalltalk.send(aNode,"_value",[])]),"__comma",[")"])]);
1714
- return self},
1715
- args: ["aNode"],
1716
- source: "visitClassReferenceNode: aNode\x0a\x09(referencedClasses includes: aNode value) ifFalse: [\x0a\x09\x09referencedClasses add: aNode value].\x0a\x09stream nextPutAll: '(smalltalk.', aNode value, ' || ', aNode value, ')'",
1717
- messageSends: ["ifFalse:", "add:", "value", "includes:", "nextPutAll:", ","],
1718
- referencedClasses: []
1719
- }),
1720
- smalltalk.FunCodeGenerator);
1721
-
1722
- smalltalk.addMethod(
1723
- "_visitDynamicArrayNode_",
1724
- smalltalk.method({
1725
- selector: "visitDynamicArrayNode:",
1726
- category: 'visiting',
1727
- fn: function (aNode){
1728
- var self=this;
1729
- smalltalk.send(self["@stream"],"_nextPutAll_",["["]);
1730
- smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_do_separatedBy_",[(function(each){
1731
- return smalltalk.send(self,"_visit_",[each]);
1732
- }),(function(){
1733
- return smalltalk.send(self["@stream"],"_nextPutAll_",[","]);
1734
- })]);
1735
- smalltalk.send(self["@stream"],"_nextPutAll_",["]"]);
1736
- return self},
1737
- args: ["aNode"],
1738
- source: "visitDynamicArrayNode: aNode\x0a\x09stream nextPutAll: '['.\x0a\x09aNode nodes \x0a\x09\x09do: [:each | self visit: each]\x0a\x09\x09separatedBy: [stream nextPutAll: ','].\x0a\x09stream nextPutAll: ']'",
1739
- messageSends: ["nextPutAll:", "do:separatedBy:", "visit:", "nodes"],
1740
- referencedClasses: []
1741
- }),
1742
- smalltalk.FunCodeGenerator);
1743
-
1744
- smalltalk.addMethod(
1745
- "_visitDynamicDictionaryNode_",
1746
- smalltalk.method({
1747
- selector: "visitDynamicDictionaryNode:",
1748
- category: 'visiting',
1749
- fn: function (aNode){
1750
- var self=this;
1751
- smalltalk.send(self["@stream"],"_nextPutAll_",["smalltalk.HashedCollection._fromPairs_(["]);
1752
- smalltalk.send(smalltalk.send(aNode,"_nodes",[]),"_do_separatedBy_",[(function(each){
1753
- return smalltalk.send(self,"_visit_",[each]);
1754
- }),(function(){
1755
- return smalltalk.send(self["@stream"],"_nextPutAll_",[","]);
1756
- })]);
1757
- smalltalk.send(self["@stream"],"_nextPutAll_",["])"]);
1758
- return self},
1759
- args: ["aNode"],
1760
- source: "visitDynamicDictionaryNode: aNode\x0a\x09stream nextPutAll: 'smalltalk.HashedCollection._fromPairs_(['.\x0a\x09\x09aNode nodes \x0a\x09\x09\x09do: [:each | self visit: each]\x0a\x09\x09\x09separatedBy: [stream nextPutAll: ','].\x0a\x09\x09stream nextPutAll: '])'",
1761
- messageSends: ["nextPutAll:", "do:separatedBy:", "visit:", "nodes"],
1762
- referencedClasses: []
1763
- }),
1764
- smalltalk.FunCodeGenerator);
1765
-
1766
- smalltalk.addMethod(
1767
- "_visitFailure_",
1768
- smalltalk.method({
1769
- selector: "visitFailure:",
1770
- category: 'visiting',
1771
- fn: function (aFailure){
1772
- var self=this;
1773
- smalltalk.send(self,"_error_",[smalltalk.send(aFailure,"_asString",[])]);
1774
- return self},
1775
- args: ["aFailure"],
1776
- source: "visitFailure: aFailure\x0a\x09self error: aFailure asString",
1777
- messageSends: ["error:", "asString"],
1778
- referencedClasses: []
1779
- }),
1780
- smalltalk.FunCodeGenerator);
1781
-
1782
- smalltalk.addMethod(
1783
- "_visitJSStatementNode_",
1784
- smalltalk.method({
1785
- selector: "visitJSStatementNode:",
1786
- category: 'visiting',
1787
- fn: function (aNode){
1788
- var self=this;
1789
- smalltalk.send(self["@stream"],"_nextPutAll_",[smalltalk.send(aNode,"_source",[])]);
1790
- return self},
1791
- args: ["aNode"],
1792
- source: "visitJSStatementNode: aNode\x0a\x09stream nextPutAll: aNode source",
1793
- messageSends: ["nextPutAll:", "source"],
1794
- referencedClasses: []
1795
- }),
1796
- smalltalk.FunCodeGenerator);
1797
-
1798
- smalltalk.addMethod(
1799
- "_visitMethodNode_",
1800
- smalltalk.method({
1801
- selector: "visitMethodNode:",
1802
- category: 'visiting',
1803
- fn: function (aNode) {
1804
- var self=this;
1805
- var str=nil;
1806
- var currentSelector=nil;
1807
- (self['@currentSelector']=smalltalk.send(smalltalk.send(aNode, "_selector", []), "_asSelector", []));
1808
- (self['@nestedBlocks']=(0));
1809
- (self['@earlyReturn']=false);
1810
- (self['@messageSends']=[]);
1811
- (self['@referencedClasses']=[]);
1812
- (self['@unknownVariables']=[]);
1813
- (self['@tempVariables']=[]);
1814
- (self['@argVariables']=[]);
1815
- (function($rec){smalltalk.send($rec, "_nextPutAll_", ["smalltalk.method({"]);smalltalk.send($rec, "_lf", []);smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send("selector: \x22", "__comma", [smalltalk.send(aNode, "_selector", [])]), "__comma", ["\x22,"])]);return smalltalk.send($rec, "_lf", []);})(self['@stream']);
1816
- (function($rec){smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send("source: ", "__comma", [smalltalk.send(smalltalk.send(self, "_source", []), "_asJavascript", [])]), "__comma", [","])]);return smalltalk.send($rec, "_lf", []);})(self['@stream']);
1817
- smalltalk.send(self['@stream'], "_nextPutAll_", ["fn: function("]);
1818
- smalltalk.send(smalltalk.send(aNode, "_arguments", []), "_do_separatedBy_", [(function(each){smalltalk.send(self['@argVariables'], "_add_", [each]);return smalltalk.send(self['@stream'], "_nextPutAll_", [each]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [", "]);})]);
1819
- (function($rec){smalltalk.send($rec, "_nextPutAll_", ["){"]);smalltalk.send($rec, "_lf", []);smalltalk.send($rec, "_nextPutAll_", ["var self=this;"]);return smalltalk.send($rec, "_lf", []);})(self['@stream']);
1820
- (str=self['@stream']);
1821
- (self['@stream']=smalltalk.send("", "_writeStream", []));
1822
- smalltalk.send(smalltalk.send(aNode, "_nodes", []), "_do_", [(function(each){return smalltalk.send(self, "_visit_", [each]);})]);
1823
- ((($receiver = self['@earlyReturn']).klass === smalltalk.Boolean) ? ($receiver ? (function(){return (function($rec){smalltalk.send($rec, "_nextPutAll_", ["var $early={};"]);smalltalk.send($rec, "_lf", []);return smalltalk.send($rec, "_nextPutAll_", ["try{"]);})(str);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return (function($rec){smalltalk.send($rec, "_nextPutAll_", ["var $early={};"]);smalltalk.send($rec, "_lf", []);return smalltalk.send($rec, "_nextPutAll_", ["try{"]);})(str);})]));
1824
- smalltalk.send(str, "_nextPutAll_", [smalltalk.send(self['@stream'], "_contents", [])]);
1825
- (self['@stream']=str);
1826
- (function($rec){smalltalk.send($rec, "_lf", []);return smalltalk.send($rec, "_nextPutAll_", ["return self;"]);})(self['@stream']);
1827
- ((($receiver = self['@earlyReturn']).klass === smalltalk.Boolean) ? ($receiver ? (function(){return (function($rec){smalltalk.send($rec, "_lf", []);return smalltalk.send($rec, "_nextPutAll_", ["} catch(e) {if(e===$early)return e[0]; throw e}"]);})(self['@stream']);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return (function($rec){smalltalk.send($rec, "_lf", []);return smalltalk.send($rec, "_nextPutAll_", ["} catch(e) {if(e===$early)return e[0]; throw e}"]);})(self['@stream']);})]));
1828
- smalltalk.send(self['@stream'], "_nextPutAll_", ["}"]);
1829
- (function($rec){smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send(",", "__comma", [smalltalk.send((smalltalk.String || String), "_lf", [])]), "__comma", ["messageSends: "])]);smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send(self['@messageSends'], "_asJavascript", []), "__comma", [","])]);smalltalk.send($rec, "_lf", []);smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send("args: ", "__comma", [smalltalk.send(self['@argVariables'], "_asJavascript", [])]), "__comma", [","])]);smalltalk.send($rec, "_lf", []);return smalltalk.send($rec, "_nextPutAll_", ["referencedClasses: ["]);})(self['@stream']);
1830
- smalltalk.send(self['@referencedClasses'], "_do_separatedBy_", [(function(each){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(each, "_printString", [])]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [","]);})]);
1831
- smalltalk.send(self['@stream'], "_nextPutAll_", ["]"]);
1832
- smalltalk.send(self['@stream'], "_nextPutAll_", ["})"]);
1833
- return self;},
1834
- args: ["aNode"],
1835
- source: "visitMethodNode: aNode\x0a\x09| str currentSelector | \x0a\x09currentSelector := aNode selector asSelector.\x0a\x09nestedBlocks := 0.\x0a\x09earlyReturn := false.\x0a\x09messageSends := #().\x0a\x09referencedClasses := #().\x0a\x09unknownVariables := #().\x0a\x09tempVariables := #().\x0a\x09argVariables := #().\x0a\x09stream \x0a\x09 nextPutAll: 'smalltalk.method({'; lf;\x0a\x09 nextPutAll: 'selector: \x22', aNode selector, '\x22,'; lf.\x0a\x09stream nextPutAll: 'source: ', self source asJavascript, ',';lf.\x0a\x09stream nextPutAll: 'fn: function('.\x0a\x09aNode arguments \x0a\x09 do: [:each | \x0a\x09\x09argVariables add: each.\x0a\x09\x09stream nextPutAll: each]\x0a\x09 separatedBy: [stream nextPutAll: ', '].\x0a\x09stream \x0a\x09 nextPutAll: '){'; lf;\x0a\x09 nextPutAll: 'var self=this;'; lf.\x0a\x09str := stream.\x0a\x09stream := '' writeStream.\x0a\x09aNode nodes do: [:each |\x0a\x09 self visit: each].\x0a\x09earlyReturn ifTrue: [\x0a\x09 str nextPutAll: 'var $early={};'; lf; nextPutAll: 'try{'].\x0a\x09str nextPutAll: stream contents.\x0a\x09stream := str.\x0a\x09stream \x0a\x09 lf; \x0a\x09 nextPutAll: 'return self;'.\x0a\x09earlyReturn ifTrue: [\x0a\x09 stream lf; nextPutAll: '} catch(e) {if(e===$early)return e[0]; throw e}'].\x0a\x09stream nextPutAll: '}'.\x0a\x09stream \x0a\x09\x09nextPutAll: ',', String lf, 'messageSends: ';\x0a\x09\x09nextPutAll: messageSends asJavascript, ','; lf;\x0a \x09nextPutAll: 'args: ', argVariables asJavascript, ','; lf;\x0a\x09\x09nextPutAll: 'referencedClasses: ['.\x0a\x09referencedClasses \x0a\x09\x09do: [:each | stream nextPutAll: each printString]\x0a\x09\x09separatedBy: [stream nextPutAll: ','].\x0a\x09stream nextPutAll: ']'.\x0a\x09stream nextPutAll: '})'",
1836
- messageSends: ["asSelector", "selector", "nextPutAll:", "lf", ",", "asJavascript", "source", "do:separatedBy:", "arguments", "add:", "writeStream", "do:", "nodes", "visit:", "ifTrue:", "contents", "printString"],
1837
- referencedClasses: ["String"]
1838
- }),
1839
- smalltalk.FunCodeGenerator);
1840
-
1841
- smalltalk.addMethod(
1842
- "_visitReturnNode_",
1843
- smalltalk.method({
1844
- selector: "visitReturnNode:",
1845
- category: 'visiting',
1846
- fn: function (aNode) {
1847
- var self=this;
1848
- ((($receiver = ((($receiver = self['@nestedBlocks']).klass === smalltalk.Number) ? $receiver >(0) : smalltalk.send($receiver, "__gt", [(0)]))).klass === smalltalk.Boolean) ? ($receiver ? (function(){return (self['@earlyReturn']=true);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return (self['@earlyReturn']=true);})]));
1849
- ((($receiver = ((($receiver = self['@nestedBlocks']).klass === smalltalk.Number) ? $receiver >(0) : smalltalk.send($receiver, "__gt", [(0)]))).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", ["(function(){throw $early=["]);})() : (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", ["return "]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self['@stream'], "_nextPutAll_", ["(function(){throw $early=["]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", ["return "]);})]));
1850
- smalltalk.send(smalltalk.send(aNode, "_nodes", []), "_do_", [(function(each){return smalltalk.send(self, "_visit_", [each]);})]);
1851
- ((($receiver = ((($receiver = self['@nestedBlocks']).klass === smalltalk.Number) ? $receiver >(0) : smalltalk.send($receiver, "__gt", [(0)]))).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", ["]})()"]);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return smalltalk.send(self['@stream'], "_nextPutAll_", ["]})()"]);})]));
1852
- return self;},
1853
- args: ["aNode"],
1854
- source: "visitReturnNode: aNode\x0a\x09nestedBlocks > 0 ifTrue: [\x0a\x09 earlyReturn := true].\x0a\x09nestedBlocks > 0\x0a\x09 ifTrue: [\x0a\x09\x09stream\x0a\x09\x09 nextPutAll: '(function(){throw $early=[']\x0a\x09 ifFalse: [stream nextPutAll: 'return '].\x0a\x09aNode nodes do: [:each |\x0a\x09 self visit: each].\x0a\x09nestedBlocks > 0 ifTrue: [\x0a\x09 stream nextPutAll: ']})()']",
1855
- messageSends: ["ifTrue:", ">", "ifTrue:ifFalse:", "nextPutAll:", "do:", "nodes", "visit:"],
1856
- referencedClasses: []
1857
- }),
1858
- smalltalk.FunCodeGenerator);
1859
-
1860
- smalltalk.addMethod(
1861
- "_visitSendNode_",
1862
- smalltalk.method({
1863
- selector: "visitSendNode:",
1864
- category: 'visiting',
1865
- fn: function (aNode) {
1866
- var self=this;
1867
- var str=nil;
1868
- var receiver=nil;
1869
- var superSend=nil;
1870
- var inlined=nil;
1871
- (str=self['@stream']);
1872
- ((($receiver = smalltalk.send(self['@messageSends'], "_includes_", [smalltalk.send(aNode, "_selector", [])])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return smalltalk.send(self['@messageSends'], "_add_", [smalltalk.send(aNode, "_selector", [])]);})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return smalltalk.send(self['@messageSends'], "_add_", [smalltalk.send(aNode, "_selector", [])]);})]));
1873
- (self['@stream']=smalltalk.send("", "_writeStream", []));
1874
- smalltalk.send(self, "_visit_", [smalltalk.send(aNode, "_receiver", [])]);
1875
- (superSend=smalltalk.send(smalltalk.send(self['@stream'], "_contents", []), "__eq", ["super"]));
1876
- (receiver=((($receiver = superSend).klass === smalltalk.Boolean) ? ($receiver ? (function(){return "self";})() : (function(){return smalltalk.send(self['@stream'], "_contents", []);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return "self";}), (function(){return smalltalk.send(self['@stream'], "_contents", []);})])));
1877
- (self['@stream']=str);
1878
- ((($receiver = smalltalk.send(self, "_performOptimizations", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return ((($receiver = smalltalk.send(self, "_inlineLiteral_receiverNode_argumentNodes_", [smalltalk.send(aNode, "_selector", []), smalltalk.send(aNode, "_receiver", []), smalltalk.send(aNode, "_arguments", [])])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return ((($receiver = smalltalk.send(self, "_inline_receiver_argumentNodes_", [smalltalk.send(aNode, "_selector", []), receiver, smalltalk.send(aNode, "_arguments", [])])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(" : ", "__comma", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), "$receiver", smalltalk.send(aNode, "_arguments", []), superSend])]), "__comma", [")"])]);})() : (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), receiver, smalltalk.send(aNode, "_arguments", []), superSend])]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(" : ", "__comma", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), "$receiver", smalltalk.send(aNode, "_arguments", []), superSend])]), "__comma", [")"])]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), receiver, smalltalk.send(aNode, "_arguments", []), superSend])]);})]));})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return ((($receiver = smalltalk.send(self, "_inline_receiver_argumentNodes_", [smalltalk.send(aNode, "_selector", []), receiver, smalltalk.send(aNode, "_arguments", [])])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(" : ", "__comma", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), "$receiver", smalltalk.send(aNode, "_arguments", []), superSend])]), "__comma", [")"])]);})() : (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), receiver, smalltalk.send(aNode, "_arguments", []), superSend])]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(" : ", "__comma", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), "$receiver", smalltalk.send(aNode, "_arguments", []), superSend])]), "__comma", [")"])]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), receiver, smalltalk.send(aNode, "_arguments", []), superSend])]);})]));})]));})() : (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), receiver, smalltalk.send(aNode, "_arguments", []), superSend])]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return ((($receiver = smalltalk.send(self, "_inlineLiteral_receiverNode_argumentNodes_", [smalltalk.send(aNode, "_selector", []), smalltalk.send(aNode, "_receiver", []), smalltalk.send(aNode, "_arguments", [])])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return ((($receiver = smalltalk.send(self, "_inline_receiver_argumentNodes_", [smalltalk.send(aNode, "_selector", []), receiver, smalltalk.send(aNode, "_arguments", [])])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(" : ", "__comma", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), "$receiver", smalltalk.send(aNode, "_arguments", []), superSend])]), "__comma", [")"])]);})() : (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), receiver, smalltalk.send(aNode, "_arguments", []), superSend])]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(" : ", "__comma", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), "$receiver", smalltalk.send(aNode, "_arguments", []), superSend])]), "__comma", [")"])]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), receiver, smalltalk.send(aNode, "_arguments", []), superSend])]);})]));})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return ((($receiver = smalltalk.send(self, "_inline_receiver_argumentNodes_", [smalltalk.send(aNode, "_selector", []), receiver, smalltalk.send(aNode, "_arguments", [])])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(" : ", "__comma", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), "$receiver", smalltalk.send(aNode, "_arguments", []), superSend])]), "__comma", [")"])]);})() : (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), receiver, smalltalk.send(aNode, "_arguments", []), superSend])]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(" : ", "__comma", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), "$receiver", smalltalk.send(aNode, "_arguments", []), superSend])]), "__comma", [")"])]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), receiver, smalltalk.send(aNode, "_arguments", []), superSend])]);})]));})]));}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(self, "_send_to_arguments_superSend_", [smalltalk.send(aNode, "_selector", []), receiver, smalltalk.send(aNode, "_arguments", []), superSend])]);})]));
1879
- return self;},
1880
- args: ["aNode"],
1881
- source: "visitSendNode: aNode\x0a | str receiver superSend inlined |\x0a str := stream.\x0a (messageSends includes: aNode selector) ifFalse: [\x0a messageSends add: aNode selector].\x0a stream := '' writeStream.\x0a self visit: aNode receiver.\x0a superSend := stream contents = 'super'.\x0a receiver := superSend ifTrue: ['self'] ifFalse: [stream contents].\x0a stream := str.\x0a\x09\x0a\x09self performOptimizations \x0a\x09\x09ifTrue: [\x0a\x09\x09\x09(self inlineLiteral: aNode selector receiverNode: aNode receiver argumentNodes: aNode arguments) ifFalse: [\x0a\x09\x09\x09\x09(self inline: aNode selector receiver: receiver argumentNodes: aNode arguments)\x0a \x09\x09\x09ifTrue: [stream nextPutAll: ' : ', (self send: aNode selector to: '$receiver' arguments: aNode arguments superSend: superSend), ')']\x0a \x09\x09\x09ifFalse: [stream nextPutAll: (self send: aNode selector to: receiver arguments: aNode arguments superSend: superSend)]]]\x0a\x09\x09ifFalse: [stream nextPutAll: (self send: aNode selector to: receiver arguments: aNode arguments superSend: superSend)]",
1882
- messageSends: ["ifFalse:", "includes:", "selector", "add:", "writeStream", "visit:", "receiver", "=", "contents", "ifTrue:ifFalse:", "performOptimizations", "inlineLiteral:receiverNode:argumentNodes:", "arguments", "inline:receiver:argumentNodes:", "nextPutAll:", ",", "send:to:arguments:superSend:"],
1883
- referencedClasses: []
1884
- }),
1885
- smalltalk.FunCodeGenerator);
1886
-
1887
- smalltalk.addMethod(
1888
- "_visitSequenceNode_",
1889
- smalltalk.method({
1890
- selector: "visitSequenceNode:",
1891
- category: 'visiting',
1892
- fn: function (aNode) {
1893
- var self=this;
1894
- smalltalk.send(smalltalk.send(aNode, "_temps", []), "_do_", [(function(each){var temp=nil;
1895
- (temp=smalltalk.send(self, "_safeVariableNameFor_", [each]));smalltalk.send(self['@tempVariables'], "_add_", [temp]);return (function($rec){smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send("var ", "__comma", [temp]), "__comma", ["=nil;"])]);return smalltalk.send($rec, "_lf", []);})(self['@stream']);})]);
1896
- smalltalk.send(smalltalk.send(aNode, "_nodes", []), "_do_separatedBy_", [(function(each){smalltalk.send(self, "_visit_", [each]);return smalltalk.send(self['@stream'], "_nextPutAll_", [";"]);}), (function(){return smalltalk.send(self['@stream'], "_lf", []);})]);
1897
- return self;},
1898
- args: ["aNode"],
1899
- source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [:each || temp |\x0a temp := self safeVariableNameFor: each.\x0a\x09 tempVariables add: temp.\x0a\x09 stream nextPutAll: 'var ', temp, '=nil;'; lf].\x0a\x09aNode nodes do: [:each |\x0a\x09 self visit: each.\x0a\x09 stream nextPutAll: ';']\x0a\x09 separatedBy: [stream lf]",
1900
- messageSends: ["do:", "temps", "safeVariableNameFor:", "add:", "nextPutAll:", ",", "lf", "do:separatedBy:", "nodes", "visit:"],
1901
- referencedClasses: []
1902
- }),
1903
- smalltalk.FunCodeGenerator);
1904
-
1905
- smalltalk.addMethod(
1906
- "_visitValueNode_",
1907
- smalltalk.method({
1908
- selector: "visitValueNode:",
1909
- category: 'visiting',
1910
- fn: function (aNode) {
1911
- var self=this;
1912
- smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(aNode, "_value", []), "_asJavascript", [])]);
1913
- return self;},
1914
- args: ["aNode"],
1915
- source: "visitValueNode: aNode\x0a\x09stream nextPutAll: aNode value asJavascript",
1916
- messageSends: ["nextPutAll:", "asJavascript", "value"],
1917
- referencedClasses: []
1918
- }),
1919
- smalltalk.FunCodeGenerator);
1920
-
1921
- smalltalk.addMethod(
1922
- "_visitVariableNode_",
1923
- smalltalk.method({
1924
- selector: "visitVariableNode:",
1925
- category: 'visiting',
1926
- fn: function (aNode) {
1927
- var self=this;
1928
- var varName=nil;
1929
- ((($receiver = smalltalk.send(smalltalk.send(smalltalk.send(self, "_currentClass", []), "_allInstanceVariableNames", []), "_includes_", [smalltalk.send(aNode, "_value", [])])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send("self['@", "__comma", [smalltalk.send(aNode, "_value", [])]), "__comma", ["']"])]);})() : (function(){(varName=smalltalk.send(self, "_safeVariableNameFor_", [smalltalk.send(aNode, "_value", [])]));return ((($receiver = smalltalk.send(smalltalk.send(self, "_knownVariables", []), "_includes_", [varName])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){smalltalk.send(self['@unknownVariables'], "_add_", [smalltalk.send(aNode, "_value", [])]);return ((($receiver = smalltalk.send(aNode, "_assigned", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [varName]);})() : (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send("(typeof ", "__comma", [varName]), "__comma", [" == 'undefined' ? nil : "]), "__comma", [varName]), "__comma", [")"])]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [varName]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send("(typeof ", "__comma", [varName]), "__comma", [" == 'undefined' ? nil : "]), "__comma", [varName]), "__comma", [")"])]);})]));})() : (function(){return ((($receiver = smalltalk.send(smalltalk.send(aNode, "_value", []), "__eq", ["thisContext"])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", ["(smalltalk.getThisContext())"]);})() : (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [varName]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self['@stream'], "_nextPutAll_", ["(smalltalk.getThisContext())"]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [varName]);})]));})()) : smalltalk.send($receiver, "_ifFalse_ifTrue_", [(function(){smalltalk.send(self['@unknownVariables'], "_add_", [smalltalk.send(aNode, "_value", [])]);return ((($receiver = smalltalk.send(aNode, "_assigned", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [varName]);})() : (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send("(typeof ", "__comma", [varName]), "__comma", [" == 'undefined' ? nil : "]), "__comma", [varName]), "__comma", [")"])]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [varName]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send("(typeof ", "__comma", [varName]), "__comma", [" == 'undefined' ? nil : "]), "__comma", [varName]), "__comma", [")"])]);})]));}), (function(){return ((($receiver = smalltalk.send(smalltalk.send(aNode, "_value", []), "__eq", ["thisContext"])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", ["(smalltalk.getThisContext())"]);})() : (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [varName]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self['@stream'], "_nextPutAll_", ["(smalltalk.getThisContext())"]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [varName]);})]));})]));})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send("self['@", "__comma", [smalltalk.send(aNode, "_value", [])]), "__comma", ["']"])]);}), (function(){(varName=smalltalk.send(self, "_safeVariableNameFor_", [smalltalk.send(aNode, "_value", [])]));return ((($receiver = smalltalk.send(smalltalk.send(self, "_knownVariables", []), "_includes_", [varName])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){smalltalk.send(self['@unknownVariables'], "_add_", [smalltalk.send(aNode, "_value", [])]);return ((($receiver = smalltalk.send(aNode, "_assigned", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [varName]);})() : (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send("(typeof ", "__comma", [varName]), "__comma", [" == 'undefined' ? nil : "]), "__comma", [varName]), "__comma", [")"])]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [varName]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send("(typeof ", "__comma", [varName]), "__comma", [" == 'undefined' ? nil : "]), "__comma", [varName]), "__comma", [")"])]);})]));})() : (function(){return ((($receiver = smalltalk.send(smalltalk.send(aNode, "_value", []), "__eq", ["thisContext"])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", ["(smalltalk.getThisContext())"]);})() : (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [varName]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self['@stream'], "_nextPutAll_", ["(smalltalk.getThisContext())"]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [varName]);})]));})()) : smalltalk.send($receiver, "_ifFalse_ifTrue_", [(function(){smalltalk.send(self['@unknownVariables'], "_add_", [smalltalk.send(aNode, "_value", [])]);return ((($receiver = smalltalk.send(aNode, "_assigned", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [varName]);})() : (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send("(typeof ", "__comma", [varName]), "__comma", [" == 'undefined' ? nil : "]), "__comma", [varName]), "__comma", [")"])]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [varName]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send("(typeof ", "__comma", [varName]), "__comma", [" == 'undefined' ? nil : "]), "__comma", [varName]), "__comma", [")"])]);})]));}), (function(){return ((($receiver = smalltalk.send(smalltalk.send(aNode, "_value", []), "__eq", ["thisContext"])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", ["(smalltalk.getThisContext())"]);})() : (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [varName]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self['@stream'], "_nextPutAll_", ["(smalltalk.getThisContext())"]);}), (function(){return smalltalk.send(self['@stream'], "_nextPutAll_", [varName]);})]));})]));})]));
1930
- return self;},
1931
- args: ["aNode"],
1932
- source: "visitVariableNode: aNode\x0a\x09| varName |\x0a\x09(self currentClass allInstanceVariableNames includes: aNode value) \x0a\x09\x09ifTrue: [stream nextPutAll: 'self[''@', aNode value, ''']']\x0a\x09\x09ifFalse: [\x0a \x09varName := self safeVariableNameFor: aNode value.\x0a\x09\x09\x09(self knownVariables includes: varName) \x0a \x09\x09ifFalse: [\x0a \x09unknownVariables add: aNode value.\x0a \x09aNode assigned \x0a \x09\x09ifTrue: [stream nextPutAll: varName]\x0a \x09\x09ifFalse: [stream nextPutAll: '(typeof ', varName, ' == ''undefined'' ? nil : ', varName, ')']]\x0a \x09\x09ifTrue: [\x0a \x09aNode value = 'thisContext'\x0a \x09\x09ifTrue: [stream nextPutAll: '(smalltalk.getThisContext())']\x0a \x09\x09\x09\x09ifFalse: [stream nextPutAll: varName]]]",
1933
- messageSends: ["ifTrue:ifFalse:", "includes:", "allInstanceVariableNames", "currentClass", "value", "nextPutAll:", ",", "safeVariableNameFor:", "ifFalse:ifTrue:", "knownVariables", "add:", "assigned", "="],
1934
- referencedClasses: []
1935
- }),
1936
- smalltalk.FunCodeGenerator);
1937
-
1938
-
1939
- smalltalk.FunCodeGenerator.klass.iVarNames = ['performOptimizations'];
1940
- smalltalk.addMethod(
1941
- "_performOptimizations",
1942
- smalltalk.method({
1943
- selector: "performOptimizations",
1944
- category: 'accessing',
1945
- fn: function () {
1946
- var self=this;
1947
- return (($receiver = self['@performOptimizations']) == nil || $receiver == undefined) ? (function(){return true;})() : $receiver;
1948
- return self;},
1949
- args: [],
1950
- source: "performOptimizations\x0a\x09^performOptimizations ifNil: [true]",
1951
- messageSends: ["ifNil:"],
1952
- referencedClasses: []
1953
- }),
1954
- smalltalk.FunCodeGenerator.klass);
1955
-
1956
- smalltalk.addMethod(
1957
- "_performOptimizations_",
1958
- smalltalk.method({
1959
- selector: "performOptimizations:",
1960
- category: 'accessing',
1961
- fn: function (aBoolean) {
1962
- var self=this;
1963
- (self['@performOptimizations']=aBoolean);
1964
- return self;},
1965
- args: ["aBoolean"],
1966
- source: "performOptimizations: aBoolean\x0a\x09performOptimizations := aBoolean",
1967
- messageSends: [],
1968
- referencedClasses: []
1969
- }),
1970
- smalltalk.FunCodeGenerator.klass);
1971
-
1972
-