resin 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/amber/css/amber-normalize.css +73 -73
- data/amber/css/amber-normalize.less +1 -1
- data/amber/css/amber.css +106 -106
- data/amber/css/helios.css +242 -0
- data/amber/images/hsplitter.png +0 -0
- data/amber/images/vsplitter.png +0 -0
- data/amber/js/Benchfib.deploy.js +116 -38
- data/amber/js/Benchfib.js +120 -42
- data/amber/js/Canvas.deploy.js +674 -403
- data/amber/js/Canvas.js +682 -411
- data/amber/js/Compiler-AST.deploy.js +1150 -0
- data/amber/js/Compiler-AST.js +1591 -0
- data/amber/js/Compiler-Core.deploy.js +1562 -0
- data/amber/js/Compiler-Core.js +1972 -0
- data/amber/js/Compiler-Exceptions.deploy.js +114 -0
- data/amber/js/Compiler-Exceptions.js +161 -0
- data/amber/js/Compiler-IR.deploy.js +2326 -0
- data/amber/js/Compiler-IR.js +3146 -0
- data/amber/js/Compiler-Inlining.deploy.js +1147 -0
- data/amber/js/Compiler-Inlining.js +1514 -0
- data/amber/js/Compiler-Semantic.deploy.js +1207 -0
- data/amber/js/Compiler-Semantic.js +1628 -0
- data/amber/js/Compiler-Tests.deploy.js +646 -60
- data/amber/js/Compiler-Tests.js +843 -82
- data/amber/js/Compiler.deploy.js +1097 -159
- data/amber/js/Compiler.js +1414 -161
- data/amber/js/Examples.deploy.js +31 -15
- data/amber/js/Examples.js +33 -17
- data/amber/js/Helios-Announcements.deploy.js +127 -0
- data/amber/js/Helios-Announcements.js +157 -0
- data/amber/js/Helios-Browser.deploy.js +1473 -0
- data/amber/js/Helios-Browser.js +1953 -0
- data/amber/js/Helios-Commands.deploy.js +403 -0
- data/amber/js/Helios-Commands.js +563 -0
- data/amber/js/Helios-Core.deploy.js +1070 -0
- data/amber/js/Helios-Core.js +1445 -0
- data/amber/js/Helios-Environments.deploy.js +132 -0
- data/amber/js/Helios-Environments.js +179 -0
- data/amber/js/Helios-Inspector.deploy.js +855 -0
- data/amber/js/Helios-Inspector.js +1155 -0
- data/amber/js/Helios-KeyBindings.deploy.js +753 -0
- data/amber/js/Helios-KeyBindings.js +1023 -0
- data/amber/js/Helios-Layout.deploy.js +383 -0
- data/amber/js/Helios-Layout.js +523 -0
- data/amber/js/Helios-Workspace.deploy.js +799 -0
- data/amber/js/Helios-Workspace.js +1074 -0
- data/amber/js/IDE.deploy.js +2541 -1490
- data/amber/js/IDE.js +2721 -1660
- data/amber/js/Importer-Exporter.deploy.js +671 -0
- data/amber/js/Importer-Exporter.js +816 -0
- data/amber/js/Kernel-Announcements.deploy.js +137 -20
- data/amber/js/Kernel-Announcements.js +176 -22
- data/amber/js/Kernel-Classes.deploy.js +555 -168
- data/amber/js/Kernel-Classes.js +662 -205
- data/amber/js/Kernel-Collections.deploy.js +1403 -618
- data/amber/js/Kernel-Collections.js +1545 -690
- data/amber/js/Kernel-Exceptions.deploy.js +109 -45
- data/amber/js/Kernel-Exceptions.js +123 -49
- data/amber/js/Kernel-Methods.deploy.js +196 -81
- data/amber/js/Kernel-Methods.js +214 -89
- data/amber/js/Kernel-Objects.deploy.js +1542 -1117
- data/amber/js/Kernel-Objects.js +1593 -1148
- data/amber/js/Kernel-Tests.deploy.js +1725 -772
- data/amber/js/Kernel-Tests.js +2301 -1123
- data/amber/js/Kernel-Transcript.deploy.js +23 -25
- data/amber/js/Kernel-Transcript.js +24 -26
- data/amber/js/SUnit.deploy.js +204 -131
- data/amber/js/SUnit.js +222 -139
- data/amber/js/Spaces.deploy.js +240 -0
- data/amber/js/Spaces.js +326 -0
- data/amber/js/amber.js +26 -7
- data/amber/js/boot.js +65 -47
- data/amber/js/init.js +1 -1
- data/amber/js/lib/CodeMirror/amber.css +21 -21
- data/amber/js/lib/CodeMirror/codemirror.css +119 -13
- data/amber/js/lib/CodeMirror/codemirror.js +2219 -1220
- data/amber/js/lib/CodeMirror/smalltalk.js +134 -129
- data/amber/js/lib/bootstrap/css/bootstrap.css +5837 -0
- data/amber/js/lib/bootstrap/css/bootstrap.min.css +841 -0
- data/amber/js/lib/bootstrap/img/glyphicons-halflings-white.png +0 -0
- data/amber/js/lib/bootstrap/img/glyphicons-halflings.png +0 -0
- data/amber/js/lib/bootstrap/js/bootstrap.js +2038 -0
- data/amber/js/lib/bootstrap/js/bootstrap.min.js +7 -0
- data/amber/js/lib/jQuery/jquery-1.8.2.min.js +2 -0
- data/amber/js/lib/jQuery/jquery-ui-1.8.24.custom.min.js +125 -0
- data/amber/st/Compiler-AST.st +505 -0
- data/amber/st/Compiler-Core.st +835 -0
- data/amber/st/Compiler-Exceptions.st +87 -0
- data/amber/st/Compiler-IR.st +1097 -0
- data/amber/st/Compiler-Inlining.st +650 -0
- data/amber/st/Compiler-Semantic.st +558 -0
- data/amber/st/Compiler-Tests.st +285 -381
- data/amber/st/Compiler.st +725 -2
- data/amber/st/Helios-Announcements.st +104 -0
- data/amber/st/Helios-Browser.st +708 -0
- data/amber/st/Helios-Commands.st +223 -0
- data/amber/st/Helios-Core.st +532 -0
- data/amber/st/Helios-Environments.st +98 -0
- data/amber/st/Helios-Inspector.st +367 -0
- data/amber/st/Helios-KeyBindings.st +337 -0
- data/amber/st/Helios-Layout.st +199 -0
- data/amber/st/Helios-Workspace.st +367 -0
- data/amber/st/IDE.st +75 -53
- data/amber/st/Importer-Exporter.st +386 -0
- data/amber/st/Kernel-Announcements.st +92 -0
- data/amber/st/Kernel-Classes.st +137 -15
- data/amber/st/Kernel-Collections.st +137 -47
- data/amber/st/Kernel-Exceptions.st +14 -0
- data/amber/st/Kernel-Methods.st +9 -1
- data/amber/st/Kernel-Objects.st +29 -5
- data/amber/st/Kernel-Tests.st +545 -199
- data/amber/st/SUnit.st +10 -0
- data/amber/st/Spaces.st +142 -0
- data/lib/resin/app.rb +1 -1
- metadata +86 -31
- data/amber/js/lib/jQuery/jquery-1.4.4.min.js +0 -167
- data/amber/js/lib/jQuery/jquery-1.6.4.min.js +0 -4
@@ -0,0 +1,1972 @@
|
|
1
|
+
smalltalk.addPackage('Compiler-Core', {});
|
2
|
+
smalltalk.addClass('Compiler', smalltalk.Object, ['currentClass', 'source', 'unknownVariables', 'codeGeneratorClass'], 'Compiler-Core');
|
3
|
+
smalltalk.Compiler.comment="I provide the public interface for compiling Amber source code into JavaScript.\x0a\x0aThe code generator used to produce JavaScript can be plugged with `#codeGeneratorClass`. \x0aThe default code generator is an instance of `InlinedCodeGenerator`"
|
4
|
+
smalltalk.addMethod(
|
5
|
+
"_codeGeneratorClass",
|
6
|
+
smalltalk.method({
|
7
|
+
selector: "codeGeneratorClass",
|
8
|
+
category: 'accessing',
|
9
|
+
fn: function (){
|
10
|
+
var self=this;
|
11
|
+
var $1;
|
12
|
+
if(($receiver = self["@codeGeneratorClass"]) == nil || $receiver == undefined){
|
13
|
+
$1=(smalltalk.InliningCodeGenerator || InliningCodeGenerator);
|
14
|
+
} else {
|
15
|
+
$1=self["@codeGeneratorClass"];
|
16
|
+
};
|
17
|
+
return $1;
|
18
|
+
},
|
19
|
+
args: [],
|
20
|
+
source: "codeGeneratorClass\x0a\x09^codeGeneratorClass ifNil: [InliningCodeGenerator]",
|
21
|
+
messageSends: ["ifNil:"],
|
22
|
+
referencedClasses: ["InliningCodeGenerator"]
|
23
|
+
}),
|
24
|
+
smalltalk.Compiler);
|
25
|
+
|
26
|
+
smalltalk.addMethod(
|
27
|
+
"_codeGeneratorClass_",
|
28
|
+
smalltalk.method({
|
29
|
+
selector: "codeGeneratorClass:",
|
30
|
+
category: 'accessing',
|
31
|
+
fn: function (aClass){
|
32
|
+
var self=this;
|
33
|
+
self["@codeGeneratorClass"]=aClass;
|
34
|
+
return self},
|
35
|
+
args: ["aClass"],
|
36
|
+
source: "codeGeneratorClass: aClass\x0a\x09codeGeneratorClass := aClass",
|
37
|
+
messageSends: [],
|
38
|
+
referencedClasses: []
|
39
|
+
}),
|
40
|
+
smalltalk.Compiler);
|
41
|
+
|
42
|
+
smalltalk.addMethod(
|
43
|
+
"_compile_",
|
44
|
+
smalltalk.method({
|
45
|
+
selector: "compile:",
|
46
|
+
category: 'compiling',
|
47
|
+
fn: function (aString){
|
48
|
+
var self=this;
|
49
|
+
var $1;
|
50
|
+
$1=smalltalk.send(self,"_compileNode_",[smalltalk.send(self,"_parse_",[aString])]);
|
51
|
+
return $1;
|
52
|
+
},
|
53
|
+
args: ["aString"],
|
54
|
+
source: "compile: aString\x0a\x09^self compileNode: (self parse: aString)",
|
55
|
+
messageSends: ["compileNode:", "parse:"],
|
56
|
+
referencedClasses: []
|
57
|
+
}),
|
58
|
+
smalltalk.Compiler);
|
59
|
+
|
60
|
+
smalltalk.addMethod(
|
61
|
+
"_compile_forClass_",
|
62
|
+
smalltalk.method({
|
63
|
+
selector: "compile:forClass:",
|
64
|
+
category: 'compiling',
|
65
|
+
fn: function (aString,aClass){
|
66
|
+
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]);
|
71
|
+
return $1;
|
72
|
+
},
|
73
|
+
args: ["aString", "aClass"],
|
74
|
+
source: "compile: aString forClass: aClass\x0a\x09self currentClass: aClass.\x0a\x09self source: aString.\x0a\x09^self compile: aString",
|
75
|
+
messageSends: ["currentClass:", "source:", "compile:"],
|
76
|
+
referencedClasses: []
|
77
|
+
}),
|
78
|
+
smalltalk.Compiler);
|
79
|
+
|
80
|
+
smalltalk.addMethod(
|
81
|
+
"_compileExpression_",
|
82
|
+
smalltalk.method({
|
83
|
+
selector: "compileExpression:",
|
84
|
+
category: 'compiling',
|
85
|
+
fn: function (aString){
|
86
|
+
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",[])])]);
|
91
|
+
return $1;
|
92
|
+
},
|
93
|
+
args: ["aString"],
|
94
|
+
source: "compileExpression: aString\x0a\x09self currentClass: DoIt.\x0a\x09self source: 'doIt ^[', aString, '] value'.\x0a\x09^self compileNode: (self parse: self source)",
|
95
|
+
messageSends: ["currentClass:", "source:", ",", "compileNode:", "parse:", "source"],
|
96
|
+
referencedClasses: ["DoIt"]
|
97
|
+
}),
|
98
|
+
smalltalk.Compiler);
|
99
|
+
|
100
|
+
smalltalk.addMethod(
|
101
|
+
"_compileNode_",
|
102
|
+
smalltalk.method({
|
103
|
+
selector: "compileNode:",
|
104
|
+
category: 'compiling',
|
105
|
+
fn: function (aNode){
|
106
|
+
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
|
+
},
|
117
|
+
args: ["aNode"],
|
118
|
+
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
|
+
messageSends: ["new", "codeGeneratorClass", "source:", "source", "currentClass:", "currentClass", "compileNode:", "unknownVariables:"],
|
120
|
+
referencedClasses: []
|
121
|
+
}),
|
122
|
+
smalltalk.Compiler);
|
123
|
+
|
124
|
+
smalltalk.addMethod(
|
125
|
+
"_currentClass",
|
126
|
+
smalltalk.method({
|
127
|
+
selector: "currentClass",
|
128
|
+
category: 'accessing',
|
129
|
+
fn: function (){
|
130
|
+
var self=this;
|
131
|
+
return self["@currentClass"];
|
132
|
+
},
|
133
|
+
args: [],
|
134
|
+
source: "currentClass\x0a\x09^currentClass",
|
135
|
+
messageSends: [],
|
136
|
+
referencedClasses: []
|
137
|
+
}),
|
138
|
+
smalltalk.Compiler);
|
139
|
+
|
140
|
+
smalltalk.addMethod(
|
141
|
+
"_currentClass_",
|
142
|
+
smalltalk.method({
|
143
|
+
selector: "currentClass:",
|
144
|
+
category: 'accessing',
|
145
|
+
fn: function (aClass){
|
146
|
+
var self=this;
|
147
|
+
self["@currentClass"]=aClass;
|
148
|
+
return self},
|
149
|
+
args: ["aClass"],
|
150
|
+
source: "currentClass: aClass\x0a\x09currentClass := aClass",
|
151
|
+
messageSends: [],
|
152
|
+
referencedClasses: []
|
153
|
+
}),
|
154
|
+
smalltalk.Compiler);
|
155
|
+
|
156
|
+
smalltalk.addMethod(
|
157
|
+
"_eval_",
|
158
|
+
smalltalk.method({
|
159
|
+
selector: "eval:",
|
160
|
+
category: 'compiling',
|
161
|
+
fn: function (aString){
|
162
|
+
var self=this;
|
163
|
+
return eval(aString);
|
164
|
+
;
|
165
|
+
return self},
|
166
|
+
args: ["aString"],
|
167
|
+
source: "eval: aString\x0a\x09<return eval(aString)>",
|
168
|
+
messageSends: [],
|
169
|
+
referencedClasses: []
|
170
|
+
}),
|
171
|
+
smalltalk.Compiler);
|
172
|
+
|
173
|
+
smalltalk.addMethod(
|
174
|
+
"_evaluateExpression_",
|
175
|
+
smalltalk.method({
|
176
|
+
selector: "evaluateExpression:",
|
177
|
+
category: 'compiling',
|
178
|
+
fn: function (aString){
|
179
|
+
var self=this;
|
180
|
+
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
|
+
},
|
186
|
+
args: ["aString"],
|
187
|
+
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
|
+
messageSends: ["addCompiledMethod:", "eval:", "compileExpression:", "doIt", "new", "removeCompiledMethod:", "at:", "methodDictionary"],
|
189
|
+
referencedClasses: ["DoIt"]
|
190
|
+
}),
|
191
|
+
smalltalk.Compiler);
|
192
|
+
|
193
|
+
smalltalk.addMethod(
|
194
|
+
"_install_forClass_category_",
|
195
|
+
smalltalk.method({
|
196
|
+
selector: "install:forClass:category:",
|
197
|
+
category: 'compiling',
|
198
|
+
fn: function (aString,aBehavior,anotherString){
|
199
|
+
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
|
+
},
|
207
|
+
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: []
|
211
|
+
}),
|
212
|
+
smalltalk.Compiler);
|
213
|
+
|
214
|
+
smalltalk.addMethod(
|
215
|
+
"_parse_",
|
216
|
+
smalltalk.method({
|
217
|
+
selector: "parse:",
|
218
|
+
category: 'compiling',
|
219
|
+
fn: function (aString){
|
220
|
+
var self=this;
|
221
|
+
var $1;
|
222
|
+
$1=smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk),"_current",[]),"_parse_",[aString]);
|
223
|
+
return $1;
|
224
|
+
},
|
225
|
+
args: ["aString"],
|
226
|
+
source: "parse: aString\x0a ^Smalltalk current parse: aString",
|
227
|
+
messageSends: ["parse:", "current"],
|
228
|
+
referencedClasses: ["Smalltalk"]
|
229
|
+
}),
|
230
|
+
smalltalk.Compiler);
|
231
|
+
|
232
|
+
smalltalk.addMethod(
|
233
|
+
"_parseExpression_",
|
234
|
+
smalltalk.method({
|
235
|
+
selector: "parseExpression:",
|
236
|
+
category: 'compiling',
|
237
|
+
fn: function (aString){
|
238
|
+
var self=this;
|
239
|
+
var $1;
|
240
|
+
$1=smalltalk.send(self,"_parse_",[smalltalk.send(smalltalk.send("doIt ^[","__comma",[aString]),"__comma",["] value"])]);
|
241
|
+
return $1;
|
242
|
+
},
|
243
|
+
args: ["aString"],
|
244
|
+
source: "parseExpression: aString\x0a ^self parse: 'doIt ^[', aString, '] value'",
|
245
|
+
messageSends: ["parse:", ","],
|
246
|
+
referencedClasses: []
|
247
|
+
}),
|
248
|
+
smalltalk.Compiler);
|
249
|
+
|
250
|
+
smalltalk.addMethod(
|
251
|
+
"_recompile_",
|
252
|
+
smalltalk.method({
|
253
|
+
selector: "recompile:",
|
254
|
+
category: 'compiling',
|
255
|
+
fn: function (aClass){
|
256
|
+
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",[]);
|
264
|
+
if(! smalltalk.assert($1)){
|
265
|
+
smalltalk.send(self,"_recompile_",[smalltalk.send(aClass,"_class",[])]);
|
266
|
+
};
|
267
|
+
return self},
|
268
|
+
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"],
|
271
|
+
referencedClasses: []
|
272
|
+
}),
|
273
|
+
smalltalk.Compiler);
|
274
|
+
|
275
|
+
smalltalk.addMethod(
|
276
|
+
"_recompileAll",
|
277
|
+
smalltalk.method({
|
278
|
+
selector: "recompileAll",
|
279
|
+
category: 'compiling',
|
280
|
+
fn: function (){
|
281
|
+
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},
|
292
|
+
args: [],
|
293
|
+
source: "recompileAll\x0a\x09Smalltalk current classes do: [:each |\x0a\x09\x09Transcript show: each; cr.\x0a\x09\x09[self recompile: each] valueWithTimeout: 100]",
|
294
|
+
messageSends: ["do:", "show:", "cr", "valueWithTimeout:", "recompile:", "classes", "current"],
|
295
|
+
referencedClasses: ["Transcript", "Smalltalk"]
|
296
|
+
}),
|
297
|
+
smalltalk.Compiler);
|
298
|
+
|
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
|
+
smalltalk.addMethod(
|
317
|
+
"_source",
|
318
|
+
smalltalk.method({
|
319
|
+
selector: "source",
|
320
|
+
category: 'accessing',
|
321
|
+
fn: function (){
|
322
|
+
var self=this;
|
323
|
+
var $1;
|
324
|
+
if(($receiver = self["@source"]) == nil || $receiver == undefined){
|
325
|
+
$1="";
|
326
|
+
} else {
|
327
|
+
$1=self["@source"];
|
328
|
+
};
|
329
|
+
return $1;
|
330
|
+
},
|
331
|
+
args: [],
|
332
|
+
source: "source\x0a\x09^source ifNil: ['']",
|
333
|
+
messageSends: ["ifNil:"],
|
334
|
+
referencedClasses: []
|
335
|
+
}),
|
336
|
+
smalltalk.Compiler);
|
337
|
+
|
338
|
+
smalltalk.addMethod(
|
339
|
+
"_source_",
|
340
|
+
smalltalk.method({
|
341
|
+
selector: "source:",
|
342
|
+
category: 'accessing',
|
343
|
+
fn: function (aString){
|
344
|
+
var self=this;
|
345
|
+
self["@source"]=aString;
|
346
|
+
return self},
|
347
|
+
args: ["aString"],
|
348
|
+
source: "source: aString\x0a\x09source := aString",
|
349
|
+
messageSends: [],
|
350
|
+
referencedClasses: []
|
351
|
+
}),
|
352
|
+
smalltalk.Compiler);
|
353
|
+
|
354
|
+
smalltalk.addMethod(
|
355
|
+
"_unknownVariables",
|
356
|
+
smalltalk.method({
|
357
|
+
selector: "unknownVariables",
|
358
|
+
category: 'accessing',
|
359
|
+
fn: function (){
|
360
|
+
var self=this;
|
361
|
+
return self["@unknownVariables"];
|
362
|
+
},
|
363
|
+
args: [],
|
364
|
+
source: "unknownVariables\x0a\x09^unknownVariables",
|
365
|
+
messageSends: [],
|
366
|
+
referencedClasses: []
|
367
|
+
}),
|
368
|
+
smalltalk.Compiler);
|
369
|
+
|
370
|
+
smalltalk.addMethod(
|
371
|
+
"_unknownVariables_",
|
372
|
+
smalltalk.method({
|
373
|
+
selector: "unknownVariables:",
|
374
|
+
category: 'accessing',
|
375
|
+
fn: function (aCollection){
|
376
|
+
var self=this;
|
377
|
+
self["@unknownVariables"]=aCollection;
|
378
|
+
return self},
|
379
|
+
args: ["aCollection"],
|
380
|
+
source: "unknownVariables: aCollection\x0a\x09unknownVariables := aCollection",
|
381
|
+
messageSends: [],
|
382
|
+
referencedClasses: []
|
383
|
+
}),
|
384
|
+
smalltalk.Compiler);
|
385
|
+
|
386
|
+
|
387
|
+
smalltalk.addMethod(
|
388
|
+
"_recompile_",
|
389
|
+
smalltalk.method({
|
390
|
+
selector: "recompile:",
|
391
|
+
category: 'compiling',
|
392
|
+
fn: function (aClass){
|
393
|
+
var self=this;
|
394
|
+
smalltalk.send(smalltalk.send(self,"_new",[]),"_recompile_",[aClass]);
|
395
|
+
return self},
|
396
|
+
args: ["aClass"],
|
397
|
+
source: "recompile: aClass\x0a\x09self new recompile: aClass",
|
398
|
+
messageSends: ["recompile:", "new"],
|
399
|
+
referencedClasses: []
|
400
|
+
}),
|
401
|
+
smalltalk.Compiler.klass);
|
402
|
+
|
403
|
+
smalltalk.addMethod(
|
404
|
+
"_recompileAll",
|
405
|
+
smalltalk.method({
|
406
|
+
selector: "recompileAll",
|
407
|
+
category: 'compiling',
|
408
|
+
fn: function (){
|
409
|
+
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},
|
414
|
+
args: [],
|
415
|
+
source: "recompileAll\x0a\x09Smalltalk current classes do: [:each |\x0a\x09\x09self recompile: each]",
|
416
|
+
messageSends: ["do:", "recompile:", "classes", "current"],
|
417
|
+
referencedClasses: ["Smalltalk"]
|
418
|
+
}),
|
419
|
+
smalltalk.Compiler.klass);
|
420
|
+
|
421
|
+
|
422
|
+
smalltalk.addClass('DoIt', smalltalk.Object, [], 'Compiler-Core');
|
423
|
+
smalltalk.DoIt.comment="`DoIt` is the class used to compile and evaluate expressions. See `Compiler >> evaluateExpression:`."
|
424
|
+
|
425
|
+
|
426
|
+
smalltalk.addClass('NodeVisitor', smalltalk.Object, [], 'Compiler-Core');
|
427
|
+
smalltalk.NodeVisitor.comment="I am the abstract super class of all AST node visitors."
|
428
|
+
smalltalk.addMethod(
|
429
|
+
"_visit_",
|
430
|
+
smalltalk.method({
|
431
|
+
selector: "visit:",
|
432
|
+
category: 'visiting',
|
433
|
+
fn: function (aNode){
|
434
|
+
var self=this;
|
435
|
+
var $1;
|
436
|
+
$1=smalltalk.send(aNode,"_accept_",[self]);
|
437
|
+
return $1;
|
438
|
+
},
|
439
|
+
args: ["aNode"],
|
440
|
+
source: "visit: aNode\x0a\x09^ aNode accept: self",
|
441
|
+
messageSends: ["accept:"],
|
442
|
+
referencedClasses: []
|
443
|
+
}),
|
444
|
+
smalltalk.NodeVisitor);
|
445
|
+
|
446
|
+
smalltalk.addMethod(
|
447
|
+
"_visitAll_",
|
448
|
+
smalltalk.method({
|
449
|
+
selector: "visitAll:",
|
450
|
+
category: 'visiting',
|
451
|
+
fn: function (aCollection){
|
452
|
+
var self=this;
|
453
|
+
var $1;
|
454
|
+
$1=smalltalk.send(aCollection,"_do_",[(function(each){
|
455
|
+
return smalltalk.send(self,"_visit_",[each]);
|
456
|
+
})]);
|
457
|
+
return $1;
|
458
|
+
},
|
459
|
+
args: ["aCollection"],
|
460
|
+
source: "visitAll: aCollection\x0a\x09^ aCollection do: [ :each | self visit: each ]",
|
461
|
+
messageSends: ["do:", "visit:"],
|
462
|
+
referencedClasses: []
|
463
|
+
}),
|
464
|
+
smalltalk.NodeVisitor);
|
465
|
+
|
466
|
+
smalltalk.addMethod(
|
467
|
+
"_visitAssignmentNode_",
|
468
|
+
smalltalk.method({
|
469
|
+
selector: "visitAssignmentNode:",
|
470
|
+
category: 'visiting',
|
471
|
+
fn: function (aNode){
|
472
|
+
var self=this;
|
473
|
+
var $1;
|
474
|
+
$1=smalltalk.send(self,"_visitNode_",[aNode]);
|
475
|
+
return $1;
|
476
|
+
},
|
477
|
+
args: ["aNode"],
|
478
|
+
source: "visitAssignmentNode: aNode\x0a\x09^ self visitNode: aNode",
|
479
|
+
messageSends: ["visitNode:"],
|
480
|
+
referencedClasses: []
|
481
|
+
}),
|
482
|
+
smalltalk.NodeVisitor);
|
483
|
+
|
484
|
+
smalltalk.addMethod(
|
485
|
+
"_visitBlockNode_",
|
486
|
+
smalltalk.method({
|
487
|
+
selector: "visitBlockNode:",
|
488
|
+
category: 'visiting',
|
489
|
+
fn: function (aNode){
|
490
|
+
var self=this;
|
491
|
+
var $1;
|
492
|
+
$1=smalltalk.send(self,"_visitNode_",[aNode]);
|
493
|
+
return $1;
|
494
|
+
},
|
495
|
+
args: ["aNode"],
|
496
|
+
source: "visitBlockNode: aNode\x0a\x09^ self visitNode: aNode",
|
497
|
+
messageSends: ["visitNode:"],
|
498
|
+
referencedClasses: []
|
499
|
+
}),
|
500
|
+
smalltalk.NodeVisitor);
|
501
|
+
|
502
|
+
smalltalk.addMethod(
|
503
|
+
"_visitBlockSequenceNode_",
|
504
|
+
smalltalk.method({
|
505
|
+
selector: "visitBlockSequenceNode:",
|
506
|
+
category: 'visiting',
|
507
|
+
fn: function (aNode){
|
508
|
+
var self=this;
|
509
|
+
var $1;
|
510
|
+
$1=smalltalk.send(self,"_visitSequenceNode_",[aNode]);
|
511
|
+
return $1;
|
512
|
+
},
|
513
|
+
args: ["aNode"],
|
514
|
+
source: "visitBlockSequenceNode: aNode\x0a\x09^ self visitSequenceNode: aNode",
|
515
|
+
messageSends: ["visitSequenceNode:"],
|
516
|
+
referencedClasses: []
|
517
|
+
}),
|
518
|
+
smalltalk.NodeVisitor);
|
519
|
+
|
520
|
+
smalltalk.addMethod(
|
521
|
+
"_visitCascadeNode_",
|
522
|
+
smalltalk.method({
|
523
|
+
selector: "visitCascadeNode:",
|
524
|
+
category: 'visiting',
|
525
|
+
fn: function (aNode){
|
526
|
+
var self=this;
|
527
|
+
var $1;
|
528
|
+
$1=smalltalk.send(self,"_visitNode_",[aNode]);
|
529
|
+
return $1;
|
530
|
+
},
|
531
|
+
args: ["aNode"],
|
532
|
+
source: "visitCascadeNode: aNode\x0a\x09^ self visitNode: aNode",
|
533
|
+
messageSends: ["visitNode:"],
|
534
|
+
referencedClasses: []
|
535
|
+
}),
|
536
|
+
smalltalk.NodeVisitor);
|
537
|
+
|
538
|
+
smalltalk.addMethod(
|
539
|
+
"_visitClassReferenceNode_",
|
540
|
+
smalltalk.method({
|
541
|
+
selector: "visitClassReferenceNode:",
|
542
|
+
category: 'visiting',
|
543
|
+
fn: function (aNode){
|
544
|
+
var self=this;
|
545
|
+
var $1;
|
546
|
+
$1=smalltalk.send(self,"_visitVariableNode_",[aNode]);
|
547
|
+
return $1;
|
548
|
+
},
|
549
|
+
args: ["aNode"],
|
550
|
+
source: "visitClassReferenceNode: aNode\x0a\x09^ self visitVariableNode: aNode",
|
551
|
+
messageSends: ["visitVariableNode:"],
|
552
|
+
referencedClasses: []
|
553
|
+
}),
|
554
|
+
smalltalk.NodeVisitor);
|
555
|
+
|
556
|
+
smalltalk.addMethod(
|
557
|
+
"_visitDynamicArrayNode_",
|
558
|
+
smalltalk.method({
|
559
|
+
selector: "visitDynamicArrayNode:",
|
560
|
+
category: 'visiting',
|
561
|
+
fn: function (aNode){
|
562
|
+
var self=this;
|
563
|
+
var $1;
|
564
|
+
$1=smalltalk.send(self,"_visitNode_",[aNode]);
|
565
|
+
return $1;
|
566
|
+
},
|
567
|
+
args: ["aNode"],
|
568
|
+
source: "visitDynamicArrayNode: aNode\x0a\x09^ self visitNode: aNode",
|
569
|
+
messageSends: ["visitNode:"],
|
570
|
+
referencedClasses: []
|
571
|
+
}),
|
572
|
+
smalltalk.NodeVisitor);
|
573
|
+
|
574
|
+
smalltalk.addMethod(
|
575
|
+
"_visitDynamicDictionaryNode_",
|
576
|
+
smalltalk.method({
|
577
|
+
selector: "visitDynamicDictionaryNode:",
|
578
|
+
category: 'visiting',
|
579
|
+
fn: function (aNode){
|
580
|
+
var self=this;
|
581
|
+
var $1;
|
582
|
+
$1=smalltalk.send(self,"_visitNode_",[aNode]);
|
583
|
+
return $1;
|
584
|
+
},
|
585
|
+
args: ["aNode"],
|
586
|
+
source: "visitDynamicDictionaryNode: aNode\x0a\x09^ self visitNode: aNode",
|
587
|
+
messageSends: ["visitNode:"],
|
588
|
+
referencedClasses: []
|
589
|
+
}),
|
590
|
+
smalltalk.NodeVisitor);
|
591
|
+
|
592
|
+
smalltalk.addMethod(
|
593
|
+
"_visitJSStatementNode_",
|
594
|
+
smalltalk.method({
|
595
|
+
selector: "visitJSStatementNode:",
|
596
|
+
category: 'visiting',
|
597
|
+
fn: function (aNode){
|
598
|
+
var self=this;
|
599
|
+
var $1;
|
600
|
+
$1=smalltalk.send(self,"_visitNode_",[aNode]);
|
601
|
+
return $1;
|
602
|
+
},
|
603
|
+
args: ["aNode"],
|
604
|
+
source: "visitJSStatementNode: aNode\x0a\x09^ self visitNode: aNode",
|
605
|
+
messageSends: ["visitNode:"],
|
606
|
+
referencedClasses: []
|
607
|
+
}),
|
608
|
+
smalltalk.NodeVisitor);
|
609
|
+
|
610
|
+
smalltalk.addMethod(
|
611
|
+
"_visitMethodNode_",
|
612
|
+
smalltalk.method({
|
613
|
+
selector: "visitMethodNode:",
|
614
|
+
category: 'visiting',
|
615
|
+
fn: function (aNode){
|
616
|
+
var self=this;
|
617
|
+
var $1;
|
618
|
+
$1=smalltalk.send(self,"_visitNode_",[aNode]);
|
619
|
+
return $1;
|
620
|
+
},
|
621
|
+
args: ["aNode"],
|
622
|
+
source: "visitMethodNode: aNode\x0a\x09^ self visitNode: aNode",
|
623
|
+
messageSends: ["visitNode:"],
|
624
|
+
referencedClasses: []
|
625
|
+
}),
|
626
|
+
smalltalk.NodeVisitor);
|
627
|
+
|
628
|
+
smalltalk.addMethod(
|
629
|
+
"_visitNode_",
|
630
|
+
smalltalk.method({
|
631
|
+
selector: "visitNode:",
|
632
|
+
category: 'visiting',
|
633
|
+
fn: function (aNode){
|
634
|
+
var self=this;
|
635
|
+
var $1;
|
636
|
+
$1=smalltalk.send(self,"_visitAll_",[smalltalk.send(aNode,"_nodes",[])]);
|
637
|
+
return $1;
|
638
|
+
},
|
639
|
+
args: ["aNode"],
|
640
|
+
source: "visitNode: aNode\x0a\x09^ self visitAll: aNode nodes",
|
641
|
+
messageSends: ["visitAll:", "nodes"],
|
642
|
+
referencedClasses: []
|
643
|
+
}),
|
644
|
+
smalltalk.NodeVisitor);
|
645
|
+
|
646
|
+
smalltalk.addMethod(
|
647
|
+
"_visitReturnNode_",
|
648
|
+
smalltalk.method({
|
649
|
+
selector: "visitReturnNode:",
|
650
|
+
category: 'visiting',
|
651
|
+
fn: function (aNode){
|
652
|
+
var self=this;
|
653
|
+
var $1;
|
654
|
+
$1=smalltalk.send(self,"_visitNode_",[aNode]);
|
655
|
+
return $1;
|
656
|
+
},
|
657
|
+
args: ["aNode"],
|
658
|
+
source: "visitReturnNode: aNode\x0a\x09^ self visitNode: aNode",
|
659
|
+
messageSends: ["visitNode:"],
|
660
|
+
referencedClasses: []
|
661
|
+
}),
|
662
|
+
smalltalk.NodeVisitor);
|
663
|
+
|
664
|
+
smalltalk.addMethod(
|
665
|
+
"_visitSendNode_",
|
666
|
+
smalltalk.method({
|
667
|
+
selector: "visitSendNode:",
|
668
|
+
category: 'visiting',
|
669
|
+
fn: function (aNode){
|
670
|
+
var self=this;
|
671
|
+
var $1;
|
672
|
+
$1=smalltalk.send(self,"_visitNode_",[aNode]);
|
673
|
+
return $1;
|
674
|
+
},
|
675
|
+
args: ["aNode"],
|
676
|
+
source: "visitSendNode: aNode\x0a\x09^ self visitNode: aNode",
|
677
|
+
messageSends: ["visitNode:"],
|
678
|
+
referencedClasses: []
|
679
|
+
}),
|
680
|
+
smalltalk.NodeVisitor);
|
681
|
+
|
682
|
+
smalltalk.addMethod(
|
683
|
+
"_visitSequenceNode_",
|
684
|
+
smalltalk.method({
|
685
|
+
selector: "visitSequenceNode:",
|
686
|
+
category: 'visiting',
|
687
|
+
fn: function (aNode){
|
688
|
+
var self=this;
|
689
|
+
var $1;
|
690
|
+
$1=smalltalk.send(self,"_visitNode_",[aNode]);
|
691
|
+
return $1;
|
692
|
+
},
|
693
|
+
args: ["aNode"],
|
694
|
+
source: "visitSequenceNode: aNode\x0a\x09^ self visitNode: aNode",
|
695
|
+
messageSends: ["visitNode:"],
|
696
|
+
referencedClasses: []
|
697
|
+
}),
|
698
|
+
smalltalk.NodeVisitor);
|
699
|
+
|
700
|
+
smalltalk.addMethod(
|
701
|
+
"_visitValueNode_",
|
702
|
+
smalltalk.method({
|
703
|
+
selector: "visitValueNode:",
|
704
|
+
category: 'visiting',
|
705
|
+
fn: function (aNode){
|
706
|
+
var self=this;
|
707
|
+
var $1;
|
708
|
+
$1=smalltalk.send(self,"_visitNode_",[aNode]);
|
709
|
+
return $1;
|
710
|
+
},
|
711
|
+
args: ["aNode"],
|
712
|
+
source: "visitValueNode: aNode\x0a\x09^ self visitNode: aNode",
|
713
|
+
messageSends: ["visitNode:"],
|
714
|
+
referencedClasses: []
|
715
|
+
}),
|
716
|
+
smalltalk.NodeVisitor);
|
717
|
+
|
718
|
+
smalltalk.addMethod(
|
719
|
+
"_visitVariableNode_",
|
720
|
+
smalltalk.method({
|
721
|
+
selector: "visitVariableNode:",
|
722
|
+
category: 'visiting',
|
723
|
+
fn: function (aNode){
|
724
|
+
var self=this;
|
725
|
+
var $1;
|
726
|
+
$1=smalltalk.send(self,"_visitNode_",[aNode]);
|
727
|
+
return $1;
|
728
|
+
},
|
729
|
+
args: ["aNode"],
|
730
|
+
source: "visitVariableNode: aNode\x0a\x09^ self visitNode: aNode",
|
731
|
+
messageSends: ["visitNode:"],
|
732
|
+
referencedClasses: []
|
733
|
+
}),
|
734
|
+
smalltalk.NodeVisitor);
|
735
|
+
|
736
|
+
|
737
|
+
|
738
|
+
smalltalk.addClass('AbstractCodeGenerator', smalltalk.NodeVisitor, ['currentClass', 'source'], 'Compiler-Core');
|
739
|
+
smalltalk.AbstractCodeGenerator.comment="I am the abstract super class of all code generators and provide their common API."
|
740
|
+
smalltalk.addMethod(
|
741
|
+
"_classNameFor_",
|
742
|
+
smalltalk.method({
|
743
|
+
selector: "classNameFor:",
|
744
|
+
category: 'accessing',
|
745
|
+
fn: function (aClass){
|
746
|
+
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";
|
755
|
+
} else {
|
756
|
+
$1=smalltalk.send(aClass,"_name",[]);
|
757
|
+
};
|
758
|
+
};
|
759
|
+
return $1;
|
760
|
+
},
|
761
|
+
args: ["aClass"],
|
762
|
+
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
|
+
messageSends: ["ifTrue:ifFalse:", ",", "name", "instanceClass", "isNil", "isMetaclass"],
|
764
|
+
referencedClasses: []
|
765
|
+
}),
|
766
|
+
smalltalk.AbstractCodeGenerator);
|
767
|
+
|
768
|
+
smalltalk.addMethod(
|
769
|
+
"_compileNode_",
|
770
|
+
smalltalk.method({
|
771
|
+
selector: "compileNode:",
|
772
|
+
category: 'compiling',
|
773
|
+
fn: function (aNode){
|
774
|
+
var self=this;
|
775
|
+
smalltalk.send(self,"_subclassResponsibility",[]);
|
776
|
+
return self},
|
777
|
+
args: ["aNode"],
|
778
|
+
source: "compileNode: aNode\x0a\x09self subclassResponsibility",
|
779
|
+
messageSends: ["subclassResponsibility"],
|
780
|
+
referencedClasses: []
|
781
|
+
}),
|
782
|
+
smalltalk.AbstractCodeGenerator);
|
783
|
+
|
784
|
+
smalltalk.addMethod(
|
785
|
+
"_currentClass",
|
786
|
+
smalltalk.method({
|
787
|
+
selector: "currentClass",
|
788
|
+
category: 'accessing',
|
789
|
+
fn: function (){
|
790
|
+
var self=this;
|
791
|
+
return self["@currentClass"];
|
792
|
+
},
|
793
|
+
args: [],
|
794
|
+
source: "currentClass\x0a\x09^currentClass",
|
795
|
+
messageSends: [],
|
796
|
+
referencedClasses: []
|
797
|
+
}),
|
798
|
+
smalltalk.AbstractCodeGenerator);
|
799
|
+
|
800
|
+
smalltalk.addMethod(
|
801
|
+
"_currentClass_",
|
802
|
+
smalltalk.method({
|
803
|
+
selector: "currentClass:",
|
804
|
+
category: 'accessing',
|
805
|
+
fn: function (aClass){
|
806
|
+
var self=this;
|
807
|
+
self["@currentClass"]=aClass;
|
808
|
+
return self},
|
809
|
+
args: ["aClass"],
|
810
|
+
source: "currentClass: aClass\x0a\x09currentClass := aClass",
|
811
|
+
messageSends: [],
|
812
|
+
referencedClasses: []
|
813
|
+
}),
|
814
|
+
smalltalk.AbstractCodeGenerator);
|
815
|
+
|
816
|
+
smalltalk.addMethod(
|
817
|
+
"_pseudoVariables",
|
818
|
+
smalltalk.method({
|
819
|
+
selector: "pseudoVariables",
|
820
|
+
category: 'accessing',
|
821
|
+
fn: function (){
|
822
|
+
var self=this;
|
823
|
+
return ["self", "super", "true", "false", "nil", "thisContext"];
|
824
|
+
},
|
825
|
+
args: [],
|
826
|
+
source: "pseudoVariables\x0a\x09^#('self' 'super' 'true' 'false' 'nil' 'thisContext')",
|
827
|
+
messageSends: [],
|
828
|
+
referencedClasses: []
|
829
|
+
}),
|
830
|
+
smalltalk.AbstractCodeGenerator);
|
831
|
+
|
832
|
+
smalltalk.addMethod(
|
833
|
+
"_safeVariableNameFor_",
|
834
|
+
smalltalk.method({
|
835
|
+
selector: "safeVariableNameFor:",
|
836
|
+
category: 'accessing',
|
837
|
+
fn: function (aString){
|
838
|
+
var self=this;
|
839
|
+
var $2,$1;
|
840
|
+
$2=smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk),"_current",[]),"_reservedWords",[]),"_includes_",[aString]);
|
841
|
+
if(smalltalk.assert($2)){
|
842
|
+
$1=smalltalk.send(aString,"__comma",["_"]);
|
843
|
+
} else {
|
844
|
+
$1=aString;
|
845
|
+
};
|
846
|
+
return $1;
|
847
|
+
},
|
848
|
+
args: ["aString"],
|
849
|
+
source: "safeVariableNameFor: aString\x0a\x09^(Smalltalk current reservedWords includes: aString)\x0a\x09\x09ifTrue: [aString, '_']\x0a\x09\x09ifFalse: [aString]",
|
850
|
+
messageSends: ["ifTrue:ifFalse:", ",", "includes:", "reservedWords", "current"],
|
851
|
+
referencedClasses: ["Smalltalk"]
|
852
|
+
}),
|
853
|
+
smalltalk.AbstractCodeGenerator);
|
854
|
+
|
855
|
+
smalltalk.addMethod(
|
856
|
+
"_source",
|
857
|
+
smalltalk.method({
|
858
|
+
selector: "source",
|
859
|
+
category: 'accessing',
|
860
|
+
fn: function (){
|
861
|
+
var self=this;
|
862
|
+
var $1;
|
863
|
+
if(($receiver = self["@source"]) == nil || $receiver == undefined){
|
864
|
+
$1="";
|
865
|
+
} else {
|
866
|
+
$1=self["@source"];
|
867
|
+
};
|
868
|
+
return $1;
|
869
|
+
},
|
870
|
+
args: [],
|
871
|
+
source: "source\x0a\x09^source ifNil: ['']",
|
872
|
+
messageSends: ["ifNil:"],
|
873
|
+
referencedClasses: []
|
874
|
+
}),
|
875
|
+
smalltalk.AbstractCodeGenerator);
|
876
|
+
|
877
|
+
smalltalk.addMethod(
|
878
|
+
"_source_",
|
879
|
+
smalltalk.method({
|
880
|
+
selector: "source:",
|
881
|
+
category: 'accessing',
|
882
|
+
fn: function (aString){
|
883
|
+
var self=this;
|
884
|
+
self["@source"]=aString;
|
885
|
+
return self},
|
886
|
+
args: ["aString"],
|
887
|
+
source: "source: aString\x0a\x09source := aString",
|
888
|
+
messageSends: [],
|
889
|
+
referencedClasses: []
|
890
|
+
}),
|
891
|
+
smalltalk.AbstractCodeGenerator);
|
892
|
+
|
893
|
+
|
894
|
+
|
895
|
+
smalltalk.addClass('CodeGenerator', smalltalk.AbstractCodeGenerator, [], 'Compiler-Core');
|
896
|
+
smalltalk.CodeGenerator.comment="I am a basic code generator. I generate a valid JavaScript output, but no not perform any inlining.\x0aSee `InliningCodeGenerator` for an optimized JavaScript code generation."
|
897
|
+
smalltalk.addMethod(
|
898
|
+
"_compileNode_",
|
899
|
+
smalltalk.method({
|
900
|
+
selector: "compileNode:",
|
901
|
+
category: 'compiling',
|
902
|
+
fn: function (aNode){
|
903
|
+
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",[]);
|
912
|
+
$1=$3;
|
913
|
+
return $1;
|
914
|
+
},
|
915
|
+
args: ["aNode"],
|
916
|
+
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
|
+
messageSends: ["visit:", "semanticAnalyzer", "translator", "irTranslator", "contents"],
|
918
|
+
referencedClasses: []
|
919
|
+
}),
|
920
|
+
smalltalk.CodeGenerator);
|
921
|
+
|
922
|
+
smalltalk.addMethod(
|
923
|
+
"_irTranslator",
|
924
|
+
smalltalk.method({
|
925
|
+
selector: "irTranslator",
|
926
|
+
category: 'compiling',
|
927
|
+
fn: function (){
|
928
|
+
var self=this;
|
929
|
+
var $1;
|
930
|
+
$1=smalltalk.send((smalltalk.IRJSTranslator || IRJSTranslator),"_new",[]);
|
931
|
+
return $1;
|
932
|
+
},
|
933
|
+
args: [],
|
934
|
+
source: "irTranslator\x0a\x09^ IRJSTranslator new",
|
935
|
+
messageSends: ["new"],
|
936
|
+
referencedClasses: ["IRJSTranslator"]
|
937
|
+
}),
|
938
|
+
smalltalk.CodeGenerator);
|
939
|
+
|
940
|
+
smalltalk.addMethod(
|
941
|
+
"_semanticAnalyzer",
|
942
|
+
smalltalk.method({
|
943
|
+
selector: "semanticAnalyzer",
|
944
|
+
category: 'compiling',
|
945
|
+
fn: function (){
|
946
|
+
var self=this;
|
947
|
+
var $1;
|
948
|
+
$1=smalltalk.send((smalltalk.SemanticAnalyzer || SemanticAnalyzer),"_on_",[smalltalk.send(self,"_currentClass",[])]);
|
949
|
+
return $1;
|
950
|
+
},
|
951
|
+
args: [],
|
952
|
+
source: "semanticAnalyzer\x0a\x09^ SemanticAnalyzer on: self currentClass",
|
953
|
+
messageSends: ["on:", "currentClass"],
|
954
|
+
referencedClasses: ["SemanticAnalyzer"]
|
955
|
+
}),
|
956
|
+
smalltalk.CodeGenerator);
|
957
|
+
|
958
|
+
smalltalk.addMethod(
|
959
|
+
"_translator",
|
960
|
+
smalltalk.method({
|
961
|
+
selector: "translator",
|
962
|
+
category: 'compiling',
|
963
|
+
fn: function (){
|
964
|
+
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",[]);
|
970
|
+
$1=$3;
|
971
|
+
return $1;
|
972
|
+
},
|
973
|
+
args: [],
|
974
|
+
source: "translator\x0a\x09^ IRASTTranslator new\x0a\x09\x09source: self source;\x0a\x09\x09theClass: self currentClass;\x0a\x09\x09yourself",
|
975
|
+
messageSends: ["source:", "source", "new", "theClass:", "currentClass", "yourself"],
|
976
|
+
referencedClasses: ["IRASTTranslator"]
|
977
|
+
}),
|
978
|
+
smalltalk.CodeGenerator);
|
979
|
+
|
980
|
+
|
981
|
+
|
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
|
+
|