resin 0.3.0 → 0.3.1

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 (50) hide show
  1. data/amber/bin/amberc +4 -3
  2. data/amber/js/IDE.deploy.js +147 -45
  3. data/amber/js/IDE.js +155 -53
  4. data/amber/js/Kernel-Classes.deploy.js +20 -14
  5. data/amber/js/Kernel-Classes.js +29 -18
  6. data/amber/js/Kernel-Collections.deploy.js +82 -0
  7. data/amber/js/Kernel-Collections.js +102 -0
  8. data/amber/js/Kernel-Methods.deploy.js +374 -261
  9. data/amber/js/Kernel-Methods.js +417 -269
  10. data/amber/js/Kernel-Objects.deploy.js +90 -28
  11. data/amber/js/Kernel-Objects.js +121 -34
  12. data/amber/js/Kernel-Tests.deploy.js +35 -0
  13. data/amber/js/Kernel-Tests.js +45 -0
  14. data/amber/js/SUnit.deploy.js +175 -17
  15. data/amber/js/SUnit.js +237 -24
  16. data/amber/js/amber.js +2 -1
  17. data/amber/js/boot.js +74 -18
  18. data/amber/js/lib/es5-shim-2.0.2/CHANGES +93 -0
  19. data/amber/js/lib/es5-shim-2.0.2/CONTRIBUTORS.md +25 -0
  20. data/amber/js/lib/es5-shim-2.0.2/LICENSE +19 -0
  21. data/amber/js/lib/es5-shim-2.0.2/README.md +161 -0
  22. data/amber/js/lib/es5-shim-2.0.2/es5-sham.js +348 -0
  23. data/amber/js/lib/es5-shim-2.0.2/es5-sham.min.js +6 -0
  24. data/amber/js/lib/es5-shim-2.0.2/es5-shim.js +963 -0
  25. data/amber/js/lib/es5-shim-2.0.2/es5-shim.min.js +16 -0
  26. data/amber/js/lib/es5-shim-2.0.2/minify +2 -0
  27. data/amber/js/lib/es5-shim-2.0.2/package.json +31 -0
  28. data/amber/js/lib/es5-shim-2.0.2/tests/helpers/h-kill.js +59 -0
  29. data/amber/js/lib/es5-shim-2.0.2/tests/helpers/h-matchers.js +34 -0
  30. data/amber/js/lib/es5-shim-2.0.2/tests/helpers/h.js +3 -0
  31. data/amber/js/lib/es5-shim-2.0.2/tests/index.html +62 -0
  32. data/amber/js/lib/es5-shim-2.0.2/tests/lib/jasmine-html.js +190 -0
  33. data/amber/js/lib/es5-shim-2.0.2/tests/lib/jasmine.css +166 -0
  34. data/amber/js/lib/es5-shim-2.0.2/tests/lib/jasmine.js +2477 -0
  35. data/amber/js/lib/es5-shim-2.0.2/tests/lib/jasmine_favicon.png +0 -0
  36. data/amber/js/lib/es5-shim-2.0.2/tests/lib/json2.js +478 -0
  37. data/amber/js/lib/es5-shim-2.0.2/tests/spec/s-array.js +1138 -0
  38. data/amber/js/lib/es5-shim-2.0.2/tests/spec/s-date.js +117 -0
  39. data/amber/js/lib/es5-shim-2.0.2/tests/spec/s-function.js +147 -0
  40. data/amber/js/lib/es5-shim-2.0.2/tests/spec/s-object.js +84 -0
  41. data/amber/js/lib/es5-shim-2.0.2/tests/spec/s-string.js +24 -0
  42. data/amber/st/IDE.st +15 -16
  43. data/amber/st/Kernel-Classes.st +9 -9
  44. data/amber/st/Kernel-Collections.st +37 -0
  45. data/amber/st/Kernel-Methods.st +63 -8
  46. data/amber/st/Kernel-Objects.st +34 -7
  47. data/amber/st/Kernel-Tests.st +10 -0
  48. data/amber/st/SUnit.st +86 -9
  49. metadata +44 -21
  50. data/amber/js/compat.js +0 -22
@@ -6,11 +6,11 @@ smalltalk.addMethod(
6
6
  smalltalk.method({
7
7
  selector: "applyTo:arguments:",
8
8
  category: 'evaluating',
9
- fn: function (anObject,aCollection){
10
- var self=this;
11
- return self.apply(anObject, aCollection);
12
- ;
13
- return self},
9
+ fn: function (anObject, aCollection) {
10
+ var self = this;
11
+ return self.apply(anObject, aCollection);
12
+ return self;
13
+ },
14
14
  args: ["anObject", "aCollection"],
15
15
  source: "applyTo: anObject arguments: aCollection\x0a\x09<return self.apply(anObject, aCollection)>",
16
16
  messageSends: [],
@@ -23,11 +23,11 @@ smalltalk.addMethod(
23
23
  smalltalk.method({
24
24
  selector: "compiledSource",
25
25
  category: 'accessing',
26
- fn: function (){
27
- var self=this;
28
- return self.toString();
29
- ;
30
- return self},
26
+ fn: function () {
27
+ var self = this;
28
+ return self.toString();
29
+ return self;
30
+ },
31
31
  args: [],
32
32
  source: "compiledSource\x0a\x09<return self.toString()>",
33
33
  messageSends: [],
@@ -42,40 +42,43 @@ selector: "ensure:",
42
42
  category: 'evaluating',
43
43
  fn: function (aBlock){
44
44
  var self=this;
45
- var $1;
46
- var success;
47
- success=false;
48
- $1=smalltalk.send((function(){
49
- smalltalk.send(self,"_value",[]);
50
- success=true;
51
- success;
52
- return smalltalk.send(aBlock,"_value",[]);
53
- }),"_on_do_",[(smalltalk.Error || Error),(function(ex){
54
- if(! smalltalk.assert(success)){
55
- smalltalk.send(aBlock,"_value",[]);
56
- };
57
- return smalltalk.send(ex,"_signal",[]);
58
- })]);
59
- return $1;
60
- },
45
+ try{self()}finally{return aBlock._value()};
46
+ ;
47
+ return self},
61
48
  args: ["aBlock"],
62
- source: "ensure: aBlock\x0a\x09| success |\x0a\x09success := false.\x0a\x09^[self value. success := true. aBlock value]\x0a\x09\x09on: Error\x0a\x09\x09do: [:ex |\x0a\x09\x09\x09success ifFalse: [aBlock value].\x0a\x09\x09\x09ex signal]",
63
- messageSends: ["on:do:", "ifFalse:", "value", "signal"],
64
- referencedClasses: ["Error"]
49
+ source: "ensure: aBlock\x0a\x09<try{self()}finally{return aBlock._value()}>",
50
+ messageSends: [],
51
+ referencedClasses: []
65
52
  }),
66
53
  smalltalk.BlockClosure);
67
54
 
68
55
  smalltalk.addMethod(
69
- "_new",
56
+ "_fork",
70
57
  smalltalk.method({
71
- selector: "new",
72
- category: 'evaluating',
58
+ selector: "fork",
59
+ category: 'timeout/interval',
73
60
  fn: function (){
74
61
  var self=this;
75
- return new self();
76
- ;
62
+ smalltalk.send(smalltalk.send((smalltalk.ForkPool || ForkPool),"_default",[]),"_fork_",[self]);
77
63
  return self},
78
64
  args: [],
65
+ source: "fork\x0a\x09ForkPool default fork: self",
66
+ messageSends: ["fork:", "default"],
67
+ referencedClasses: ["ForkPool"]
68
+ }),
69
+ smalltalk.BlockClosure);
70
+
71
+ smalltalk.addMethod(
72
+ "_new",
73
+ smalltalk.method({
74
+ selector: "new",
75
+ category: 'evaluating',
76
+ fn: function () {
77
+ var self = this;
78
+ return new self;
79
+ return self;
80
+ },
81
+ args: [],
79
82
  source: "new\x0a\x09\x22Use the receiver as a JS constructor. \x0a\x09*Do not* use this method to instanciate Smalltalk objects!\x22\x0a\x09<return new self()>",
80
83
  messageSends: [],
81
84
  referencedClasses: []
@@ -87,11 +90,11 @@ smalltalk.addMethod(
87
90
  smalltalk.method({
88
91
  selector: "newValue:",
89
92
  category: 'evaluating',
90
- fn: function (anObject){
91
- var self=this;
92
- return new self(anObject);
93
- ;
94
- return self},
93
+ fn: function (anObject) {
94
+ var self = this;
95
+ return new self(anObject);
96
+ return self;
97
+ },
95
98
  args: ["anObject"],
96
99
  source: "newValue: anObject\x0a\x09\x22Use the receiver as a JS constructor. \x0a\x09*Do not* use this method to instanciate Smalltalk objects!\x22\x0a\x09<return new self(anObject)>",
97
100
  messageSends: [],
@@ -104,11 +107,11 @@ smalltalk.addMethod(
104
107
  smalltalk.method({
105
108
  selector: "newValue:value:",
106
109
  category: 'evaluating',
107
- fn: function (anObject,anObject2){
108
- var self=this;
109
- return new self(anObject, anObject2);
110
- ;
111
- return self},
110
+ fn: function (anObject, anObject2) {
111
+ var self = this;
112
+ return new self(anObject, anObject2);
113
+ return self;
114
+ },
112
115
  args: ["anObject", "anObject2"],
113
116
  source: "newValue: anObject value: anObject2\x0a\x09\x22Use the receiver as a JS constructor. \x0a\x09*Do not* use this method to instanciate Smalltalk objects!\x22\x0a\x09<return new self(anObject, anObject2)>",
114
117
  messageSends: [],
@@ -121,11 +124,11 @@ smalltalk.addMethod(
121
124
  smalltalk.method({
122
125
  selector: "newValue:value:value:",
123
126
  category: 'evaluating',
124
- fn: function (anObject,anObject2,anObject3){
125
- var self=this;
126
- return new self(anObject, anObject2);
127
- ;
128
- return self},
127
+ fn: function (anObject, anObject2, anObject3) {
128
+ var self = this;
129
+ return new self(anObject, anObject2);
130
+ return self;
131
+ },
129
132
  args: ["anObject", "anObject2", "anObject3"],
130
133
  source: "newValue: anObject value: anObject2 value: anObject3\x0a\x09\x22Use the receiver as a JS constructor. \x0a\x09*Do not* use this method to instanciate Smalltalk objects!\x22\x0a\x09<return new self(anObject, anObject2)>",
131
134
  messageSends: [],
@@ -138,11 +141,11 @@ smalltalk.addMethod(
138
141
  smalltalk.method({
139
142
  selector: "numArgs",
140
143
  category: 'accessing',
141
- fn: function (){
142
- var self=this;
143
- return self.length;
144
- ;
145
- return self},
144
+ fn: function () {
145
+ var self = this;
146
+ return self.length;
147
+ return self;
148
+ },
146
149
  args: [],
147
150
  source: "numArgs\x0a\x09<return self.length>",
148
151
  messageSends: [],
@@ -155,18 +158,11 @@ smalltalk.addMethod(
155
158
  smalltalk.method({
156
159
  selector: "on:do:",
157
160
  category: 'error handling',
158
- fn: function (anErrorClass,aBlock){
159
- var self=this;
160
- var $2,$1;
161
- $1=smalltalk.send(self,"_try_catch_",[self,(function(error){
162
- $2=smalltalk.send(error,"_isKindOf_",[anErrorClass]);
163
- if(smalltalk.assert($2)){
164
- return smalltalk.send(aBlock,"_value_",[error]);
165
- } else {
166
- return smalltalk.send(error,"_signal",[]);
167
- };
168
- })]);
169
- return $1;
161
+ fn: function (anErrorClass, aBlock) {
162
+ var self = this;
163
+ var $2, $1;
164
+ $1 = smalltalk.send(self, "_try_catch_", [self, function (error) {$2 = smalltalk.send(error, "_isKindOf_", [anErrorClass]);if (smalltalk.assert($2)) {return smalltalk.send(aBlock, "_value_", [error]);} else {return smalltalk.send(error, "_signal", []);}}]);
165
+ return $1;
170
166
  },
171
167
  args: ["anErrorClass", "aBlock"],
172
168
  source: "on: anErrorClass do: aBlock\x0a\x09^self try: self catch: [:error |\x0a\x09 (error isKindOf: anErrorClass) \x0a\x09 ifTrue: [aBlock value: error]\x0a\x09 ifFalse: [error signal]]",
@@ -180,11 +176,11 @@ smalltalk.addMethod(
180
176
  smalltalk.method({
181
177
  selector: "timeToRun",
182
178
  category: 'evaluating',
183
- fn: function (){
184
- var self=this;
185
- var $1;
186
- $1=smalltalk.send((smalltalk.Date || Date),"_millisecondsToRun_",[self]);
187
- return $1;
179
+ fn: function () {
180
+ var self = this;
181
+ var $1;
182
+ $1 = smalltalk.send(smalltalk.Date || Date, "_millisecondsToRun_", [self]);
183
+ return $1;
188
184
  },
189
185
  args: [],
190
186
  source: "timeToRun\x0a\x09\x22Answer the number of milliseconds taken to execute this block.\x22\x0a\x0a\x09^ Date millisecondsToRun: self",
@@ -198,11 +194,11 @@ smalltalk.addMethod(
198
194
  smalltalk.method({
199
195
  selector: "value",
200
196
  category: 'evaluating',
201
- fn: function (){
202
- var self=this;
203
- return self();;
204
- ;
205
- return self},
197
+ fn: function () {
198
+ var self = this;
199
+ return self();
200
+ return self;
201
+ },
206
202
  args: [],
207
203
  source: "value\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<return self();>",
208
204
  messageSends: [],
@@ -215,11 +211,11 @@ smalltalk.addMethod(
215
211
  smalltalk.method({
216
212
  selector: "value:",
217
213
  category: 'evaluating',
218
- fn: function (anArg){
219
- var self=this;
220
- return self(anArg);;
221
- ;
222
- return self},
214
+ fn: function (anArg) {
215
+ var self = this;
216
+ return self(anArg);
217
+ return self;
218
+ },
223
219
  args: ["anArg"],
224
220
  source: "value: anArg\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<return self(anArg);>",
225
221
  messageSends: [],
@@ -232,11 +228,11 @@ smalltalk.addMethod(
232
228
  smalltalk.method({
233
229
  selector: "value:value:",
234
230
  category: 'evaluating',
235
- fn: function (firstArg,secondArg){
236
- var self=this;
237
- return self(firstArg, secondArg);;
238
- ;
239
- return self},
231
+ fn: function (firstArg, secondArg) {
232
+ var self = this;
233
+ return self(firstArg, secondArg);
234
+ return self;
235
+ },
240
236
  args: ["firstArg", "secondArg"],
241
237
  source: "value: firstArg value: secondArg\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<return self(firstArg, secondArg);>",
242
238
  messageSends: [],
@@ -249,11 +245,11 @@ smalltalk.addMethod(
249
245
  smalltalk.method({
250
246
  selector: "value:value:value:",
251
247
  category: 'evaluating',
252
- fn: function (firstArg,secondArg,thirdArg){
253
- var self=this;
254
- return self(firstArg, secondArg, thirdArg);;
255
- ;
256
- return self},
248
+ fn: function (firstArg, secondArg, thirdArg) {
249
+ var self = this;
250
+ return self(firstArg, secondArg, thirdArg);
251
+ return self;
252
+ },
257
253
  args: ["firstArg", "secondArg", "thirdArg"],
258
254
  source: "value: firstArg value: secondArg value: thirdArg\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<return self(firstArg, secondArg, thirdArg);>",
259
255
  messageSends: [],
@@ -266,11 +262,11 @@ smalltalk.addMethod(
266
262
  smalltalk.method({
267
263
  selector: "valueWithInterval:",
268
264
  category: 'timeout/interval',
269
- fn: function (aNumber){
270
- var self=this;
271
- return setInterval(self, aNumber);
272
- ;
273
- return self},
265
+ fn: function (aNumber) {
266
+ var self = this;
267
+ return setInterval(self, aNumber);
268
+ return self;
269
+ },
274
270
  args: ["aNumber"],
275
271
  source: "valueWithInterval: aNumber\x0a\x09<return setInterval(self, aNumber)>",
276
272
  messageSends: [],
@@ -283,11 +279,11 @@ smalltalk.addMethod(
283
279
  smalltalk.method({
284
280
  selector: "valueWithPossibleArguments:",
285
281
  category: 'evaluating',
286
- fn: function (aCollection){
287
- var self=this;
288
- return self.apply(null, aCollection);;
289
- ;
290
- return self},
282
+ fn: function (aCollection) {
283
+ var self = this;
284
+ return self.apply(null, aCollection);
285
+ return self;
286
+ },
291
287
  args: ["aCollection"],
292
288
  source: "valueWithPossibleArguments: aCollection\x0a\x09<return self.apply(null, aCollection);>",
293
289
  messageSends: [],
@@ -300,11 +296,11 @@ smalltalk.addMethod(
300
296
  smalltalk.method({
301
297
  selector: "valueWithTimeout:",
302
298
  category: 'timeout/interval',
303
- fn: function (aNumber){
304
- var self=this;
305
- return setTimeout(self, aNumber);
306
- ;
307
- return self},
299
+ fn: function (aNumber) {
300
+ var self = this;
301
+ return setTimeout(self, aNumber);
302
+ return self;
303
+ },
308
304
  args: ["aNumber"],
309
305
  source: "valueWithTimeout: aNumber\x0a\x09<return setTimeout(self, aNumber)>",
310
306
  messageSends: [],
@@ -317,11 +313,11 @@ smalltalk.addMethod(
317
313
  smalltalk.method({
318
314
  selector: "whileFalse",
319
315
  category: 'controlling',
320
- fn: function (){
321
- var self=this;
322
- smalltalk.send(self,"_whileFalse_",[(function(){
323
- })]);
324
- return self},
316
+ fn: function () {
317
+ var self = this;
318
+ smalltalk.send(self, "_whileFalse_", [function () {}]);
319
+ return self;
320
+ },
325
321
  args: [],
326
322
  source: "whileFalse\x0a\x09\x22inlined in the Compiler\x22\x0a\x09self whileFalse: []",
327
323
  messageSends: ["whileFalse:"],
@@ -334,11 +330,13 @@ smalltalk.addMethod(
334
330
  smalltalk.method({
335
331
  selector: "whileFalse:",
336
332
  category: 'controlling',
337
- fn: function (aBlock){
338
- var self=this;
339
- while(!self()) {aBlock()};
340
- ;
341
- return self},
333
+ fn: function (aBlock) {
334
+ var self = this;
335
+ while (!self()) {
336
+ aBlock();
337
+ }
338
+ return self;
339
+ },
342
340
  args: ["aBlock"],
343
341
  source: "whileFalse: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<while(!self()) {aBlock()}>",
344
342
  messageSends: [],
@@ -351,11 +349,11 @@ smalltalk.addMethod(
351
349
  smalltalk.method({
352
350
  selector: "whileTrue",
353
351
  category: 'controlling',
354
- fn: function (){
355
- var self=this;
356
- smalltalk.send(self,"_whileTrue_",[(function(){
357
- })]);
358
- return self},
352
+ fn: function () {
353
+ var self = this;
354
+ smalltalk.send(self, "_whileTrue_", [function () {}]);
355
+ return self;
356
+ },
359
357
  args: [],
360
358
  source: "whileTrue\x0a\x09\x22inlined in the Compiler\x22\x0a\x09self whileTrue: []",
361
359
  messageSends: ["whileTrue:"],
@@ -368,11 +366,13 @@ smalltalk.addMethod(
368
366
  smalltalk.method({
369
367
  selector: "whileTrue:",
370
368
  category: 'controlling',
371
- fn: function (aBlock){
372
- var self=this;
373
- while(self()) {aBlock()};
374
- ;
375
- return self},
369
+ fn: function (aBlock) {
370
+ var self = this;
371
+ while (self()) {
372
+ aBlock();
373
+ }
374
+ return self;
375
+ },
376
376
  args: ["aBlock"],
377
377
  source: "whileTrue: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<while(self()) {aBlock()}>",
378
378
  messageSends: [],
@@ -389,11 +389,11 @@ smalltalk.addMethod(
389
389
  smalltalk.method({
390
390
  selector: "arguments",
391
391
  category: 'accessing',
392
- fn: function (){
393
- var self=this;
394
- return self.args || [];
395
- ;
396
- return self},
392
+ fn: function () {
393
+ var self = this;
394
+ return self.args || [];
395
+ return self;
396
+ },
397
397
  args: [],
398
398
  source: "arguments\x0a\x09<return self.args || []>",
399
399
  messageSends: [],
@@ -406,16 +406,16 @@ smalltalk.addMethod(
406
406
  smalltalk.method({
407
407
  selector: "category",
408
408
  category: 'accessing',
409
- fn: function (){
410
- var self=this;
411
- var $2,$1;
412
- $2=smalltalk.send(self,"_basicAt_",["category"]);
413
- if(($receiver = $2) == nil || $receiver == undefined){
414
- $1="";
415
- } else {
416
- $1=$2;
417
- };
418
- return $1;
409
+ fn: function () {
410
+ var self = this;
411
+ var $2, $1;
412
+ $2 = smalltalk.send(self, "_basicAt_", ["category"]);
413
+ if (($receiver = $2) == nil || $receiver == undefined) {
414
+ $1 = "";
415
+ } else {
416
+ $1 = $2;
417
+ }
418
+ return $1;
419
419
  },
420
420
  args: [],
421
421
  source: "category\x0a\x09^(self basicAt: 'category') ifNil: ['']",
@@ -431,11 +431,25 @@ selector: "category:",
431
431
  category: 'accessing',
432
432
  fn: function (aString){
433
433
  var self=this;
434
+ var $1;
435
+ var oldCategory;
436
+ oldCategory=smalltalk.send(self,"_category",[]);
434
437
  smalltalk.send(self,"_basicAt_put_",["category",aString]);
438
+ $1=smalltalk.send(self,"_methodClass",[]);
439
+ if(($receiver = $1) == nil || $receiver == undefined){
440
+ $1;
441
+ } else {
442
+ smalltalk.send(smalltalk.send(smalltalk.send(self,"_methodClass",[]),"_organization",[]),"_addElement_",[aString]);
443
+ smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self,"_methodClass",[]),"_methods",[]),"_select_",[(function(each){
444
+ return smalltalk.send(smalltalk.send(each,"_category",[]),"__eq",[oldCategory]);
445
+ })]),"_ifEmpty_",[(function(){
446
+ return smalltalk.send(smalltalk.send(smalltalk.send(self,"_methodClass",[]),"_organization",[]),"_removeElement_",[oldCategory]);
447
+ })]);
448
+ };
435
449
  return self},
436
450
  args: ["aString"],
437
- source: "category: aString\x0a\x09self basicAt: 'category' put: aString",
438
- messageSends: ["basicAt:put:"],
451
+ source: "category: aString\x0a\x09| oldCategory |\x0a oldCategory := self category.\x0a\x09self basicAt: 'category' put: aString.\x0a \x0a self methodClass ifNotNil: [\x0a \x09self methodClass organization addElement: aString.\x0a \x0a\x09\x09(self methodClass methods \x0a \x09\x09select: [ :each | each category = oldCategory ])\x0a \x09ifEmpty: [ self methodClass organization removeElement: oldCategory ] ]",
452
+ messageSends: ["category", "basicAt:put:", "ifNotNil:", "addElement:", "organization", "methodClass", "ifEmpty:", "removeElement:", "select:", "=", "methods"],
439
453
  referencedClasses: []
440
454
  }),
441
455
  smalltalk.CompiledMethod);
@@ -445,11 +459,11 @@ smalltalk.addMethod(
445
459
  smalltalk.method({
446
460
  selector: "fn",
447
461
  category: 'accessing',
448
- fn: function (){
449
- var self=this;
450
- var $1;
451
- $1=smalltalk.send(self,"_basicAt_",["fn"]);
452
- return $1;
462
+ fn: function () {
463
+ var self = this;
464
+ var $1;
465
+ $1 = smalltalk.send(self, "_basicAt_", ["fn"]);
466
+ return $1;
453
467
  },
454
468
  args: [],
455
469
  source: "fn\x0a\x09^self basicAt: 'fn'",
@@ -463,10 +477,11 @@ smalltalk.addMethod(
463
477
  smalltalk.method({
464
478
  selector: "fn:",
465
479
  category: 'accessing',
466
- fn: function (aBlock){
467
- var self=this;
468
- smalltalk.send(self,"_basicAt_put_",["fn",aBlock]);
469
- return self},
480
+ fn: function (aBlock) {
481
+ var self = this;
482
+ smalltalk.send(self, "_basicAt_put_", ["fn", aBlock]);
483
+ return self;
484
+ },
470
485
  args: ["aBlock"],
471
486
  source: "fn: aBlock\x0a\x09self basicAt: 'fn' put: aBlock",
472
487
  messageSends: ["basicAt:put:"],
@@ -479,11 +494,11 @@ smalltalk.addMethod(
479
494
  smalltalk.method({
480
495
  selector: "messageSends",
481
496
  category: 'accessing',
482
- fn: function (){
483
- var self=this;
484
- var $1;
485
- $1=smalltalk.send(self,"_basicAt_",["messageSends"]);
486
- return $1;
497
+ fn: function () {
498
+ var self = this;
499
+ var $1;
500
+ $1 = smalltalk.send(self, "_basicAt_", ["messageSends"]);
501
+ return $1;
487
502
  },
488
503
  args: [],
489
504
  source: "messageSends\x0a\x09^self basicAt: 'messageSends'",
@@ -497,11 +512,11 @@ smalltalk.addMethod(
497
512
  smalltalk.method({
498
513
  selector: "methodClass",
499
514
  category: 'accessing',
500
- fn: function (){
501
- var self=this;
502
- var $1;
503
- $1=smalltalk.send(self,"_basicAt_",["methodClass"]);
504
- return $1;
515
+ fn: function () {
516
+ var self = this;
517
+ var $1;
518
+ $1 = smalltalk.send(self, "_basicAt_", ["methodClass"]);
519
+ return $1;
505
520
  },
506
521
  args: [],
507
522
  source: "methodClass\x0a\x09^self basicAt: 'methodClass'",
@@ -515,11 +530,11 @@ smalltalk.addMethod(
515
530
  smalltalk.method({
516
531
  selector: "protocol",
517
532
  category: 'accessing',
518
- fn: function (){
519
- var self=this;
520
- var $1;
521
- $1=smalltalk.send(self,"_category",[]);
522
- return $1;
533
+ fn: function () {
534
+ var self = this;
535
+ var $1;
536
+ $1 = smalltalk.send(self, "_category", []);
537
+ return $1;
523
538
  },
524
539
  args: [],
525
540
  source: "protocol\x0a\x09^ self category",
@@ -533,11 +548,11 @@ smalltalk.addMethod(
533
548
  smalltalk.method({
534
549
  selector: "referencedClasses",
535
550
  category: 'accessing',
536
- fn: function (){
537
- var self=this;
538
- var $1;
539
- $1=smalltalk.send(self,"_basicAt_",["referencedClasses"]);
540
- return $1;
551
+ fn: function () {
552
+ var self = this;
553
+ var $1;
554
+ $1 = smalltalk.send(self, "_basicAt_", ["referencedClasses"]);
555
+ return $1;
541
556
  },
542
557
  args: [],
543
558
  source: "referencedClasses\x0a\x09^self basicAt: 'referencedClasses'",
@@ -551,11 +566,11 @@ smalltalk.addMethod(
551
566
  smalltalk.method({
552
567
  selector: "selector",
553
568
  category: 'accessing',
554
- fn: function (){
555
- var self=this;
556
- var $1;
557
- $1=smalltalk.send(self,"_basicAt_",["selector"]);
558
- return $1;
569
+ fn: function () {
570
+ var self = this;
571
+ var $1;
572
+ $1 = smalltalk.send(self, "_basicAt_", ["selector"]);
573
+ return $1;
559
574
  },
560
575
  args: [],
561
576
  source: "selector\x0a\x09^self basicAt: 'selector'",
@@ -569,10 +584,11 @@ smalltalk.addMethod(
569
584
  smalltalk.method({
570
585
  selector: "selector:",
571
586
  category: 'accessing',
572
- fn: function (aString){
573
- var self=this;
574
- smalltalk.send(self,"_basicAt_put_",["selector",aString]);
575
- return self},
587
+ fn: function (aString) {
588
+ var self = this;
589
+ smalltalk.send(self, "_basicAt_put_", ["selector", aString]);
590
+ return self;
591
+ },
576
592
  args: ["aString"],
577
593
  source: "selector: aString\x0a\x09self basicAt: 'selector' put: aString",
578
594
  messageSends: ["basicAt:put:"],
@@ -585,16 +601,16 @@ smalltalk.addMethod(
585
601
  smalltalk.method({
586
602
  selector: "source",
587
603
  category: 'accessing',
588
- fn: function (){
589
- var self=this;
590
- var $2,$1;
591
- $2=smalltalk.send(self,"_basicAt_",["source"]);
592
- if(($receiver = $2) == nil || $receiver == undefined){
593
- $1="";
594
- } else {
595
- $1=$2;
596
- };
597
- return $1;
604
+ fn: function () {
605
+ var self = this;
606
+ var $2, $1;
607
+ $2 = smalltalk.send(self, "_basicAt_", ["source"]);
608
+ if (($receiver = $2) == nil || $receiver == undefined) {
609
+ $1 = "";
610
+ } else {
611
+ $1 = $2;
612
+ }
613
+ return $1;
598
614
  },
599
615
  args: [],
600
616
  source: "source\x0a\x09^(self basicAt: 'source') ifNil: ['']",
@@ -608,10 +624,11 @@ smalltalk.addMethod(
608
624
  smalltalk.method({
609
625
  selector: "source:",
610
626
  category: 'accessing',
611
- fn: function (aString){
612
- var self=this;
613
- smalltalk.send(self,"_basicAt_put_",["source",aString]);
614
- return self},
627
+ fn: function (aString) {
628
+ var self = this;
629
+ smalltalk.send(self, "_basicAt_put_", ["source", aString]);
630
+ return self;
631
+ },
615
632
  args: ["aString"],
616
633
  source: "source: aString\x0a\x09self basicAt: 'source' put: aString",
617
634
  messageSends: ["basicAt:put:"],
@@ -621,6 +638,141 @@ smalltalk.CompiledMethod);
621
638
 
622
639
 
623
640
 
641
+ smalltalk.addClass('ForkPool', smalltalk.Object, ['poolSize', 'maxPoolSize', 'queue', 'worker'], 'Kernel-Methods');
642
+ smalltalk.addMethod(
643
+ "_addWorker",
644
+ smalltalk.method({
645
+ selector: "addWorker",
646
+ category: 'action',
647
+ fn: function (){
648
+ var self=this;
649
+ smalltalk.send(self["@worker"],"_valueWithTimeout_",[(0)]);
650
+ self["@poolSize"]=smalltalk.send(self["@poolSize"],"__plus",[(1)]);
651
+ return self},
652
+ args: [],
653
+ source: "addWorker\x0a\x09worker valueWithTimeout: 0.\x0a poolSize := poolSize + 1",
654
+ messageSends: ["valueWithTimeout:", "+"],
655
+ referencedClasses: []
656
+ }),
657
+ smalltalk.ForkPool);
658
+
659
+ smalltalk.addMethod(
660
+ "_fork_",
661
+ smalltalk.method({
662
+ selector: "fork:",
663
+ category: 'action',
664
+ fn: function (aBlock){
665
+ var self=this;
666
+ var $1;
667
+ $1=smalltalk.send(self["@poolSize"],"__lt",[self["@maxPoolSize"]]);
668
+ if(smalltalk.assert($1)){
669
+ smalltalk.send(self,"_addWorker",[]);
670
+ };
671
+ smalltalk.send(self["@queue"],"_back_",[aBlock]);
672
+ return self},
673
+ args: ["aBlock"],
674
+ source: "fork: aBlock\x0a\x09poolSize < maxPoolSize ifTrue: [ self addWorker ].\x0a\x09queue back: aBlock",
675
+ messageSends: ["ifTrue:", "addWorker", "<", "back:"],
676
+ referencedClasses: []
677
+ }),
678
+ smalltalk.ForkPool);
679
+
680
+ smalltalk.addMethod(
681
+ "_initialize",
682
+ smalltalk.method({
683
+ selector: "initialize",
684
+ category: 'initialization',
685
+ fn: function (){
686
+ var self=this;
687
+ var $1;
688
+ var sentinel;
689
+ self["@poolSize"]=(0);
690
+ self["@maxPoolSize"]=smalltalk.send(smalltalk.send(self,"_class",[]),"_defaultMaxPoolSize",[]);
691
+ self["@queue"]=smalltalk.send((smalltalk.Queue || Queue),"_new",[]);
692
+ sentinel=smalltalk.send((smalltalk.Object || Object),"_new",[]);
693
+ self["@worker"]=(function(){
694
+ var block;
695
+ self["@poolSize"]=smalltalk.send(self["@poolSize"],"__minus",[(1)]);
696
+ self["@poolSize"];
697
+ block=smalltalk.send(self["@queue"],"_frontIfAbsent_",[(function(){
698
+ return sentinel;
699
+ })]);
700
+ block;
701
+ $1=smalltalk.send(block,"__eq_eq",[sentinel]);
702
+ if(! smalltalk.assert($1)){
703
+ return smalltalk.send((function(){
704
+ return smalltalk.send(block,"_value",[]);
705
+ }),"_ensure_",[(function(){
706
+ return smalltalk.send(self,"_addWorker",[]);
707
+ })]);
708
+ };
709
+ });
710
+ return self},
711
+ args: [],
712
+ source: "initialize\x0a\x09| sentinel |\x0a\x09poolSize := 0.\x0a maxPoolSize := self class defaultMaxPoolSize.\x0a queue := Queue new.\x0a sentinel := Object new.\x0a worker := [\x0a\x09\x09| block |\x0a poolSize := poolSize - 1.\x0a\x09\x09block := queue frontIfAbsent: [ sentinel ].\x0a block == sentinel ifFalse: [\x0a \x09[ block value ] ensure: [ self addWorker ]]].",
713
+ messageSends: ["defaultMaxPoolSize", "class", "new", "-", "frontIfAbsent:", "ifFalse:", "ensure:", "addWorker", "value", "=="],
714
+ referencedClasses: ["Queue", "Object"]
715
+ }),
716
+ smalltalk.ForkPool);
717
+
718
+
719
+ smalltalk.ForkPool.klass.iVarNames = ['default'];
720
+ smalltalk.addMethod(
721
+ "_default",
722
+ smalltalk.method({
723
+ selector: "default",
724
+ category: 'accessing',
725
+ fn: function (){
726
+ var self=this;
727
+ var $1;
728
+ if(($receiver = self["@default"]) == nil || $receiver == undefined){
729
+ self["@default"]=smalltalk.send(self,"_new",[]);
730
+ $1=self["@default"];
731
+ } else {
732
+ $1=self["@default"];
733
+ };
734
+ return $1;
735
+ },
736
+ args: [],
737
+ source: "default\x0a\x09^default ifNil: [ default := self new ]",
738
+ messageSends: ["ifNil:", "new"],
739
+ referencedClasses: []
740
+ }),
741
+ smalltalk.ForkPool.klass);
742
+
743
+ smalltalk.addMethod(
744
+ "_defaultMaxPoolSize",
745
+ smalltalk.method({
746
+ selector: "defaultMaxPoolSize",
747
+ category: 'accessing',
748
+ fn: function (){
749
+ var self=this;
750
+ return (100);
751
+ },
752
+ args: [],
753
+ source: "defaultMaxPoolSize\x0a\x09^100",
754
+ messageSends: [],
755
+ referencedClasses: []
756
+ }),
757
+ smalltalk.ForkPool.klass);
758
+
759
+ smalltalk.addMethod(
760
+ "_resetDefault",
761
+ smalltalk.method({
762
+ selector: "resetDefault",
763
+ category: 'accessing',
764
+ fn: function (){
765
+ var self=this;
766
+ self["@default"]=nil;
767
+ return self},
768
+ args: [],
769
+ source: "resetDefault\x0a\x09default := nil",
770
+ messageSends: [],
771
+ referencedClasses: []
772
+ }),
773
+ smalltalk.ForkPool.klass);
774
+
775
+
624
776
  smalltalk.addClass('Message', smalltalk.Object, ['selector', 'arguments'], 'Kernel-Methods');
625
777
  smalltalk.Message.comment="Generally, the system does not use instances of Message for efficiency reasons.\x0aHowever, when a message is not understood by its receiver, the interpreter will make up an instance of it in order to capture the information involved in an actual message transmission. \x0aThis instance is sent it as an argument with the message `doesNotUnderstand:` to the receiver.\x0a\x0aSee boot.js, `messageNotUnderstood` and its counterpart `Object>>doesNotUnderstand:`"
626
778
  smalltalk.addMethod(
@@ -628,9 +780,9 @@ smalltalk.addMethod(
628
780
  smalltalk.method({
629
781
  selector: "arguments",
630
782
  category: 'accessing',
631
- fn: function (){
632
- var self=this;
633
- return self["@arguments"];
783
+ fn: function () {
784
+ var self = this;
785
+ return self['@arguments'];
634
786
  },
635
787
  args: [],
636
788
  source: "arguments\x0a\x09^arguments",
@@ -644,10 +796,11 @@ smalltalk.addMethod(
644
796
  smalltalk.method({
645
797
  selector: "arguments:",
646
798
  category: 'accessing',
647
- fn: function (anArray){
648
- var self=this;
649
- self["@arguments"]=anArray;
650
- return self},
799
+ fn: function (anArray) {
800
+ var self = this;
801
+ self['@arguments'] = anArray;
802
+ return self;
803
+ },
651
804
  args: ["anArray"],
652
805
  source: "arguments: anArray\x0a\x09arguments := anArray",
653
806
  messageSends: [],
@@ -660,17 +813,11 @@ smalltalk.addMethod(
660
813
  smalltalk.method({
661
814
  selector: "printString",
662
815
  category: 'printing',
663
- fn: function (){
664
- var self=this;
665
- var $2,$1;
666
- $1=smalltalk.send((smalltalk.String || String),"_streamContents_",[(function(aStream){
667
- smalltalk.send(aStream,"_nextPutAll_",[smalltalk.send(self,"_printString",[],smalltalk.Object)]);
668
- smalltalk.send(aStream,"_nextPutAll_",["("]);
669
- smalltalk.send(aStream,"_nextPutAll_",[self["@selector"]]);
670
- $2=smalltalk.send(aStream,"_nextPutAll_",[")"]);
671
- return $2;
672
- })]);
673
- return $1;
816
+ fn: function () {
817
+ var self = this;
818
+ var $2, $1;
819
+ $1 = smalltalk.send(smalltalk.String || String, "_streamContents_", [function (aStream) {smalltalk.send(aStream, "_nextPutAll_", [smalltalk.send(self, "_printString", [], smalltalk.Object)]);smalltalk.send(aStream, "_nextPutAll_", ["("]);smalltalk.send(aStream, "_nextPutAll_", [self['@selector']]);$2 = smalltalk.send(aStream, "_nextPutAll_", [")"]);return $2;}]);
820
+ return $1;
674
821
  },
675
822
  args: [],
676
823
  source: "printString\x0a\x09^ String streamContents: [:aStream| \x0a \x09\x09\x09\x09aStream \x0a \x09\x09\x09\x09\x09nextPutAll: super printString;\x0a \x09\x09\x09\x09\x09nextPutAll: '(';\x0a \x09\x09\x09\x09\x09nextPutAll: selector;\x0a \x09\x09\x09\x09\x09nextPutAll: ')' \x09\x09\x09\x09]",
@@ -684,9 +831,9 @@ smalltalk.addMethod(
684
831
  smalltalk.method({
685
832
  selector: "selector",
686
833
  category: 'accessing',
687
- fn: function (){
688
- var self=this;
689
- return self["@selector"];
834
+ fn: function () {
835
+ var self = this;
836
+ return self['@selector'];
690
837
  },
691
838
  args: [],
692
839
  source: "selector\x0a\x09^selector",
@@ -700,10 +847,11 @@ smalltalk.addMethod(
700
847
  smalltalk.method({
701
848
  selector: "selector:",
702
849
  category: 'accessing',
703
- fn: function (aString){
704
- var self=this;
705
- self["@selector"]=aString;
706
- return self},
850
+ fn: function (aString) {
851
+ var self = this;
852
+ self['@selector'] = aString;
853
+ return self;
854
+ },
707
855
  args: ["aString"],
708
856
  source: "selector: aString\x0a\x09selector := aString",
709
857
  messageSends: [],
@@ -716,11 +864,11 @@ smalltalk.addMethod(
716
864
  smalltalk.method({
717
865
  selector: "sendTo:",
718
866
  category: 'printing',
719
- fn: function (anObject){
720
- var self=this;
721
- var $1;
722
- $1=smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk),"_current",[]),"_send_to_arguments_",[smalltalk.send(self,"_selector",[]),anObject,smalltalk.send(self,"_arguments",[])]);
723
- return $1;
867
+ fn: function (anObject) {
868
+ var self = this;
869
+ var $1;
870
+ $1 = smalltalk.send(smalltalk.send(smalltalk.Smalltalk || Smalltalk, "_current", []), "_send_to_arguments_", [smalltalk.send(self, "_selector", []), anObject, smalltalk.send(self, "_arguments", [])]);
871
+ return $1;
724
872
  },
725
873
  args: ["anObject"],
726
874
  source: "sendTo: anObject\x0a\x09^ Smalltalk current send: self selector to: anObject arguments: self arguments",
@@ -735,15 +883,15 @@ smalltalk.addMethod(
735
883
  smalltalk.method({
736
884
  selector: "selector:arguments:",
737
885
  category: 'instance creation',
738
- fn: function (aString,anArray){
739
- var self=this;
740
- var $2,$3,$1;
741
- $2=smalltalk.send(self,"_new",[]);
742
- smalltalk.send($2,"_selector_",[aString]);
743
- smalltalk.send($2,"_arguments_",[anArray]);
744
- $3=smalltalk.send($2,"_yourself",[]);
745
- $1=$3;
746
- return $1;
886
+ fn: function (aString, anArray) {
887
+ var self = this;
888
+ var $2, $3, $1;
889
+ $2 = smalltalk.send(self, "_new", []);
890
+ smalltalk.send($2, "_selector_", [aString]);
891
+ smalltalk.send($2, "_arguments_", [anArray]);
892
+ $3 = smalltalk.send($2, "_yourself", []);
893
+ $1 = $3;
894
+ return $1;
747
895
  },
748
896
  args: ["aString", "anArray"],
749
897
  source: "selector: aString arguments: anArray\x0a\x09^self new\x0a\x09\x09selector: aString;\x0a\x09\x09arguments: anArray;\x0a\x09\x09yourself",
@@ -760,11 +908,11 @@ smalltalk.addMethod(
760
908
  smalltalk.method({
761
909
  selector: "asString",
762
910
  category: 'accessing',
763
- fn: function (){
764
- var self=this;
765
- var $1;
766
- $1=smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self,"_receiver",[]),"_class",[]),"_printString",[]),"__comma",[" >> "]),"__comma",[smalltalk.send(self,"_selector",[])]);
767
- return $1;
911
+ fn: function () {
912
+ var self = this;
913
+ var $1;
914
+ $1 = smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_receiver", []), "_class", []), "_printString", []), "__comma", [" >> "]), "__comma", [smalltalk.send(self, "_selector", [])]);
915
+ return $1;
768
916
  },
769
917
  args: [],
770
918
  source: "asString\x0a\x09^self receiver class printString, ' >> ', self selector",
@@ -778,11 +926,11 @@ smalltalk.addMethod(
778
926
  smalltalk.method({
779
927
  selector: "home",
780
928
  category: 'accessing',
781
- fn: function (){
782
- var self=this;
783
- return self.homeContext;
784
- ;
785
- return self},
929
+ fn: function () {
930
+ var self = this;
931
+ return self.homeContext;
932
+ return self;
933
+ },
786
934
  args: [],
787
935
  source: "home\x0a\x09<return self.homeContext>",
788
936
  messageSends: [],
@@ -795,11 +943,11 @@ smalltalk.addMethod(
795
943
  smalltalk.method({
796
944
  selector: "pc",
797
945
  category: 'accessing',
798
- fn: function (){
799
- var self=this;
800
- return self.pc;
801
- ;
802
- return self},
946
+ fn: function () {
947
+ var self = this;
948
+ return self.pc;
949
+ return self;
950
+ },
803
951
  args: [],
804
952
  source: "pc\x0a\x09<return self.pc>",
805
953
  messageSends: [],
@@ -812,11 +960,11 @@ smalltalk.addMethod(
812
960
  smalltalk.method({
813
961
  selector: "printString",
814
962
  category: 'accessing',
815
- fn: function (){
816
- var self=this;
817
- var $1;
818
- $1=smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self,"_printString",[],smalltalk.Object),"__comma",["("]),"__comma",[smalltalk.send(self,"_asString",[])]),"__comma",[")"]);
819
- return $1;
963
+ fn: function () {
964
+ var self = this;
965
+ var $1;
966
+ $1 = smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_printString", [], smalltalk.Object), "__comma", ["("]), "__comma", [smalltalk.send(self, "_asString", [])]), "__comma", [")"]);
967
+ return $1;
820
968
  },
821
969
  args: [],
822
970
  source: "printString\x0a\x09^super printString, '(', self asString, ')'",
@@ -830,11 +978,11 @@ smalltalk.addMethod(
830
978
  smalltalk.method({
831
979
  selector: "receiver",
832
980
  category: 'accessing',
833
- fn: function (){
834
- var self=this;
835
- return self.receiver;
836
- ;
837
- return self},
981
+ fn: function () {
982
+ var self = this;
983
+ return self.receiver;
984
+ return self;
985
+ },
838
986
  args: [],
839
987
  source: "receiver\x0a\x09<return self.receiver>",
840
988
  messageSends: [],
@@ -847,11 +995,11 @@ smalltalk.addMethod(
847
995
  smalltalk.method({
848
996
  selector: "selector",
849
997
  category: 'accessing',
850
- fn: function (){
851
- var self=this;
852
- return smalltalk.convertSelector(self.selector);
853
- ;
854
- return self},
998
+ fn: function () {
999
+ var self = this;
1000
+ return smalltalk.convertSelector(self.selector);
1001
+ return self;
1002
+ },
855
1003
  args: [],
856
1004
  source: "selector\x0a\x09<return smalltalk.convertSelector(self.selector)>",
857
1005
  messageSends: [],
@@ -864,11 +1012,11 @@ smalltalk.addMethod(
864
1012
  smalltalk.method({
865
1013
  selector: "temps",
866
1014
  category: 'accessing',
867
- fn: function (){
868
- var self=this;
869
- return self.temps;
870
- ;
871
- return self},
1015
+ fn: function () {
1016
+ var self = this;
1017
+ return self.temps;
1018
+ return self;
1019
+ },
872
1020
  args: [],
873
1021
  source: "temps\x0a\x09<return self.temps>",
874
1022
  messageSends: [],