resin 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. data/amber/css/amber-normalize.css +73 -73
  2. data/amber/css/amber-normalize.less +1 -1
  3. data/amber/css/amber.css +106 -106
  4. data/amber/css/helios.css +242 -0
  5. data/amber/images/hsplitter.png +0 -0
  6. data/amber/images/vsplitter.png +0 -0
  7. data/amber/js/Benchfib.deploy.js +116 -38
  8. data/amber/js/Benchfib.js +120 -42
  9. data/amber/js/Canvas.deploy.js +674 -403
  10. data/amber/js/Canvas.js +682 -411
  11. data/amber/js/Compiler-AST.deploy.js +1150 -0
  12. data/amber/js/Compiler-AST.js +1591 -0
  13. data/amber/js/Compiler-Core.deploy.js +1562 -0
  14. data/amber/js/Compiler-Core.js +1972 -0
  15. data/amber/js/Compiler-Exceptions.deploy.js +114 -0
  16. data/amber/js/Compiler-Exceptions.js +161 -0
  17. data/amber/js/Compiler-IR.deploy.js +2326 -0
  18. data/amber/js/Compiler-IR.js +3146 -0
  19. data/amber/js/Compiler-Inlining.deploy.js +1147 -0
  20. data/amber/js/Compiler-Inlining.js +1514 -0
  21. data/amber/js/Compiler-Semantic.deploy.js +1207 -0
  22. data/amber/js/Compiler-Semantic.js +1628 -0
  23. data/amber/js/Compiler-Tests.deploy.js +646 -60
  24. data/amber/js/Compiler-Tests.js +843 -82
  25. data/amber/js/Compiler.deploy.js +1097 -159
  26. data/amber/js/Compiler.js +1414 -161
  27. data/amber/js/Examples.deploy.js +31 -15
  28. data/amber/js/Examples.js +33 -17
  29. data/amber/js/Helios-Announcements.deploy.js +127 -0
  30. data/amber/js/Helios-Announcements.js +157 -0
  31. data/amber/js/Helios-Browser.deploy.js +1473 -0
  32. data/amber/js/Helios-Browser.js +1953 -0
  33. data/amber/js/Helios-Commands.deploy.js +403 -0
  34. data/amber/js/Helios-Commands.js +563 -0
  35. data/amber/js/Helios-Core.deploy.js +1070 -0
  36. data/amber/js/Helios-Core.js +1445 -0
  37. data/amber/js/Helios-Environments.deploy.js +132 -0
  38. data/amber/js/Helios-Environments.js +179 -0
  39. data/amber/js/Helios-Inspector.deploy.js +855 -0
  40. data/amber/js/Helios-Inspector.js +1155 -0
  41. data/amber/js/Helios-KeyBindings.deploy.js +753 -0
  42. data/amber/js/Helios-KeyBindings.js +1023 -0
  43. data/amber/js/Helios-Layout.deploy.js +383 -0
  44. data/amber/js/Helios-Layout.js +523 -0
  45. data/amber/js/Helios-Workspace.deploy.js +799 -0
  46. data/amber/js/Helios-Workspace.js +1074 -0
  47. data/amber/js/IDE.deploy.js +2541 -1490
  48. data/amber/js/IDE.js +2721 -1660
  49. data/amber/js/Importer-Exporter.deploy.js +671 -0
  50. data/amber/js/Importer-Exporter.js +816 -0
  51. data/amber/js/Kernel-Announcements.deploy.js +137 -20
  52. data/amber/js/Kernel-Announcements.js +176 -22
  53. data/amber/js/Kernel-Classes.deploy.js +555 -168
  54. data/amber/js/Kernel-Classes.js +662 -205
  55. data/amber/js/Kernel-Collections.deploy.js +1403 -618
  56. data/amber/js/Kernel-Collections.js +1545 -690
  57. data/amber/js/Kernel-Exceptions.deploy.js +109 -45
  58. data/amber/js/Kernel-Exceptions.js +123 -49
  59. data/amber/js/Kernel-Methods.deploy.js +196 -81
  60. data/amber/js/Kernel-Methods.js +214 -89
  61. data/amber/js/Kernel-Objects.deploy.js +1542 -1117
  62. data/amber/js/Kernel-Objects.js +1593 -1148
  63. data/amber/js/Kernel-Tests.deploy.js +1725 -772
  64. data/amber/js/Kernel-Tests.js +2301 -1123
  65. data/amber/js/Kernel-Transcript.deploy.js +23 -25
  66. data/amber/js/Kernel-Transcript.js +24 -26
  67. data/amber/js/SUnit.deploy.js +204 -131
  68. data/amber/js/SUnit.js +222 -139
  69. data/amber/js/Spaces.deploy.js +240 -0
  70. data/amber/js/Spaces.js +326 -0
  71. data/amber/js/amber.js +26 -7
  72. data/amber/js/boot.js +65 -47
  73. data/amber/js/init.js +1 -1
  74. data/amber/js/lib/CodeMirror/amber.css +21 -21
  75. data/amber/js/lib/CodeMirror/codemirror.css +119 -13
  76. data/amber/js/lib/CodeMirror/codemirror.js +2219 -1220
  77. data/amber/js/lib/CodeMirror/smalltalk.js +134 -129
  78. data/amber/js/lib/bootstrap/css/bootstrap.css +5837 -0
  79. data/amber/js/lib/bootstrap/css/bootstrap.min.css +841 -0
  80. data/amber/js/lib/bootstrap/img/glyphicons-halflings-white.png +0 -0
  81. data/amber/js/lib/bootstrap/img/glyphicons-halflings.png +0 -0
  82. data/amber/js/lib/bootstrap/js/bootstrap.js +2038 -0
  83. data/amber/js/lib/bootstrap/js/bootstrap.min.js +7 -0
  84. data/amber/js/lib/jQuery/jquery-1.8.2.min.js +2 -0
  85. data/amber/js/lib/jQuery/jquery-ui-1.8.24.custom.min.js +125 -0
  86. data/amber/st/Compiler-AST.st +505 -0
  87. data/amber/st/Compiler-Core.st +835 -0
  88. data/amber/st/Compiler-Exceptions.st +87 -0
  89. data/amber/st/Compiler-IR.st +1097 -0
  90. data/amber/st/Compiler-Inlining.st +650 -0
  91. data/amber/st/Compiler-Semantic.st +558 -0
  92. data/amber/st/Compiler-Tests.st +285 -381
  93. data/amber/st/Compiler.st +725 -2
  94. data/amber/st/Helios-Announcements.st +104 -0
  95. data/amber/st/Helios-Browser.st +708 -0
  96. data/amber/st/Helios-Commands.st +223 -0
  97. data/amber/st/Helios-Core.st +532 -0
  98. data/amber/st/Helios-Environments.st +98 -0
  99. data/amber/st/Helios-Inspector.st +367 -0
  100. data/amber/st/Helios-KeyBindings.st +337 -0
  101. data/amber/st/Helios-Layout.st +199 -0
  102. data/amber/st/Helios-Workspace.st +367 -0
  103. data/amber/st/IDE.st +75 -53
  104. data/amber/st/Importer-Exporter.st +386 -0
  105. data/amber/st/Kernel-Announcements.st +92 -0
  106. data/amber/st/Kernel-Classes.st +137 -15
  107. data/amber/st/Kernel-Collections.st +137 -47
  108. data/amber/st/Kernel-Exceptions.st +14 -0
  109. data/amber/st/Kernel-Methods.st +9 -1
  110. data/amber/st/Kernel-Objects.st +29 -5
  111. data/amber/st/Kernel-Tests.st +545 -199
  112. data/amber/st/SUnit.st +10 -0
  113. data/amber/st/Spaces.st +142 -0
  114. data/lib/resin/app.rb +1 -1
  115. metadata +86 -31
  116. data/amber/js/lib/jQuery/jquery-1.4.4.min.js +0 -167
  117. data/amber/js/lib/jQuery/jquery-1.6.4.min.js +0 -4
@@ -0,0 +1,1628 @@
1
+ smalltalk.addPackage('Compiler-Semantic', {});
2
+ smalltalk.addClass('LexicalScope', smalltalk.Object, ['node', 'instruction', 'temps', 'args', 'outerScope'], 'Compiler-Semantic');
3
+ smalltalk.LexicalScope.comment="I represent a lexical scope where variable names are associated with ScopeVars\x0aInstances are used for block scopes. Method scopes are instances of MethodLexicalScope.\x0a\x0aI am attached to a ScopeVar and method/block nodes.\x0aEach context (method/closure) get a fresh scope that inherits from its outer scope."
4
+ smalltalk.addMethod(
5
+ "_addArg_",
6
+ smalltalk.method({
7
+ selector: "addArg:",
8
+ category: 'adding',
9
+ fn: function (aString) {
10
+ var self = this;
11
+ smalltalk.send(smalltalk.send(self, "_args", []), "_at_put_", [aString, smalltalk.send(smalltalk.ArgVar || ArgVar, "_on_", [aString])]);
12
+ smalltalk.send(smalltalk.send(smalltalk.send(self, "_args", []), "_at_", [aString]), "_scope_", [self]);
13
+ return self;
14
+ },
15
+ args: ["aString"],
16
+ source: "addArg: aString\x0a\x09self args at: aString put: (ArgVar on: aString).\x0a\x09(self args at: aString) scope: self",
17
+ messageSends: ["at:put:", "on:", "args", "scope:", "at:"],
18
+ referencedClasses: ["ArgVar"]
19
+ }),
20
+ smalltalk.LexicalScope);
21
+
22
+ smalltalk.addMethod(
23
+ "_addTemp_",
24
+ smalltalk.method({
25
+ selector: "addTemp:",
26
+ category: 'adding',
27
+ fn: function (aString) {
28
+ var self = this;
29
+ smalltalk.send(smalltalk.send(self, "_temps", []), "_at_put_", [aString, smalltalk.send(smalltalk.TempVar || TempVar, "_on_", [aString])]);
30
+ smalltalk.send(smalltalk.send(smalltalk.send(self, "_temps", []), "_at_", [aString]), "_scope_", [self]);
31
+ return self;
32
+ },
33
+ args: ["aString"],
34
+ source: "addTemp: aString\x0a\x09self temps at: aString put: (TempVar on: aString).\x0a\x09(self temps at: aString) scope: self",
35
+ messageSends: ["at:put:", "on:", "temps", "scope:", "at:"],
36
+ referencedClasses: ["TempVar"]
37
+ }),
38
+ smalltalk.LexicalScope);
39
+
40
+ smalltalk.addMethod(
41
+ "_allVariableNames",
42
+ smalltalk.method({
43
+ selector: "allVariableNames",
44
+ category: 'accessing',
45
+ fn: function () {
46
+ var self = this;
47
+ var $1;
48
+ $1 = smalltalk.send(smalltalk.send(smalltalk.send(self, "_args", []), "_keys", []), "__comma", [smalltalk.send(smalltalk.send(self, "_temps", []), "_keys", [])]);
49
+ return $1;
50
+ },
51
+ args: [],
52
+ source: "allVariableNames\x0a\x09^ self args keys, self temps keys",
53
+ messageSends: [",", "keys", "temps", "args"],
54
+ referencedClasses: []
55
+ }),
56
+ smalltalk.LexicalScope);
57
+
58
+ smalltalk.addMethod(
59
+ "_args",
60
+ smalltalk.method({
61
+ selector: "args",
62
+ category: 'accessing',
63
+ fn: function () {
64
+ var self = this;
65
+ var $1;
66
+ if (($receiver = self['@args']) == nil || $receiver == undefined) {
67
+ self['@args'] = smalltalk.send(smalltalk.Dictionary || Dictionary, "_new", []);
68
+ $1 = self['@args'];
69
+ } else {
70
+ $1 = self['@args'];
71
+ }
72
+ return $1;
73
+ },
74
+ args: [],
75
+ source: "args\x0a\x09^ args ifNil: [ args := Dictionary new ]",
76
+ messageSends: ["ifNil:", "new"],
77
+ referencedClasses: ["Dictionary"]
78
+ }),
79
+ smalltalk.LexicalScope);
80
+
81
+ smalltalk.addMethod(
82
+ "_bindingFor_",
83
+ smalltalk.method({
84
+ selector: "bindingFor:",
85
+ category: 'accessing',
86
+ fn: function (aStringOrNode) {
87
+ var self = this;
88
+ var $1;
89
+ $1 = smalltalk.send(smalltalk.send(self, "_pseudoVars", []), "_at_ifAbsent_", [smalltalk.send(aStringOrNode, "_value", []), function () {return smalltalk.send(smalltalk.send(self, "_args", []), "_at_ifAbsent_", [smalltalk.send(aStringOrNode, "_value", []), function () {return smalltalk.send(smalltalk.send(self, "_temps", []), "_at_ifAbsent_", [smalltalk.send(aStringOrNode, "_value", []), function () {return nil;}]);}]);}]);
90
+ return $1;
91
+ },
92
+ args: ["aStringOrNode"],
93
+ source: "bindingFor: aStringOrNode\x0a\x09^ self pseudoVars at: aStringOrNode value ifAbsent: [ \x0a\x09\x09self args at: aStringOrNode value ifAbsent: [\x0a\x09\x09\x09self temps at: aStringOrNode value ifAbsent: [ nil ]]]",
94
+ messageSends: ["at:ifAbsent:", "value", "temps", "args", "pseudoVars"],
95
+ referencedClasses: []
96
+ }),
97
+ smalltalk.LexicalScope);
98
+
99
+ smalltalk.addMethod(
100
+ "_canInlineNonLocalReturns",
101
+ smalltalk.method({
102
+ selector: "canInlineNonLocalReturns",
103
+ category: 'testing',
104
+ fn: function () {
105
+ var self = this;
106
+ var $1;
107
+ $1 = smalltalk.send(smalltalk.send(self, "_isInlined", []), "_and_", [function () {return smalltalk.send(smalltalk.send(self, "_outerScope", []), "_canInlineNonLocalReturns", []);}]);
108
+ return $1;
109
+ },
110
+ args: [],
111
+ source: "canInlineNonLocalReturns\x0a\x09^ self isInlined and: [ self outerScope canInlineNonLocalReturns ]",
112
+ messageSends: ["and:", "canInlineNonLocalReturns", "outerScope", "isInlined"],
113
+ referencedClasses: []
114
+ }),
115
+ smalltalk.LexicalScope);
116
+
117
+ smalltalk.addMethod(
118
+ "_instruction",
119
+ smalltalk.method({
120
+ selector: "instruction",
121
+ category: 'accessing',
122
+ fn: function () {
123
+ var self = this;
124
+ return self['@instruction'];
125
+ },
126
+ args: [],
127
+ source: "instruction\x0a\x09^ instruction",
128
+ messageSends: [],
129
+ referencedClasses: []
130
+ }),
131
+ smalltalk.LexicalScope);
132
+
133
+ smalltalk.addMethod(
134
+ "_instruction_",
135
+ smalltalk.method({
136
+ selector: "instruction:",
137
+ category: 'accessing',
138
+ fn: function (anIRInstruction) {
139
+ var self = this;
140
+ self['@instruction'] = anIRInstruction;
141
+ return self;
142
+ },
143
+ args: ["anIRInstruction"],
144
+ source: "instruction: anIRInstruction\x0a\x09instruction := anIRInstruction",
145
+ messageSends: [],
146
+ referencedClasses: []
147
+ }),
148
+ smalltalk.LexicalScope);
149
+
150
+ smalltalk.addMethod(
151
+ "_isBlockScope",
152
+ smalltalk.method({
153
+ selector: "isBlockScope",
154
+ category: 'testing',
155
+ fn: function () {
156
+ var self = this;
157
+ var $1;
158
+ $1 = smalltalk.send(smalltalk.send(self, "_isMethodScope", []), "_not", []);
159
+ return $1;
160
+ },
161
+ args: [],
162
+ source: "isBlockScope\x0a\x09^ self isMethodScope not",
163
+ messageSends: ["not", "isMethodScope"],
164
+ referencedClasses: []
165
+ }),
166
+ smalltalk.LexicalScope);
167
+
168
+ smalltalk.addMethod(
169
+ "_isInlined",
170
+ smalltalk.method({
171
+ selector: "isInlined",
172
+ category: 'testing',
173
+ fn: function () {
174
+ var self = this;
175
+ var $1;
176
+ $1 = smalltalk.send(smalltalk.send(self, "_instruction", []), "_isInlined", []);
177
+ return $1;
178
+ },
179
+ args: [],
180
+ source: "isInlined\x0a\x09^ self instruction isInlined",
181
+ messageSends: ["isInlined", "instruction"],
182
+ referencedClasses: []
183
+ }),
184
+ smalltalk.LexicalScope);
185
+
186
+ smalltalk.addMethod(
187
+ "_isMethodScope",
188
+ smalltalk.method({
189
+ selector: "isMethodScope",
190
+ category: 'testing',
191
+ fn: function () {
192
+ var self = this;
193
+ return false;
194
+ },
195
+ args: [],
196
+ source: "isMethodScope\x0a\x09^ false",
197
+ messageSends: [],
198
+ referencedClasses: []
199
+ }),
200
+ smalltalk.LexicalScope);
201
+
202
+ smalltalk.addMethod(
203
+ "_lookupVariable_",
204
+ smalltalk.method({
205
+ selector: "lookupVariable:",
206
+ category: 'accessing',
207
+ fn: function (aNode) {
208
+ var self = this;
209
+ var $1;
210
+ var lookup;
211
+ lookup = smalltalk.send(self, "_bindingFor_", [aNode]);
212
+ if (($receiver = lookup) == nil || $receiver == undefined) {
213
+ $1 = smalltalk.send(self, "_outerScope", []);
214
+ if (($receiver = $1) == nil || $receiver == undefined) {
215
+ lookup = $1;
216
+ } else {
217
+ lookup = smalltalk.send(smalltalk.send(self, "_outerScope", []), "_lookupVariable_", [aNode]);
218
+ }
219
+ } else {
220
+ }
221
+ return lookup;
222
+ },
223
+ args: ["aNode"],
224
+ source: "lookupVariable: aNode\x0a\x09| lookup |\x0a\x09lookup := (self bindingFor: aNode).\x0a\x09lookup ifNil: [\x0a\x09\x09lookup := self outerScope ifNotNil: [ \x0a\x09\x09\x09(self outerScope lookupVariable: aNode) ]].\x0a\x09^ lookup",
225
+ messageSends: ["bindingFor:", "ifNil:", "ifNotNil:", "lookupVariable:", "outerScope"],
226
+ referencedClasses: []
227
+ }),
228
+ smalltalk.LexicalScope);
229
+
230
+ smalltalk.addMethod(
231
+ "_methodScope",
232
+ smalltalk.method({
233
+ selector: "methodScope",
234
+ category: 'accessing',
235
+ fn: function () {
236
+ var self = this;
237
+ var $2, $1;
238
+ $2 = smalltalk.send(self, "_outerScope", []);
239
+ if (($receiver = $2) == nil || $receiver == undefined) {
240
+ $1 = $2;
241
+ } else {
242
+ $1 = smalltalk.send(smalltalk.send(self, "_outerScope", []), "_methodScope", []);
243
+ }
244
+ return $1;
245
+ },
246
+ args: [],
247
+ source: "methodScope\x0a\x09^ self outerScope ifNotNil: [\x0a\x09\x09self outerScope methodScope ]",
248
+ messageSends: ["ifNotNil:", "methodScope", "outerScope"],
249
+ referencedClasses: []
250
+ }),
251
+ smalltalk.LexicalScope);
252
+
253
+ smalltalk.addMethod(
254
+ "_node",
255
+ smalltalk.method({
256
+ selector: "node",
257
+ category: 'accessing',
258
+ fn: function () {
259
+ var self = this;
260
+ return self['@node'];
261
+ },
262
+ args: [],
263
+ source: "node\x0a\x09\x22Answer the node in which I am defined\x22\x0a\x09\x0a\x09^ node",
264
+ messageSends: [],
265
+ referencedClasses: []
266
+ }),
267
+ smalltalk.LexicalScope);
268
+
269
+ smalltalk.addMethod(
270
+ "_node_",
271
+ smalltalk.method({
272
+ selector: "node:",
273
+ category: 'accessing',
274
+ fn: function (aNode) {
275
+ var self = this;
276
+ self['@node'] = aNode;
277
+ return self;
278
+ },
279
+ args: ["aNode"],
280
+ source: "node: aNode\x0a\x09node := aNode",
281
+ messageSends: [],
282
+ referencedClasses: []
283
+ }),
284
+ smalltalk.LexicalScope);
285
+
286
+ smalltalk.addMethod(
287
+ "_outerScope",
288
+ smalltalk.method({
289
+ selector: "outerScope",
290
+ category: 'accessing',
291
+ fn: function () {
292
+ var self = this;
293
+ return self['@outerScope'];
294
+ },
295
+ args: [],
296
+ source: "outerScope\x0a\x09^ outerScope",
297
+ messageSends: [],
298
+ referencedClasses: []
299
+ }),
300
+ smalltalk.LexicalScope);
301
+
302
+ smalltalk.addMethod(
303
+ "_outerScope_",
304
+ smalltalk.method({
305
+ selector: "outerScope:",
306
+ category: 'accessing',
307
+ fn: function (aLexicalScope) {
308
+ var self = this;
309
+ self['@outerScope'] = aLexicalScope;
310
+ return self;
311
+ },
312
+ args: ["aLexicalScope"],
313
+ source: "outerScope: aLexicalScope\x0a\x09outerScope := aLexicalScope",
314
+ messageSends: [],
315
+ referencedClasses: []
316
+ }),
317
+ smalltalk.LexicalScope);
318
+
319
+ smalltalk.addMethod(
320
+ "_pseudoVars",
321
+ smalltalk.method({
322
+ selector: "pseudoVars",
323
+ category: 'accessing',
324
+ fn: function () {
325
+ var self = this;
326
+ var $1;
327
+ $1 = smalltalk.send(smalltalk.send(self, "_methodScope", []), "_pseudoVars", []);
328
+ return $1;
329
+ },
330
+ args: [],
331
+ source: "pseudoVars\x0a\x09^ self methodScope pseudoVars",
332
+ messageSends: ["pseudoVars", "methodScope"],
333
+ referencedClasses: []
334
+ }),
335
+ smalltalk.LexicalScope);
336
+
337
+ smalltalk.addMethod(
338
+ "_scopeLevel",
339
+ smalltalk.method({
340
+ selector: "scopeLevel",
341
+ category: 'accessing',
342
+ fn: function () {
343
+ var self = this;
344
+ var $3, $2, $1;
345
+ $3 = smalltalk.send(self, "_outerScope", []);
346
+ if (($receiver = $3) == nil || $receiver == undefined) {
347
+ $2 = 0;
348
+ } else {
349
+ $2 = smalltalk.send(smalltalk.send(self, "_outerScope", []), "_scopeLevel", []);
350
+ }
351
+ $1 = smalltalk.send($2, "__plus", [1]);
352
+ return $1;
353
+ },
354
+ args: [],
355
+ source: "scopeLevel\x0a\x09^ (self outerScope \x0a\x09\x09ifNil: [ 0 ]\x0a\x09\x09ifNotNil: [ self outerScope scopeLevel ]) + 1",
356
+ messageSends: ["+", "ifNil:ifNotNil:", "scopeLevel", "outerScope"],
357
+ referencedClasses: []
358
+ }),
359
+ smalltalk.LexicalScope);
360
+
361
+ smalltalk.addMethod(
362
+ "_temps",
363
+ smalltalk.method({
364
+ selector: "temps",
365
+ category: 'accessing',
366
+ fn: function () {
367
+ var self = this;
368
+ var $1;
369
+ if (($receiver = self['@temps']) == nil || $receiver == undefined) {
370
+ self['@temps'] = smalltalk.send(smalltalk.Dictionary || Dictionary, "_new", []);
371
+ $1 = self['@temps'];
372
+ } else {
373
+ $1 = self['@temps'];
374
+ }
375
+ return $1;
376
+ },
377
+ args: [],
378
+ source: "temps\x0a\x09^ temps ifNil: [ temps := Dictionary new ]",
379
+ messageSends: ["ifNil:", "new"],
380
+ referencedClasses: ["Dictionary"]
381
+ }),
382
+ smalltalk.LexicalScope);
383
+
384
+
385
+
386
+ smalltalk.addClass('MethodLexicalScope', smalltalk.LexicalScope, ['iVars', 'pseudoVars', 'unknownVariables', 'localReturn', 'nonLocalReturns'], 'Compiler-Semantic');
387
+ smalltalk.MethodLexicalScope.comment="I represent a method scope."
388
+ smalltalk.addMethod(
389
+ "_addIVar_",
390
+ smalltalk.method({
391
+ selector: "addIVar:",
392
+ category: 'adding',
393
+ fn: function (aString) {
394
+ var self = this;
395
+ smalltalk.send(smalltalk.send(self, "_iVars", []), "_at_put_", [aString, smalltalk.send(smalltalk.InstanceVar || InstanceVar, "_on_", [aString])]);
396
+ smalltalk.send(smalltalk.send(smalltalk.send(self, "_iVars", []), "_at_", [aString]), "_scope_", [self]);
397
+ return self;
398
+ },
399
+ args: ["aString"],
400
+ source: "addIVar: aString\x0a\x09self iVars at: aString put: (InstanceVar on: aString).\x0a\x09(self iVars at: aString) scope: self",
401
+ messageSends: ["at:put:", "on:", "iVars", "scope:", "at:"],
402
+ referencedClasses: ["InstanceVar"]
403
+ }),
404
+ smalltalk.MethodLexicalScope);
405
+
406
+ smalltalk.addMethod(
407
+ "_addNonLocalReturn_",
408
+ smalltalk.method({
409
+ selector: "addNonLocalReturn:",
410
+ category: 'adding',
411
+ fn: function (aScope) {
412
+ var self = this;
413
+ smalltalk.send(smalltalk.send(self, "_nonLocalReturns", []), "_add_", [aScope]);
414
+ return self;
415
+ },
416
+ args: ["aScope"],
417
+ source: "addNonLocalReturn: aScope\x0a\x09self nonLocalReturns add: aScope",
418
+ messageSends: ["add:", "nonLocalReturns"],
419
+ referencedClasses: []
420
+ }),
421
+ smalltalk.MethodLexicalScope);
422
+
423
+ smalltalk.addMethod(
424
+ "_allVariableNames",
425
+ smalltalk.method({
426
+ selector: "allVariableNames",
427
+ category: 'accessing',
428
+ fn: function () {
429
+ var self = this;
430
+ var $1;
431
+ $1 = smalltalk.send(smalltalk.send(self, "_allVariableNames", [], smalltalk.LexicalScope), "__comma", [smalltalk.send(smalltalk.send(self, "_iVars", []), "_keys", [])]);
432
+ return $1;
433
+ },
434
+ args: [],
435
+ source: "allVariableNames\x0a\x09^ super allVariableNames, self iVars keys",
436
+ messageSends: [",", "keys", "iVars", "allVariableNames"],
437
+ referencedClasses: []
438
+ }),
439
+ smalltalk.MethodLexicalScope);
440
+
441
+ smalltalk.addMethod(
442
+ "_bindingFor_",
443
+ smalltalk.method({
444
+ selector: "bindingFor:",
445
+ category: 'accessing',
446
+ fn: function (aNode) {
447
+ var self = this;
448
+ var $2, $1;
449
+ $2 = smalltalk.send(self, "_bindingFor_", [aNode], smalltalk.LexicalScope);
450
+ if (($receiver = $2) == nil || $receiver == undefined) {
451
+ $1 = smalltalk.send(smalltalk.send(self, "_iVars", []), "_at_ifAbsent_", [smalltalk.send(aNode, "_value", []), function () {return nil;}]);
452
+ } else {
453
+ $1 = $2;
454
+ }
455
+ return $1;
456
+ },
457
+ args: ["aNode"],
458
+ source: "bindingFor: aNode\x0a\x09^ (super bindingFor: aNode) ifNil: [\x0a\x09\x09self iVars at: aNode value ifAbsent: [ nil ]]",
459
+ messageSends: ["ifNil:", "at:ifAbsent:", "value", "iVars", "bindingFor:"],
460
+ referencedClasses: []
461
+ }),
462
+ smalltalk.MethodLexicalScope);
463
+
464
+ smalltalk.addMethod(
465
+ "_canInlineNonLocalReturns",
466
+ smalltalk.method({
467
+ selector: "canInlineNonLocalReturns",
468
+ category: 'testing',
469
+ fn: function () {
470
+ var self = this;
471
+ return true;
472
+ },
473
+ args: [],
474
+ source: "canInlineNonLocalReturns\x0a\x09^ true",
475
+ messageSends: [],
476
+ referencedClasses: []
477
+ }),
478
+ smalltalk.MethodLexicalScope);
479
+
480
+ smalltalk.addMethod(
481
+ "_hasLocalReturn",
482
+ smalltalk.method({
483
+ selector: "hasLocalReturn",
484
+ category: 'testing',
485
+ fn: function () {
486
+ var self = this;
487
+ var $1;
488
+ $1 = smalltalk.send(self, "_localReturn", []);
489
+ return $1;
490
+ },
491
+ args: [],
492
+ source: "hasLocalReturn\x0a\x09^ self localReturn",
493
+ messageSends: ["localReturn"],
494
+ referencedClasses: []
495
+ }),
496
+ smalltalk.MethodLexicalScope);
497
+
498
+ smalltalk.addMethod(
499
+ "_hasNonLocalReturn",
500
+ smalltalk.method({
501
+ selector: "hasNonLocalReturn",
502
+ category: 'testing',
503
+ fn: function () {
504
+ var self = this;
505
+ var $1;
506
+ $1 = smalltalk.send(smalltalk.send(self, "_nonLocalReturns", []), "_notEmpty", []);
507
+ return $1;
508
+ },
509
+ args: [],
510
+ source: "hasNonLocalReturn\x0a\x09^ self nonLocalReturns notEmpty",
511
+ messageSends: ["notEmpty", "nonLocalReturns"],
512
+ referencedClasses: []
513
+ }),
514
+ smalltalk.MethodLexicalScope);
515
+
516
+ smalltalk.addMethod(
517
+ "_iVars",
518
+ smalltalk.method({
519
+ selector: "iVars",
520
+ category: 'accessing',
521
+ fn: function () {
522
+ var self = this;
523
+ var $1;
524
+ if (($receiver = self['@iVars']) == nil || $receiver == undefined) {
525
+ self['@iVars'] = smalltalk.send(smalltalk.Dictionary || Dictionary, "_new", []);
526
+ $1 = self['@iVars'];
527
+ } else {
528
+ $1 = self['@iVars'];
529
+ }
530
+ return $1;
531
+ },
532
+ args: [],
533
+ source: "iVars\x0a\x09^ iVars ifNil: [ iVars := Dictionary new ]",
534
+ messageSends: ["ifNil:", "new"],
535
+ referencedClasses: ["Dictionary"]
536
+ }),
537
+ smalltalk.MethodLexicalScope);
538
+
539
+ smalltalk.addMethod(
540
+ "_isMethodScope",
541
+ smalltalk.method({
542
+ selector: "isMethodScope",
543
+ category: 'testing',
544
+ fn: function () {
545
+ var self = this;
546
+ return true;
547
+ },
548
+ args: [],
549
+ source: "isMethodScope\x0a\x09^ true",
550
+ messageSends: [],
551
+ referencedClasses: []
552
+ }),
553
+ smalltalk.MethodLexicalScope);
554
+
555
+ smalltalk.addMethod(
556
+ "_localReturn",
557
+ smalltalk.method({
558
+ selector: "localReturn",
559
+ category: 'accessing',
560
+ fn: function () {
561
+ var self = this;
562
+ var $1;
563
+ if (($receiver = self['@localReturn']) == nil || $receiver == undefined) {
564
+ $1 = false;
565
+ } else {
566
+ $1 = self['@localReturn'];
567
+ }
568
+ return $1;
569
+ },
570
+ args: [],
571
+ source: "localReturn\x0a\x09^ localReturn ifNil: [ false ]",
572
+ messageSends: ["ifNil:"],
573
+ referencedClasses: []
574
+ }),
575
+ smalltalk.MethodLexicalScope);
576
+
577
+ smalltalk.addMethod(
578
+ "_localReturn_",
579
+ smalltalk.method({
580
+ selector: "localReturn:",
581
+ category: 'accessing',
582
+ fn: function (aBoolean) {
583
+ var self = this;
584
+ self['@localReturn'] = aBoolean;
585
+ return self;
586
+ },
587
+ args: ["aBoolean"],
588
+ source: "localReturn: aBoolean\x0a\x09localReturn := aBoolean",
589
+ messageSends: [],
590
+ referencedClasses: []
591
+ }),
592
+ smalltalk.MethodLexicalScope);
593
+
594
+ smalltalk.addMethod(
595
+ "_methodScope",
596
+ smalltalk.method({
597
+ selector: "methodScope",
598
+ category: 'accessing',
599
+ fn: function () {
600
+ var self = this;
601
+ return self;
602
+ },
603
+ args: [],
604
+ source: "methodScope\x0a\x09^ self",
605
+ messageSends: [],
606
+ referencedClasses: []
607
+ }),
608
+ smalltalk.MethodLexicalScope);
609
+
610
+ smalltalk.addMethod(
611
+ "_nonLocalReturns",
612
+ smalltalk.method({
613
+ selector: "nonLocalReturns",
614
+ category: 'accessing',
615
+ fn: function () {
616
+ var self = this;
617
+ var $1;
618
+ if (($receiver = self['@nonLocalReturns']) == nil ||
619
+ $receiver == undefined) {
620
+ self['@nonLocalReturns'] = smalltalk.send(smalltalk.OrderedCollection || OrderedCollection, "_new", []);
621
+ $1 = self['@nonLocalReturns'];
622
+ } else {
623
+ $1 = self['@nonLocalReturns'];
624
+ }
625
+ return $1;
626
+ },
627
+ args: [],
628
+ source: "nonLocalReturns\x0a\x09^ nonLocalReturns ifNil: [ nonLocalReturns := OrderedCollection new ]",
629
+ messageSends: ["ifNil:", "new"],
630
+ referencedClasses: ["OrderedCollection"]
631
+ }),
632
+ smalltalk.MethodLexicalScope);
633
+
634
+ smalltalk.addMethod(
635
+ "_pseudoVars",
636
+ smalltalk.method({
637
+ selector: "pseudoVars",
638
+ category: 'accessing',
639
+ fn: function () {
640
+ var self = this;
641
+ var $1, $2;
642
+ if (($receiver = self['@pseudoVars']) == nil || $receiver == undefined) {
643
+ self['@pseudoVars'] = smalltalk.send(smalltalk.Dictionary || Dictionary, "_new", []);
644
+ self['@pseudoVars'];
645
+ smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.Smalltalk || Smalltalk, "_current", []), "_pseudoVariableNames", []), "_do_", [function (each) {$1 = smalltalk.send(smalltalk.PseudoVar || PseudoVar, "_on_", [each]);smalltalk.send($1, "_scope_", [smalltalk.send(self, "_methodScope", [])]);$2 = smalltalk.send($1, "_yourself", []);return smalltalk.send(self['@pseudoVars'], "_at_put_", [each, $2]);}]);
646
+ } else {
647
+ self['@pseudoVars'];
648
+ }
649
+ return self['@pseudoVars'];
650
+ },
651
+ args: [],
652
+ source: "pseudoVars\x0a\x09pseudoVars ifNil: [\x0a\x09\x09pseudoVars := Dictionary new.\x0a\x09\x09Smalltalk current pseudoVariableNames do: [ :each |\x0a\x09\x09\x09pseudoVars at: each put: ((PseudoVar on: each)\x0a\x09\x09\x09\x09scope: self methodScope;\x0a\x09\x09\x09\x09yourself) ]].\x0a\x09^ pseudoVars",
653
+ messageSends: ["ifNil:", "new", "do:", "at:put:", "scope:", "methodScope", "on:", "yourself", "pseudoVariableNames", "current"],
654
+ referencedClasses: ["Dictionary", "PseudoVar", "Smalltalk"]
655
+ }),
656
+ smalltalk.MethodLexicalScope);
657
+
658
+ smalltalk.addMethod(
659
+ "_removeNonLocalReturn_",
660
+ smalltalk.method({
661
+ selector: "removeNonLocalReturn:",
662
+ category: 'adding',
663
+ fn: function (aScope) {
664
+ var self = this;
665
+ smalltalk.send(smalltalk.send(self, "_nonLocalReturns", []), "_remove_ifAbsent_", [aScope, function () {}]);
666
+ return self;
667
+ },
668
+ args: ["aScope"],
669
+ source: "removeNonLocalReturn: aScope\x0a\x09self nonLocalReturns remove: aScope ifAbsent: []",
670
+ messageSends: ["remove:ifAbsent:", "nonLocalReturns"],
671
+ referencedClasses: []
672
+ }),
673
+ smalltalk.MethodLexicalScope);
674
+
675
+ smalltalk.addMethod(
676
+ "_unknownVariables",
677
+ smalltalk.method({
678
+ selector: "unknownVariables",
679
+ category: 'accessing',
680
+ fn: function () {
681
+ var self = this;
682
+ var $1;
683
+ if (($receiver = self['@unknownVariables']) == nil ||
684
+ $receiver == undefined) {
685
+ self['@unknownVariables'] = smalltalk.send(smalltalk.OrderedCollection || OrderedCollection, "_new", []);
686
+ $1 = self['@unknownVariables'];
687
+ } else {
688
+ $1 = self['@unknownVariables'];
689
+ }
690
+ return $1;
691
+ },
692
+ args: [],
693
+ source: "unknownVariables\x0a\x09^ unknownVariables ifNil: [ unknownVariables := OrderedCollection new ]",
694
+ messageSends: ["ifNil:", "new"],
695
+ referencedClasses: ["OrderedCollection"]
696
+ }),
697
+ smalltalk.MethodLexicalScope);
698
+
699
+
700
+
701
+ smalltalk.addClass('ScopeVar', smalltalk.Object, ['scope', 'name'], 'Compiler-Semantic');
702
+ smalltalk.ScopeVar.comment="I am an entry in a LexicalScope that gets associated with variable nodes of the same name. \x0aThere are 4 different subclasses of vars: temp vars, local vars, args, and unknown/global vars."
703
+ smalltalk.addMethod(
704
+ "_alias",
705
+ smalltalk.method({
706
+ selector: "alias",
707
+ category: 'accessing',
708
+ fn: function () {
709
+ var self = this;
710
+ var $1;
711
+ $1 = smalltalk.send(smalltalk.send(self, "_name", []), "_asVariableName", []);
712
+ return $1;
713
+ },
714
+ args: [],
715
+ source: "alias\x0a\x09^ self name asVariableName",
716
+ messageSends: ["asVariableName", "name"],
717
+ referencedClasses: []
718
+ }),
719
+ smalltalk.ScopeVar);
720
+
721
+ smalltalk.addMethod(
722
+ "_isArgVar",
723
+ smalltalk.method({
724
+ selector: "isArgVar",
725
+ category: 'testing',
726
+ fn: function () {
727
+ var self = this;
728
+ return false;
729
+ },
730
+ args: [],
731
+ source: "isArgVar\x0a\x09^ false",
732
+ messageSends: [],
733
+ referencedClasses: []
734
+ }),
735
+ smalltalk.ScopeVar);
736
+
737
+ smalltalk.addMethod(
738
+ "_isClassRefVar",
739
+ smalltalk.method({
740
+ selector: "isClassRefVar",
741
+ category: 'testing',
742
+ fn: function () {
743
+ var self = this;
744
+ return false;
745
+ },
746
+ args: [],
747
+ source: "isClassRefVar\x0a\x09^ false",
748
+ messageSends: [],
749
+ referencedClasses: []
750
+ }),
751
+ smalltalk.ScopeVar);
752
+
753
+ smalltalk.addMethod(
754
+ "_isInstanceVar",
755
+ smalltalk.method({
756
+ selector: "isInstanceVar",
757
+ category: 'testing',
758
+ fn: function () {
759
+ var self = this;
760
+ return false;
761
+ },
762
+ args: [],
763
+ source: "isInstanceVar\x0a\x09^ false",
764
+ messageSends: [],
765
+ referencedClasses: []
766
+ }),
767
+ smalltalk.ScopeVar);
768
+
769
+ smalltalk.addMethod(
770
+ "_isPseudoVar",
771
+ smalltalk.method({
772
+ selector: "isPseudoVar",
773
+ category: 'testing',
774
+ fn: function () {
775
+ var self = this;
776
+ return false;
777
+ },
778
+ args: [],
779
+ source: "isPseudoVar\x0a\x09^ false",
780
+ messageSends: [],
781
+ referencedClasses: []
782
+ }),
783
+ smalltalk.ScopeVar);
784
+
785
+ smalltalk.addMethod(
786
+ "_isTempVar",
787
+ smalltalk.method({
788
+ selector: "isTempVar",
789
+ category: 'testing',
790
+ fn: function () {
791
+ var self = this;
792
+ return false;
793
+ },
794
+ args: [],
795
+ source: "isTempVar\x0a\x09^ false",
796
+ messageSends: [],
797
+ referencedClasses: []
798
+ }),
799
+ smalltalk.ScopeVar);
800
+
801
+ smalltalk.addMethod(
802
+ "_isUnknownVar",
803
+ smalltalk.method({
804
+ selector: "isUnknownVar",
805
+ category: 'testing',
806
+ fn: function () {
807
+ var self = this;
808
+ return false;
809
+ },
810
+ args: [],
811
+ source: "isUnknownVar\x0a\x09^ false",
812
+ messageSends: [],
813
+ referencedClasses: []
814
+ }),
815
+ smalltalk.ScopeVar);
816
+
817
+ smalltalk.addMethod(
818
+ "_name",
819
+ smalltalk.method({
820
+ selector: "name",
821
+ category: 'accessing',
822
+ fn: function () {
823
+ var self = this;
824
+ return self['@name'];
825
+ },
826
+ args: [],
827
+ source: "name\x0a\x09^ name",
828
+ messageSends: [],
829
+ referencedClasses: []
830
+ }),
831
+ smalltalk.ScopeVar);
832
+
833
+ smalltalk.addMethod(
834
+ "_name_",
835
+ smalltalk.method({
836
+ selector: "name:",
837
+ category: 'accessing',
838
+ fn: function (aString) {
839
+ var self = this;
840
+ self['@name'] = aString;
841
+ return self;
842
+ },
843
+ args: ["aString"],
844
+ source: "name: aString\x0a\x09name := aString",
845
+ messageSends: [],
846
+ referencedClasses: []
847
+ }),
848
+ smalltalk.ScopeVar);
849
+
850
+ smalltalk.addMethod(
851
+ "_scope",
852
+ smalltalk.method({
853
+ selector: "scope",
854
+ category: 'accessing',
855
+ fn: function () {
856
+ var self = this;
857
+ return self['@scope'];
858
+ },
859
+ args: [],
860
+ source: "scope\x0a\x09^ scope",
861
+ messageSends: [],
862
+ referencedClasses: []
863
+ }),
864
+ smalltalk.ScopeVar);
865
+
866
+ smalltalk.addMethod(
867
+ "_scope_",
868
+ smalltalk.method({
869
+ selector: "scope:",
870
+ category: 'accessing',
871
+ fn: function (aScope) {
872
+ var self = this;
873
+ self['@scope'] = aScope;
874
+ return self;
875
+ },
876
+ args: ["aScope"],
877
+ source: "scope: aScope\x0a\x09scope := aScope",
878
+ messageSends: [],
879
+ referencedClasses: []
880
+ }),
881
+ smalltalk.ScopeVar);
882
+
883
+ smalltalk.addMethod(
884
+ "_validateAssignment",
885
+ smalltalk.method({
886
+ selector: "validateAssignment",
887
+ category: 'testing',
888
+ fn: function () {
889
+ var self = this;
890
+ var $1, $2, $3;
891
+ $1 = smalltalk.send(smalltalk.send(self, "_isArgVar", []), "_or_", [function () {return smalltalk.send(self, "_isPseudoVar", []);}]);
892
+ if (smalltalk.assert($1)) {
893
+ $2 = smalltalk.send(smalltalk.InvalidAssignmentError || InvalidAssignmentError, "_new", []);
894
+ smalltalk.send($2, "_variableName_", [smalltalk.send(self, "_name", [])]);
895
+ $3 = smalltalk.send($2, "_signal", []);
896
+ }
897
+ return self;
898
+ },
899
+ args: [],
900
+ source: "validateAssignment\x0a\x09(self isArgVar or: [ self isPseudoVar ]) ifTrue: [\x0a\x09\x09InvalidAssignmentError new\x0a\x09\x09\x09variableName: self name;\x0a\x09\x09\x09signal]",
901
+ messageSends: ["ifTrue:", "variableName:", "name", "new", "signal", "or:", "isPseudoVar", "isArgVar"],
902
+ referencedClasses: ["InvalidAssignmentError"]
903
+ }),
904
+ smalltalk.ScopeVar);
905
+
906
+
907
+ smalltalk.addMethod(
908
+ "_on_",
909
+ smalltalk.method({
910
+ selector: "on:",
911
+ category: 'instance creation',
912
+ fn: function (aString) {
913
+ var self = this;
914
+ var $2, $3, $1;
915
+ $2 = smalltalk.send(self, "_new", []);
916
+ smalltalk.send($2, "_name_", [aString]);
917
+ $3 = smalltalk.send($2, "_yourself", []);
918
+ $1 = $3;
919
+ return $1;
920
+ },
921
+ args: ["aString"],
922
+ source: "on: aString\x0a\x09^ self new \x0a\x09\x09name: aString;\x0a\x09\x09yourself",
923
+ messageSends: ["name:", "new", "yourself"],
924
+ referencedClasses: []
925
+ }),
926
+ smalltalk.ScopeVar.klass);
927
+
928
+
929
+ smalltalk.addClass('AliasVar', smalltalk.ScopeVar, ['node'], 'Compiler-Semantic');
930
+ smalltalk.AliasVar.comment="I am an internally defined variable by the compiler"
931
+ smalltalk.addMethod(
932
+ "_node",
933
+ smalltalk.method({
934
+ selector: "node",
935
+ category: 'accessing',
936
+ fn: function () {
937
+ var self = this;
938
+ return self['@node'];
939
+ },
940
+ args: [],
941
+ source: "node\x0a\x09^ node",
942
+ messageSends: [],
943
+ referencedClasses: []
944
+ }),
945
+ smalltalk.AliasVar);
946
+
947
+ smalltalk.addMethod(
948
+ "_node_",
949
+ smalltalk.method({
950
+ selector: "node:",
951
+ category: 'accessing',
952
+ fn: function (aNode) {
953
+ var self = this;
954
+ self['@node'] = aNode;
955
+ return self;
956
+ },
957
+ args: ["aNode"],
958
+ source: "node: aNode\x0a\x09node := aNode",
959
+ messageSends: [],
960
+ referencedClasses: []
961
+ }),
962
+ smalltalk.AliasVar);
963
+
964
+
965
+
966
+ smalltalk.addClass('ArgVar', smalltalk.ScopeVar, [], 'Compiler-Semantic');
967
+ smalltalk.ArgVar.comment="I am an argument of a method or block."
968
+ smalltalk.addMethod(
969
+ "_isArgVar",
970
+ smalltalk.method({
971
+ selector: "isArgVar",
972
+ category: 'testing',
973
+ fn: function () {
974
+ var self = this;
975
+ return true;
976
+ },
977
+ args: [],
978
+ source: "isArgVar\x0a\x09^ true",
979
+ messageSends: [],
980
+ referencedClasses: []
981
+ }),
982
+ smalltalk.ArgVar);
983
+
984
+
985
+
986
+ smalltalk.addClass('ClassRefVar', smalltalk.ScopeVar, [], 'Compiler-Semantic');
987
+ smalltalk.ClassRefVar.comment="I am an class reference variable"
988
+ smalltalk.addMethod(
989
+ "_alias",
990
+ smalltalk.method({
991
+ selector: "alias",
992
+ category: 'accessing',
993
+ fn: function () {
994
+ var self = this;
995
+ var $1;
996
+ $1 = smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send("(smalltalk.", "__comma", [smalltalk.send(self, "_name", [])]), "__comma", [" || "]), "__comma", [smalltalk.send(self, "_name", [])]), "__comma", [")"]);
997
+ return $1;
998
+ },
999
+ args: [],
1000
+ source: "alias\x0a\x09^ '(smalltalk.', self name, ' || ', self name, ')'",
1001
+ messageSends: [",", "name"],
1002
+ referencedClasses: []
1003
+ }),
1004
+ smalltalk.ClassRefVar);
1005
+
1006
+ smalltalk.addMethod(
1007
+ "_isClassRefVar",
1008
+ smalltalk.method({
1009
+ selector: "isClassRefVar",
1010
+ category: 'testing',
1011
+ fn: function () {
1012
+ var self = this;
1013
+ return true;
1014
+ },
1015
+ args: [],
1016
+ source: "isClassRefVar\x0a\x09^ true",
1017
+ messageSends: [],
1018
+ referencedClasses: []
1019
+ }),
1020
+ smalltalk.ClassRefVar);
1021
+
1022
+
1023
+
1024
+ smalltalk.addClass('InstanceVar', smalltalk.ScopeVar, [], 'Compiler-Semantic');
1025
+ smalltalk.InstanceVar.comment="I am an instance variable of a method or block."
1026
+ smalltalk.addMethod(
1027
+ "_alias",
1028
+ smalltalk.method({
1029
+ selector: "alias",
1030
+ category: 'testing',
1031
+ fn: function () {
1032
+ var self = this;
1033
+ var $1;
1034
+ $1 = smalltalk.send(smalltalk.send("self[\"@", "__comma", [smalltalk.send(self, "_name", [])]), "__comma", ["\"]"]);
1035
+ return $1;
1036
+ },
1037
+ args: [],
1038
+ source: "alias\x0a\x09^ 'self[\x22@', self name, '\x22]'",
1039
+ messageSends: [",", "name"],
1040
+ referencedClasses: []
1041
+ }),
1042
+ smalltalk.InstanceVar);
1043
+
1044
+ smalltalk.addMethod(
1045
+ "_isInstanceVar",
1046
+ smalltalk.method({
1047
+ selector: "isInstanceVar",
1048
+ category: 'testing',
1049
+ fn: function () {
1050
+ var self = this;
1051
+ return true;
1052
+ },
1053
+ args: [],
1054
+ source: "isInstanceVar\x0a\x09^ true",
1055
+ messageSends: [],
1056
+ referencedClasses: []
1057
+ }),
1058
+ smalltalk.InstanceVar);
1059
+
1060
+
1061
+
1062
+ smalltalk.addClass('PseudoVar', smalltalk.ScopeVar, [], 'Compiler-Semantic');
1063
+ smalltalk.PseudoVar.comment="I am an pseudo variable.\x0a\x0aThe five Smalltalk pseudo variables are: 'self', 'super', 'nil', 'true' and 'false'"
1064
+ smalltalk.addMethod(
1065
+ "_alias",
1066
+ smalltalk.method({
1067
+ selector: "alias",
1068
+ category: 'accessing',
1069
+ fn: function () {
1070
+ var self = this;
1071
+ var $1;
1072
+ $1 = smalltalk.send(self, "_name", []);
1073
+ return $1;
1074
+ },
1075
+ args: [],
1076
+ source: "alias\x0a\x09^ self name",
1077
+ messageSends: ["name"],
1078
+ referencedClasses: []
1079
+ }),
1080
+ smalltalk.PseudoVar);
1081
+
1082
+ smalltalk.addMethod(
1083
+ "_isPseudoVar",
1084
+ smalltalk.method({
1085
+ selector: "isPseudoVar",
1086
+ category: 'testing',
1087
+ fn: function () {
1088
+ var self = this;
1089
+ return true;
1090
+ },
1091
+ args: [],
1092
+ source: "isPseudoVar\x0a\x09^ true",
1093
+ messageSends: [],
1094
+ referencedClasses: []
1095
+ }),
1096
+ smalltalk.PseudoVar);
1097
+
1098
+
1099
+
1100
+ smalltalk.addClass('TempVar', smalltalk.ScopeVar, [], 'Compiler-Semantic');
1101
+ smalltalk.TempVar.comment="I am an temporary variable of a method or block."
1102
+ smalltalk.addMethod(
1103
+ "_isTempVar",
1104
+ smalltalk.method({
1105
+ selector: "isTempVar",
1106
+ category: 'testing',
1107
+ fn: function () {
1108
+ var self = this;
1109
+ return true;
1110
+ },
1111
+ args: [],
1112
+ source: "isTempVar\x0a\x09^ true",
1113
+ messageSends: [],
1114
+ referencedClasses: []
1115
+ }),
1116
+ smalltalk.TempVar);
1117
+
1118
+
1119
+
1120
+ smalltalk.addClass('UnknownVar', smalltalk.ScopeVar, [], 'Compiler-Semantic');
1121
+ smalltalk.UnknownVar.comment="I am an unknown variable. Amber uses unknown variables as JavaScript globals"
1122
+ smalltalk.addMethod(
1123
+ "_isUnknownVar",
1124
+ smalltalk.method({
1125
+ selector: "isUnknownVar",
1126
+ category: 'testing',
1127
+ fn: function () {
1128
+ var self = this;
1129
+ return true;
1130
+ },
1131
+ args: [],
1132
+ source: "isUnknownVar\x0a\x09^ true",
1133
+ messageSends: [],
1134
+ referencedClasses: []
1135
+ }),
1136
+ smalltalk.UnknownVar);
1137
+
1138
+
1139
+
1140
+ smalltalk.addClass('SemanticAnalyzer', smalltalk.NodeVisitor, ['currentScope', 'theClass', 'classReferences', 'messageSends'], 'Compiler-Semantic');
1141
+ smalltalk.SemanticAnalyzer.comment="I semantically analyze the abstract syntax tree and annotate it with informations such as non local returns and variable scopes."
1142
+ smalltalk.addMethod(
1143
+ "_classReferences",
1144
+ smalltalk.method({
1145
+ selector: "classReferences",
1146
+ category: 'accessing',
1147
+ fn: function () {
1148
+ var self = this;
1149
+ var $1;
1150
+ if (($receiver = self['@classReferences']) == nil ||
1151
+ $receiver == undefined) {
1152
+ self['@classReferences'] = smalltalk.send(smalltalk.Set || Set, "_new", []);
1153
+ $1 = self['@classReferences'];
1154
+ } else {
1155
+ $1 = self['@classReferences'];
1156
+ }
1157
+ return $1;
1158
+ },
1159
+ args: [],
1160
+ source: "classReferences\x0a\x09^ classReferences ifNil: [ classReferences := Set new ]",
1161
+ messageSends: ["ifNil:", "new"],
1162
+ referencedClasses: ["Set"]
1163
+ }),
1164
+ smalltalk.SemanticAnalyzer);
1165
+
1166
+ smalltalk.addMethod(
1167
+ "_errorShadowingVariable_",
1168
+ smalltalk.method({
1169
+ selector: "errorShadowingVariable:",
1170
+ category: 'error handling',
1171
+ fn: function (aString) {
1172
+ var self = this;
1173
+ var $1, $2;
1174
+ $1 = smalltalk.send(smalltalk.ShadowingVariableError || ShadowingVariableError, "_new", []);
1175
+ smalltalk.send($1, "_variableName_", [aString]);
1176
+ $2 = smalltalk.send($1, "_signal", []);
1177
+ return self;
1178
+ },
1179
+ args: ["aString"],
1180
+ source: "errorShadowingVariable: aString\x0a\x09ShadowingVariableError new\x0a\x09\x09variableName: aString;\x0a\x09\x09signal",
1181
+ messageSends: ["variableName:", "new", "signal"],
1182
+ referencedClasses: ["ShadowingVariableError"]
1183
+ }),
1184
+ smalltalk.SemanticAnalyzer);
1185
+
1186
+ smalltalk.addMethod(
1187
+ "_errorUnknownVariable_",
1188
+ smalltalk.method({
1189
+ selector: "errorUnknownVariable:",
1190
+ category: 'error handling',
1191
+ fn: function (aNode) {
1192
+ var self = this;
1193
+ var $1, $2;
1194
+ var notDefined;
1195
+ notDefined = eval("typeof " + aNode._value() + " == \"undefined\"");
1196
+ if (smalltalk.assert(notDefined)) {
1197
+ $1 = smalltalk.send(smalltalk.UnknownVariableError || UnknownVariableError, "_new", []);
1198
+ smalltalk.send($1, "_variableName_", [smalltalk.send(aNode, "_value", [])]);
1199
+ $2 = smalltalk.send($1, "_signal", []);
1200
+ } else {
1201
+ smalltalk.send(smalltalk.send(smalltalk.send(self['@currentScope'], "_methodScope", []), "_unknownVariables", []), "_add_", [smalltalk.send(aNode, "_value", [])]);
1202
+ }
1203
+ return self;
1204
+ },
1205
+ args: ["aNode"],
1206
+ source: "errorUnknownVariable: aNode\x0a\x09\x22Throw an error if the variable is undeclared in the global JS scope (i.e. window)\x22\x0a\x0a\x09| notDefined |\x0a\x0a\x09notDefined := <eval('typeof ' + aNode._value() + ' == \x22undefined\x22')>.\x0a\x0a\x09notDefined\x0a\x09\x09ifTrue: [ \x0a\x09\x09\x09UnknownVariableError new\x0a\x09\x09\x09\x09variableName: aNode value;\x0a\x09\x09\x09\x09signal ]\x0a\x09\x09ifFalse: [\x0a\x09\x09\x09currentScope methodScope unknownVariables add: aNode value. ]",
1207
+ messageSends: ["ifTrue:ifFalse:", "variableName:", "value", "new", "signal", "add:", "unknownVariables", "methodScope"],
1208
+ referencedClasses: ["UnknownVariableError"]
1209
+ }),
1210
+ smalltalk.SemanticAnalyzer);
1211
+
1212
+ smalltalk.addMethod(
1213
+ "_messageSends",
1214
+ smalltalk.method({
1215
+ selector: "messageSends",
1216
+ category: 'accessing',
1217
+ fn: function () {
1218
+ var self = this;
1219
+ var $1;
1220
+ if (($receiver = self['@messageSends']) == nil ||
1221
+ $receiver == undefined) {
1222
+ self['@messageSends'] = smalltalk.send(smalltalk.Dictionary || Dictionary, "_new", []);
1223
+ $1 = self['@messageSends'];
1224
+ } else {
1225
+ $1 = self['@messageSends'];
1226
+ }
1227
+ return $1;
1228
+ },
1229
+ args: [],
1230
+ source: "messageSends\x0a\x09^ messageSends ifNil: [ messageSends := Dictionary new ]",
1231
+ messageSends: ["ifNil:", "new"],
1232
+ referencedClasses: ["Dictionary"]
1233
+ }),
1234
+ smalltalk.SemanticAnalyzer);
1235
+
1236
+ smalltalk.addMethod(
1237
+ "_newBlockScope",
1238
+ smalltalk.method({
1239
+ selector: "newBlockScope",
1240
+ category: 'factory',
1241
+ fn: function () {
1242
+ var self = this;
1243
+ var $1;
1244
+ $1 = smalltalk.send(self, "_newScopeOfClass_", [smalltalk.LexicalScope || LexicalScope]);
1245
+ return $1;
1246
+ },
1247
+ args: [],
1248
+ source: "newBlockScope\x0a\x09^ self newScopeOfClass: LexicalScope",
1249
+ messageSends: ["newScopeOfClass:"],
1250
+ referencedClasses: ["LexicalScope"]
1251
+ }),
1252
+ smalltalk.SemanticAnalyzer);
1253
+
1254
+ smalltalk.addMethod(
1255
+ "_newMethodScope",
1256
+ smalltalk.method({
1257
+ selector: "newMethodScope",
1258
+ category: 'factory',
1259
+ fn: function () {
1260
+ var self = this;
1261
+ var $1;
1262
+ $1 = smalltalk.send(self, "_newScopeOfClass_", [smalltalk.MethodLexicalScope || MethodLexicalScope]);
1263
+ return $1;
1264
+ },
1265
+ args: [],
1266
+ source: "newMethodScope\x0a\x09^ self newScopeOfClass: MethodLexicalScope",
1267
+ messageSends: ["newScopeOfClass:"],
1268
+ referencedClasses: ["MethodLexicalScope"]
1269
+ }),
1270
+ smalltalk.SemanticAnalyzer);
1271
+
1272
+ smalltalk.addMethod(
1273
+ "_newScopeOfClass_",
1274
+ smalltalk.method({
1275
+ selector: "newScopeOfClass:",
1276
+ category: 'factory',
1277
+ fn: function (aLexicalScopeClass) {
1278
+ var self = this;
1279
+ var $2, $3, $1;
1280
+ $2 = smalltalk.send(aLexicalScopeClass, "_new", []);
1281
+ smalltalk.send($2, "_outerScope_", [self['@currentScope']]);
1282
+ $3 = smalltalk.send($2, "_yourself", []);
1283
+ $1 = $3;
1284
+ return $1;
1285
+ },
1286
+ args: ["aLexicalScopeClass"],
1287
+ source: "newScopeOfClass: aLexicalScopeClass\x0a\x09^ aLexicalScopeClass new \x0a\x09\x09outerScope: currentScope;\x0a\x09\x09yourself",
1288
+ messageSends: ["outerScope:", "new", "yourself"],
1289
+ referencedClasses: []
1290
+ }),
1291
+ smalltalk.SemanticAnalyzer);
1292
+
1293
+ smalltalk.addMethod(
1294
+ "_popScope",
1295
+ smalltalk.method({
1296
+ selector: "popScope",
1297
+ category: 'scope',
1298
+ fn: function () {
1299
+ var self = this;
1300
+ if (($receiver = self['@currentScope']) == nil ||
1301
+ $receiver == undefined) {
1302
+ self['@currentScope'];
1303
+ } else {
1304
+ self['@currentScope'] = smalltalk.send(self['@currentScope'], "_outerScope", []);
1305
+ self['@currentScope'];
1306
+ }
1307
+ return self;
1308
+ },
1309
+ args: [],
1310
+ source: "popScope\x0a\x09currentScope ifNotNil: [\x0a\x09\x09currentScope := currentScope outerScope ]",
1311
+ messageSends: ["ifNotNil:", "outerScope"],
1312
+ referencedClasses: []
1313
+ }),
1314
+ smalltalk.SemanticAnalyzer);
1315
+
1316
+ smalltalk.addMethod(
1317
+ "_pushScope_",
1318
+ smalltalk.method({
1319
+ selector: "pushScope:",
1320
+ category: 'scope',
1321
+ fn: function (aScope) {
1322
+ var self = this;
1323
+ smalltalk.send(aScope, "_outerScope_", [self['@currentScope']]);
1324
+ self['@currentScope'] = aScope;
1325
+ return self;
1326
+ },
1327
+ args: ["aScope"],
1328
+ source: "pushScope: aScope\x0a\x09aScope outerScope: currentScope.\x0a\x09currentScope := aScope",
1329
+ messageSends: ["outerScope:"],
1330
+ referencedClasses: []
1331
+ }),
1332
+ smalltalk.SemanticAnalyzer);
1333
+
1334
+ smalltalk.addMethod(
1335
+ "_theClass",
1336
+ smalltalk.method({
1337
+ selector: "theClass",
1338
+ category: 'accessing',
1339
+ fn: function () {
1340
+ var self = this;
1341
+ return self['@theClass'];
1342
+ },
1343
+ args: [],
1344
+ source: "theClass\x0a\x09^ theClass",
1345
+ messageSends: [],
1346
+ referencedClasses: []
1347
+ }),
1348
+ smalltalk.SemanticAnalyzer);
1349
+
1350
+ smalltalk.addMethod(
1351
+ "_theClass_",
1352
+ smalltalk.method({
1353
+ selector: "theClass:",
1354
+ category: 'accessing',
1355
+ fn: function (aClass) {
1356
+ var self = this;
1357
+ self['@theClass'] = aClass;
1358
+ return self;
1359
+ },
1360
+ args: ["aClass"],
1361
+ source: "theClass: aClass\x0a\x09theClass := aClass",
1362
+ messageSends: [],
1363
+ referencedClasses: []
1364
+ }),
1365
+ smalltalk.SemanticAnalyzer);
1366
+
1367
+ smalltalk.addMethod(
1368
+ "_validateVariableScope_",
1369
+ smalltalk.method({
1370
+ selector: "validateVariableScope:",
1371
+ category: 'scope',
1372
+ fn: function (aString) {
1373
+ var self = this;
1374
+ var $1;
1375
+ $1 = smalltalk.send(self['@currentScope'], "_lookupVariable_", [aString]);
1376
+ if (($receiver = $1) == nil || $receiver == undefined) {
1377
+ } else {
1378
+ smalltalk.send(self, "_errorShadowingVariable_", [aString]);
1379
+ }
1380
+ return self;
1381
+ },
1382
+ args: ["aString"],
1383
+ source: "validateVariableScope: aString\x0a\x09\x22Validate the variable scope in by doing a recursive lookup, up to the method scope\x22\x0a\x0a\x09(currentScope lookupVariable: aString) ifNotNil: [\x0a\x09\x09self errorShadowingVariable: aString ]",
1384
+ messageSends: ["ifNotNil:", "errorShadowingVariable:", "lookupVariable:"],
1385
+ referencedClasses: []
1386
+ }),
1387
+ smalltalk.SemanticAnalyzer);
1388
+
1389
+ smalltalk.addMethod(
1390
+ "_visitAssignmentNode_",
1391
+ smalltalk.method({
1392
+ selector: "visitAssignmentNode:",
1393
+ category: 'visiting',
1394
+ fn: function (aNode) {
1395
+ var self = this;
1396
+ smalltalk.send(self, "_visitAssignmentNode_", [aNode], smalltalk.NodeVisitor);
1397
+ smalltalk.send(smalltalk.send(aNode, "_left", []), "_beAssigned", []);
1398
+ return self;
1399
+ },
1400
+ args: ["aNode"],
1401
+ source: "visitAssignmentNode: aNode\x0a\x09super visitAssignmentNode: aNode.\x0a\x09aNode left beAssigned",
1402
+ messageSends: ["visitAssignmentNode:", "beAssigned", "left"],
1403
+ referencedClasses: []
1404
+ }),
1405
+ smalltalk.SemanticAnalyzer);
1406
+
1407
+ smalltalk.addMethod(
1408
+ "_visitBlockNode_",
1409
+ smalltalk.method({
1410
+ selector: "visitBlockNode:",
1411
+ category: 'visiting',
1412
+ fn: function (aNode) {
1413
+ var self = this;
1414
+ smalltalk.send(self, "_pushScope_", [smalltalk.send(self, "_newBlockScope", [])]);
1415
+ smalltalk.send(aNode, "_scope_", [self['@currentScope']]);
1416
+ smalltalk.send(self['@currentScope'], "_node_", [aNode]);
1417
+ smalltalk.send(smalltalk.send(aNode, "_parameters", []), "_do_", [function (each) {smalltalk.send(self, "_validateVariableScope_", [each]);return smalltalk.send(self['@currentScope'], "_addArg_", [each]);}]);
1418
+ smalltalk.send(self, "_visitBlockNode_", [aNode], smalltalk.NodeVisitor);
1419
+ smalltalk.send(self, "_popScope", []);
1420
+ return self;
1421
+ },
1422
+ args: ["aNode"],
1423
+ source: "visitBlockNode: aNode\x0a\x09self pushScope: self newBlockScope.\x0a\x09aNode scope: currentScope.\x0a\x09currentScope node: aNode.\x0a\x09\x0a\x09aNode parameters do: [ :each | \x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addArg: each ].\x0a\x0a\x09super visitBlockNode: aNode.\x0a\x09self popScope",
1424
+ messageSends: ["pushScope:", "newBlockScope", "scope:", "node:", "do:", "validateVariableScope:", "addArg:", "parameters", "visitBlockNode:", "popScope"],
1425
+ referencedClasses: []
1426
+ }),
1427
+ smalltalk.SemanticAnalyzer);
1428
+
1429
+ smalltalk.addMethod(
1430
+ "_visitCascadeNode_",
1431
+ smalltalk.method({
1432
+ selector: "visitCascadeNode:",
1433
+ category: 'visiting',
1434
+ fn: function (aNode) {
1435
+ var self = this;
1436
+ var $1;
1437
+ smalltalk.send(smalltalk.send(aNode, "_nodes", []), "_do_", [function (each) {return smalltalk.send(each, "_receiver_", [smalltalk.send(aNode, "_receiver", [])]);}]);
1438
+ smalltalk.send(self, "_visitCascadeNode_", [aNode], smalltalk.NodeVisitor);
1439
+ $1 = smalltalk.send(smalltalk.send(smalltalk.send(aNode, "_nodes", []), "_first", []), "_superSend", []);
1440
+ if (smalltalk.assert($1)) {
1441
+ smalltalk.send(smalltalk.send(aNode, "_nodes", []), "_do_", [function (each) {return smalltalk.send(each, "_superSend_", [true]);}]);
1442
+ }
1443
+ return self;
1444
+ },
1445
+ args: ["aNode"],
1446
+ source: "visitCascadeNode: aNode\x0a\x09\x22Populate the receiver into all children\x22\x0a\x09aNode nodes do: [ :each | \x0a\x09\x09each receiver: aNode receiver ].\x0a\x09super visitCascadeNode: aNode.\x0a\x09aNode nodes first superSend ifTrue: [\x0a\x09\x09aNode nodes do: [ :each | each superSend: true ]]",
1447
+ messageSends: ["do:", "receiver:", "receiver", "nodes", "visitCascadeNode:", "ifTrue:", "superSend:", "superSend", "first"],
1448
+ referencedClasses: []
1449
+ }),
1450
+ smalltalk.SemanticAnalyzer);
1451
+
1452
+ smalltalk.addMethod(
1453
+ "_visitClassReferenceNode_",
1454
+ smalltalk.method({
1455
+ selector: "visitClassReferenceNode:",
1456
+ category: 'visiting',
1457
+ fn: function (aNode) {
1458
+ var self = this;
1459
+ var $1, $2;
1460
+ smalltalk.send(smalltalk.send(self, "_classReferences", []), "_add_", [smalltalk.send(aNode, "_value", [])]);
1461
+ $1 = smalltalk.send(smalltalk.ClassRefVar || ClassRefVar, "_new", []);
1462
+ smalltalk.send($1, "_name_", [smalltalk.send(aNode, "_value", [])]);
1463
+ $2 = smalltalk.send($1, "_yourself", []);
1464
+ smalltalk.send(aNode, "_binding_", [$2]);
1465
+ return self;
1466
+ },
1467
+ args: ["aNode"],
1468
+ source: "visitClassReferenceNode: aNode\x0a\x09self classReferences add: aNode value.\x0a\x09aNode binding: (ClassRefVar new name: aNode value; yourself)",
1469
+ messageSends: ["add:", "value", "classReferences", "binding:", "name:", "new", "yourself"],
1470
+ referencedClasses: ["ClassRefVar"]
1471
+ }),
1472
+ smalltalk.SemanticAnalyzer);
1473
+
1474
+ smalltalk.addMethod(
1475
+ "_visitMethodNode_",
1476
+ smalltalk.method({
1477
+ selector: "visitMethodNode:",
1478
+ category: 'visiting',
1479
+ fn: function (aNode) {
1480
+ var self = this;
1481
+ var $1;
1482
+ smalltalk.send(self, "_pushScope_", [smalltalk.send(self, "_newMethodScope", [])]);
1483
+ smalltalk.send(aNode, "_scope_", [self['@currentScope']]);
1484
+ smalltalk.send(self['@currentScope'], "_node_", [aNode]);
1485
+ smalltalk.send(smalltalk.send(smalltalk.send(self, "_theClass", []), "_allInstanceVariableNames", []), "_do_", [function (each) {return smalltalk.send(self['@currentScope'], "_addIVar_", [each]);}]);
1486
+ smalltalk.send(smalltalk.send(aNode, "_arguments", []), "_do_", [function (each) {smalltalk.send(self, "_validateVariableScope_", [each]);return smalltalk.send(self['@currentScope'], "_addArg_", [each]);}]);
1487
+ smalltalk.send(self, "_visitMethodNode_", [aNode], smalltalk.NodeVisitor);
1488
+ smalltalk.send(aNode, "_classReferences_", [smalltalk.send(self, "_classReferences", [])]);
1489
+ $1 = smalltalk.send(aNode, "_messageSends_", [smalltalk.send(smalltalk.send(self, "_messageSends", []), "_keys", [])]);
1490
+ smalltalk.send(self, "_popScope", []);
1491
+ return self;
1492
+ },
1493
+ args: ["aNode"],
1494
+ source: "visitMethodNode: aNode\x0a\x09self pushScope: self newMethodScope.\x0a\x09aNode scope: currentScope.\x0a\x09currentScope node: aNode.\x0a\x0a\x09self theClass allInstanceVariableNames do: [:each | \x0a\x09\x09currentScope addIVar: each ].\x0a\x09aNode arguments do: [ :each | \x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addArg: each ].\x0a\x0a\x09super visitMethodNode: aNode.\x0a\x0a\x09aNode \x0a\x09\x09classReferences: self classReferences;\x0a\x09\x09messageSends: self messageSends keys.\x0a\x09self popScope",
1495
+ messageSends: ["pushScope:", "newMethodScope", "scope:", "node:", "do:", "addIVar:", "allInstanceVariableNames", "theClass", "validateVariableScope:", "addArg:", "arguments", "visitMethodNode:", "classReferences:", "classReferences", "messageSends:", "keys", "messageSends", "popScope"],
1496
+ referencedClasses: []
1497
+ }),
1498
+ smalltalk.SemanticAnalyzer);
1499
+
1500
+ smalltalk.addMethod(
1501
+ "_visitReturnNode_",
1502
+ smalltalk.method({
1503
+ selector: "visitReturnNode:",
1504
+ category: 'visiting',
1505
+ fn: function (aNode) {
1506
+ var self = this;
1507
+ var $1;
1508
+ smalltalk.send(aNode, "_scope_", [self['@currentScope']]);
1509
+ $1 = smalltalk.send(self['@currentScope'], "_isMethodScope", []);
1510
+ if (smalltalk.assert($1)) {
1511
+ smalltalk.send(self['@currentScope'], "_localReturn_", [true]);
1512
+ } else {
1513
+ smalltalk.send(smalltalk.send(self['@currentScope'], "_methodScope", []), "_addNonLocalReturn_", [self['@currentScope']]);
1514
+ }
1515
+ smalltalk.send(self, "_visitReturnNode_", [aNode], smalltalk.NodeVisitor);
1516
+ return self;
1517
+ },
1518
+ args: ["aNode"],
1519
+ source: "visitReturnNode: aNode\x0a\x09aNode scope: currentScope.\x0a\x09currentScope isMethodScope\x0a\x09\x09ifTrue: [ currentScope localReturn: true ]\x0a\x09\x09ifFalse: [ currentScope methodScope addNonLocalReturn: currentScope ].\x0a\x09super visitReturnNode: aNode",
1520
+ messageSends: ["scope:", "ifTrue:ifFalse:", "localReturn:", "addNonLocalReturn:", "methodScope", "isMethodScope", "visitReturnNode:"],
1521
+ referencedClasses: []
1522
+ }),
1523
+ smalltalk.SemanticAnalyzer);
1524
+
1525
+ smalltalk.addMethod(
1526
+ "_visitSendNode_",
1527
+ smalltalk.method({
1528
+ selector: "visitSendNode:",
1529
+ category: 'visiting',
1530
+ fn: function (aNode) {
1531
+ var self = this;
1532
+ var $1, $2, $3;
1533
+ $1 = smalltalk.send(smalltalk.send(smalltalk.send(aNode, "_receiver", []), "_value", []), "__eq", ["super"]);
1534
+ if (smalltalk.assert($1)) {
1535
+ smalltalk.send(aNode, "_superSend_", [true]);
1536
+ smalltalk.send(smalltalk.send(aNode, "_receiver", []), "_value_", ["self"]);
1537
+ } else {
1538
+ $2 = smalltalk.send(smalltalk.send(smalltalk.IRSendInliner || IRSendInliner, "_inlinedSelectors", []), "_includes_", [smalltalk.send(aNode, "_selector", [])]);
1539
+ if (smalltalk.assert($2)) {
1540
+ smalltalk.send(aNode, "_shouldBeInlined_", [true]);
1541
+ $3 = smalltalk.send(smalltalk.send(aNode, "_receiver", []), "_isValueNode", []);
1542
+ if (!smalltalk.assert($3)) {
1543
+ smalltalk.send(smalltalk.send(aNode, "_receiver", []), "_shouldBeAliased_", [true]);
1544
+ }
1545
+ }
1546
+ }
1547
+ smalltalk.send(smalltalk.send(self, "_messageSends", []), "_at_ifAbsentPut_", [smalltalk.send(aNode, "_selector", []), function () {return smalltalk.send(smalltalk.Set || Set, "_new", []);}]);
1548
+ smalltalk.send(smalltalk.send(smalltalk.send(self, "_messageSends", []), "_at_", [smalltalk.send(aNode, "_selector", [])]), "_add_", [aNode]);
1549
+ smalltalk.send(aNode, "_index_", [smalltalk.send(smalltalk.send(smalltalk.send(self, "_messageSends", []), "_at_", [smalltalk.send(aNode, "_selector", [])]), "_size", [])]);
1550
+ smalltalk.send(self, "_visitSendNode_", [aNode], smalltalk.NodeVisitor);
1551
+ return self;
1552
+ },
1553
+ args: ["aNode"],
1554
+ source: "visitSendNode: aNode\x0a\x0a\x09aNode receiver value = 'super' \x0a\x09\x09ifTrue: [\x0a\x09\x09\x09aNode superSend: true.\x0a\x09\x09\x09aNode receiver value: 'self' ]\x0a\x09\x09ifFalse: [ (IRSendInliner inlinedSelectors includes: aNode selector) ifTrue: [\x0a\x09\x09\x09aNode shouldBeInlined: true.\x0a\x09\x09\x09aNode receiver isValueNode ifFalse: [ aNode receiver shouldBeAliased: true ] ] ].\x0a\x0a\x09self messageSends at: aNode selector ifAbsentPut: [ Set new ].\x0a\x09(self messageSends at: aNode selector) add: aNode.\x0a\x0a\x09aNode index: (self messageSends at: aNode selector) size.\x0a\x0a\x09super visitSendNode: aNode",
1555
+ messageSends: ["ifTrue:ifFalse:", "superSend:", "value:", "receiver", "ifTrue:", "shouldBeInlined:", "ifFalse:", "shouldBeAliased:", "isValueNode", "includes:", "selector", "inlinedSelectors", "=", "value", "at:ifAbsentPut:", "new", "messageSends", "add:", "at:", "index:", "size", "visitSendNode:"],
1556
+ referencedClasses: ["IRSendInliner", "Set"]
1557
+ }),
1558
+ smalltalk.SemanticAnalyzer);
1559
+
1560
+ smalltalk.addMethod(
1561
+ "_visitSequenceNode_",
1562
+ smalltalk.method({
1563
+ selector: "visitSequenceNode:",
1564
+ category: 'visiting',
1565
+ fn: function (aNode) {
1566
+ var self = this;
1567
+ smalltalk.send(smalltalk.send(aNode, "_temps", []), "_do_", [function (each) {smalltalk.send(self, "_validateVariableScope_", [each]);return smalltalk.send(self['@currentScope'], "_addTemp_", [each]);}]);
1568
+ smalltalk.send(self, "_visitSequenceNode_", [aNode], smalltalk.NodeVisitor);
1569
+ return self;
1570
+ },
1571
+ args: ["aNode"],
1572
+ source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each | \x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addTemp: each ].\x0a\x0a\x09super visitSequenceNode: aNode",
1573
+ messageSends: ["do:", "validateVariableScope:", "addTemp:", "temps", "visitSequenceNode:"],
1574
+ referencedClasses: []
1575
+ }),
1576
+ smalltalk.SemanticAnalyzer);
1577
+
1578
+ smalltalk.addMethod(
1579
+ "_visitVariableNode_",
1580
+ smalltalk.method({
1581
+ selector: "visitVariableNode:",
1582
+ category: 'visiting',
1583
+ fn: function (aNode) {
1584
+ var self = this;
1585
+ var $2, $3, $4, $1;
1586
+ $2 = smalltalk.send(self['@currentScope'], "_lookupVariable_", [aNode]);
1587
+ if (($receiver = $2) == nil || $receiver == undefined) {
1588
+ smalltalk.send(self, "_errorUnknownVariable_", [aNode]);
1589
+ $3 = smalltalk.send(smalltalk.UnknownVar || UnknownVar, "_new", []);
1590
+ smalltalk.send($3, "_name_", [smalltalk.send(aNode, "_value", [])]);
1591
+ $4 = smalltalk.send($3, "_yourself", []);
1592
+ $1 = $4;
1593
+ } else {
1594
+ $1 = $2;
1595
+ }
1596
+ smalltalk.send(aNode, "_binding_", [$1]);
1597
+ return self;
1598
+ },
1599
+ args: ["aNode"],
1600
+ source: "visitVariableNode: aNode\x0a\x09\x22Bind a ScopeVar to aNode by doing a lookup in the current scope.\x0a\x09If no ScopeVar is found, bind a UnknowVar and throw an error\x22\x0a\x0a\x09aNode binding: ((currentScope lookupVariable: aNode) ifNil: [ \x0a\x09\x09self errorUnknownVariable: aNode.\x0a\x09\x09UnknownVar new name: aNode value; yourself ])",
1601
+ messageSends: ["binding:", "ifNil:", "errorUnknownVariable:", "name:", "value", "new", "yourself", "lookupVariable:"],
1602
+ referencedClasses: ["UnknownVar"]
1603
+ }),
1604
+ smalltalk.SemanticAnalyzer);
1605
+
1606
+
1607
+ smalltalk.addMethod(
1608
+ "_on_",
1609
+ smalltalk.method({
1610
+ selector: "on:",
1611
+ category: 'instance creation',
1612
+ fn: function (aClass) {
1613
+ var self = this;
1614
+ var $2, $3, $1;
1615
+ $2 = smalltalk.send(self, "_new", []);
1616
+ smalltalk.send($2, "_theClass_", [aClass]);
1617
+ $3 = smalltalk.send($2, "_yourself", []);
1618
+ $1 = $3;
1619
+ return $1;
1620
+ },
1621
+ args: ["aClass"],
1622
+ source: "on: aClass\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
1623
+ messageSends: ["theClass:", "new", "yourself"],
1624
+ referencedClasses: []
1625
+ }),
1626
+ smalltalk.SemanticAnalyzer.klass);
1627
+
1628
+