resin 0.3.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/amber/bin/amberc +10 -350
- data/amber/js/Benchfib.deploy.js +80 -89
- data/amber/js/Benchfib.js +80 -89
- data/amber/js/Canvas.deploy.js +558 -545
- data/amber/js/Canvas.js +563 -545
- data/amber/js/Compiler-AST.deploy.js +431 -243
- data/amber/js/Compiler-AST.js +487 -244
- data/amber/js/Compiler-Core.deploy.js +201 -1045
- data/amber/js/Compiler-Core.js +208 -1207
- data/amber/js/Compiler-Exceptions.deploy.js +37 -18
- data/amber/js/Compiler-Exceptions.js +42 -18
- data/amber/js/Compiler-IR.deploy.js +1071 -774
- data/amber/js/Compiler-IR.js +1194 -848
- data/amber/js/Compiler-Inlining.deploy.js +395 -373
- data/amber/js/Compiler-Inlining.js +395 -373
- data/amber/js/Compiler-Interpreter.deploy.js +1202 -0
- data/amber/js/Compiler-Interpreter.js +1631 -0
- data/amber/js/Compiler-Semantic.deploy.js +695 -600
- data/amber/js/Compiler-Semantic.js +721 -611
- data/amber/js/Compiler-Tests.deploy.js +699 -376
- data/amber/js/Compiler-Tests.js +834 -381
- data/amber/js/Compiler.deploy.js +8563 -1805
- data/amber/js/Compiler.js +11476 -2633
- data/amber/js/Examples.deploy.js +29 -29
- data/amber/js/Examples.js +29 -29
- data/amber/js/IDE.deploy.js +3292 -2649
- data/amber/js/IDE.js +3318 -2710
- data/amber/js/Importer-Exporter.deploy.js +393 -349
- data/amber/js/Importer-Exporter.js +398 -354
- data/amber/js/Kernel-Announcements.deploy.js +53 -44
- data/amber/js/Kernel-Announcements.js +55 -44
- data/amber/js/Kernel-Classes.deploy.js +566 -368
- data/amber/js/Kernel-Classes.js +660 -402
- data/amber/js/Kernel-Collections.deploy.js +1149 -1098
- data/amber/js/Kernel-Collections.js +1183 -1116
- data/amber/js/Kernel-Exceptions.deploy.js +173 -75
- data/amber/js/Kernel-Exceptions.js +215 -77
- data/amber/js/Kernel-Methods.deploy.js +530 -313
- data/amber/js/Kernel-Methods.js +632 -338
- data/amber/js/Kernel-Objects.deploy.js +1734 -1577
- data/amber/js/Kernel-Objects.js +1867 -1654
- data/amber/js/Kernel-Tests.deploy.js +1416 -973
- data/amber/js/Kernel-Tests.js +1495 -981
- data/amber/js/Kernel-Transcript.deploy.js +23 -24
- data/amber/js/Kernel-Transcript.js +25 -26
- data/amber/js/SUnit-Tests.deploy.js +402 -0
- data/amber/js/SUnit-Tests.js +518 -0
- data/amber/js/SUnit.deploy.js +535 -237
- data/amber/js/SUnit.js +634 -246
- data/amber/js/amber.js +90 -53
- data/amber/js/boot.js +441 -255
- data/amber/js/init.js +1 -3
- data/amber/js/lib/CodeMirror/codemirror.css +3 -0
- data/amber/js/lib/CodeMirror/codemirror.js +104 -55
- data/amber/js/lib/peg-0.7.0.min.js +9 -0
- data/amber/js/parser.js +1504 -802
- data/amber/js/parser.pegjs +170 -165
- data/amber/st/Canvas.st +6 -0
- data/amber/st/Compiler-AST.st +54 -3
- data/amber/st/Compiler-Core.st +6 -551
- data/amber/st/Compiler-Exceptions.st +4 -0
- data/amber/st/Compiler-IR.st +205 -87
- data/amber/st/Compiler-Interpreter.st +597 -0
- data/amber/st/Compiler-Semantic.st +46 -21
- data/amber/st/Compiler-Tests.st +254 -7
- data/amber/st/Compiler.st +3172 -1541
- data/amber/st/IDE.st +57 -93
- data/amber/st/Importer-Exporter.st +4 -7
- data/amber/st/Kernel-Announcements.st +8 -0
- data/amber/st/Kernel-Classes.st +149 -40
- data/amber/st/Kernel-Collections.st +43 -32
- data/amber/st/Kernel-Exceptions.st +70 -1
- data/amber/st/Kernel-Methods.st +165 -27
- data/amber/st/Kernel-Objects.st +215 -140
- data/amber/st/Kernel-Tests.st +195 -10
- data/amber/st/Kernel-Transcript.st +1 -3
- data/amber/st/SUnit-Tests.st +186 -0
- data/amber/st/SUnit.st +186 -14
- data/bin/resin +6 -0
- data/lib/resin/cli.rb +19 -0
- metadata +41 -25
- data/amber/js/lib/peg-0.6.2.min.js +0 -2
- data/bin/resin-compile +0 -6
- data/bin/runresin +0 -12
data/amber/js/Kernel-Methods.js
CHANGED
@@ -6,11 +6,10 @@ smalltalk.addMethod(
|
|
6
6
|
smalltalk.method({
|
7
7
|
selector: "applyTo:arguments:",
|
8
8
|
category: 'evaluating',
|
9
|
-
fn: function (anObject,
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
},
|
9
|
+
fn: function (anObject,aCollection){
|
10
|
+
var self=this;
|
11
|
+
return smalltalk.withContext(function($ctx1) {
|
12
|
+
return self}, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection}, smalltalk.BlockClosure)})},
|
14
13
|
args: ["anObject", "aCollection"],
|
15
14
|
source: "applyTo: anObject arguments: aCollection\x0a\x09<return self.apply(anObject, aCollection)>",
|
16
15
|
messageSends: [],
|
@@ -18,16 +17,31 @@ referencedClasses: []
|
|
18
17
|
}),
|
19
18
|
smalltalk.BlockClosure);
|
20
19
|
|
20
|
+
smalltalk.addMethod(
|
21
|
+
"_asCompiledMethod_",
|
22
|
+
smalltalk.method({
|
23
|
+
selector: "asCompiledMethod:",
|
24
|
+
category: 'converting',
|
25
|
+
fn: function (aString){
|
26
|
+
var self=this;
|
27
|
+
return smalltalk.withContext(function($ctx1) {
|
28
|
+
return self}, function($ctx1) {$ctx1.fill(self,"asCompiledMethod:",{aString:aString}, smalltalk.BlockClosure)})},
|
29
|
+
args: ["aString"],
|
30
|
+
source: "asCompiledMethod: aString\x0a\x09<return smalltalk.method({selector:aString, fn:self});>",
|
31
|
+
messageSends: [],
|
32
|
+
referencedClasses: []
|
33
|
+
}),
|
34
|
+
smalltalk.BlockClosure);
|
35
|
+
|
21
36
|
smalltalk.addMethod(
|
22
37
|
"_compiledSource",
|
23
38
|
smalltalk.method({
|
24
39
|
selector: "compiledSource",
|
25
40
|
category: 'accessing',
|
26
|
-
fn: function ()
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
},
|
41
|
+
fn: function (){
|
42
|
+
var self=this;
|
43
|
+
return smalltalk.withContext(function($ctx1) {
|
44
|
+
return self}, function($ctx1) {$ctx1.fill(self,"compiledSource",{}, smalltalk.BlockClosure)})},
|
31
45
|
args: [],
|
32
46
|
source: "compiledSource\x0a\x09<return self.toString()>",
|
33
47
|
messageSends: [],
|
@@ -42,11 +56,10 @@ selector: "ensure:",
|
|
42
56
|
category: 'evaluating',
|
43
57
|
fn: function (aBlock){
|
44
58
|
var self=this;
|
45
|
-
|
46
|
-
|
47
|
-
return self},
|
59
|
+
return smalltalk.withContext(function($ctx1) {
|
60
|
+
return self}, function($ctx1) {$ctx1.fill(self,"ensure:",{aBlock:aBlock}, smalltalk.BlockClosure)})},
|
48
61
|
args: ["aBlock"],
|
49
|
-
source: "ensure: aBlock\x0a\x09<try{self()}finally{
|
62
|
+
source: "ensure: aBlock\x0a\x09<try{return self()}finally{aBlock._value()}>",
|
50
63
|
messageSends: [],
|
51
64
|
referencedClasses: []
|
52
65
|
}),
|
@@ -59,8 +72,8 @@ selector: "fork",
|
|
59
72
|
category: 'timeout/interval',
|
60
73
|
fn: function (){
|
61
74
|
var self=this;
|
62
|
-
smalltalk.
|
63
|
-
return self},
|
75
|
+
return smalltalk.withContext(function($ctx1) {
|
76
|
+
return self}, function($ctx1) {$ctx1.fill(self,"fork",{}, smalltalk.BlockClosure)})},
|
64
77
|
args: [],
|
65
78
|
source: "fork\x0a\x09ForkPool default fork: self",
|
66
79
|
messageSends: ["fork:", "default"],
|
@@ -73,11 +86,10 @@ smalltalk.addMethod(
|
|
73
86
|
smalltalk.method({
|
74
87
|
selector: "new",
|
75
88
|
category: 'evaluating',
|
76
|
-
fn: function ()
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
},
|
89
|
+
fn: function (){
|
90
|
+
var self=this;
|
91
|
+
return smalltalk.withContext(function($ctx1) {
|
92
|
+
return self}, function($ctx1) {$ctx1.fill(self,"new",{}, smalltalk.BlockClosure)})},
|
81
93
|
args: [],
|
82
94
|
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()>",
|
83
95
|
messageSends: [],
|
@@ -90,11 +102,10 @@ smalltalk.addMethod(
|
|
90
102
|
smalltalk.method({
|
91
103
|
selector: "newValue:",
|
92
104
|
category: 'evaluating',
|
93
|
-
fn: function (anObject)
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
},
|
105
|
+
fn: function (anObject){
|
106
|
+
var self=this;
|
107
|
+
return smalltalk.withContext(function($ctx1) {
|
108
|
+
return self}, function($ctx1) {$ctx1.fill(self,"newValue:",{anObject:anObject}, smalltalk.BlockClosure)})},
|
98
109
|
args: ["anObject"],
|
99
110
|
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)>",
|
100
111
|
messageSends: [],
|
@@ -107,11 +118,10 @@ smalltalk.addMethod(
|
|
107
118
|
smalltalk.method({
|
108
119
|
selector: "newValue:value:",
|
109
120
|
category: 'evaluating',
|
110
|
-
fn: function (anObject,
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
},
|
121
|
+
fn: function (anObject,anObject2){
|
122
|
+
var self=this;
|
123
|
+
return smalltalk.withContext(function($ctx1) {
|
124
|
+
return self}, function($ctx1) {$ctx1.fill(self,"newValue:value:",{anObject:anObject,anObject2:anObject2}, smalltalk.BlockClosure)})},
|
115
125
|
args: ["anObject", "anObject2"],
|
116
126
|
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)>",
|
117
127
|
messageSends: [],
|
@@ -124,13 +134,12 @@ smalltalk.addMethod(
|
|
124
134
|
smalltalk.method({
|
125
135
|
selector: "newValue:value:value:",
|
126
136
|
category: 'evaluating',
|
127
|
-
fn: function (anObject,
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
},
|
137
|
+
fn: function (anObject,anObject2,anObject3){
|
138
|
+
var self=this;
|
139
|
+
return smalltalk.withContext(function($ctx1) {
|
140
|
+
return self}, function($ctx1) {$ctx1.fill(self,"newValue:value:value:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3}, smalltalk.BlockClosure)})},
|
132
141
|
args: ["anObject", "anObject2", "anObject3"],
|
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)>",
|
142
|
+
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,anObject3)>",
|
134
143
|
messageSends: [],
|
135
144
|
referencedClasses: []
|
136
145
|
}),
|
@@ -141,11 +150,10 @@ smalltalk.addMethod(
|
|
141
150
|
smalltalk.method({
|
142
151
|
selector: "numArgs",
|
143
152
|
category: 'accessing',
|
144
|
-
fn: function ()
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
},
|
153
|
+
fn: function (){
|
154
|
+
var self=this;
|
155
|
+
return smalltalk.withContext(function($ctx1) {
|
156
|
+
return self}, function($ctx1) {$ctx1.fill(self,"numArgs",{}, smalltalk.BlockClosure)})},
|
149
157
|
args: [],
|
150
158
|
source: "numArgs\x0a\x09<return self.length>",
|
151
159
|
messageSends: [],
|
@@ -158,16 +166,26 @@ smalltalk.addMethod(
|
|
158
166
|
smalltalk.method({
|
159
167
|
selector: "on:do:",
|
160
168
|
category: 'error handling',
|
161
|
-
fn: function (anErrorClass,
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
169
|
+
fn: function (anErrorClass,aBlock){
|
170
|
+
var self=this;
|
171
|
+
return smalltalk.withContext(function($ctx1) {
|
172
|
+
$1=_st(self)._try_catch_(self,(function(error){
|
173
|
+
var smalltalkError;
|
174
|
+
return smalltalk.withContext(function($ctx2) {
|
175
|
+
smalltalkError;
|
176
|
+
$2=_st(smalltalkError)._isKindOf_(anErrorClass);
|
177
|
+
if(smalltalk.assert($2)){
|
178
|
+
return _st(aBlock)._value_(smalltalkError);
|
179
|
+
} else {
|
180
|
+
return _st(smalltalkError)._signal();
|
181
|
+
};
|
182
|
+
}, function($ctx2) {$ctx2.fillBlock({error:error,smalltalkError:smalltalkError},$ctx1)})}));
|
183
|
+
return $1;
|
184
|
+
}, function($ctx1) {$ctx1.fill(self,"on:do:",{anErrorClass:anErrorClass,aBlock:aBlock}, smalltalk.BlockClosure)})},
|
167
185
|
args: ["anErrorClass", "aBlock"],
|
168
|
-
source: "on: anErrorClass do: aBlock\x0a\x09^self try: self catch: [:error |\x0a\x09 (
|
169
|
-
messageSends: ["try:catch:", "ifTrue:ifFalse:", "value:", "signal", "isKindOf:"],
|
170
|
-
referencedClasses: []
|
186
|
+
source: "on: anErrorClass do: aBlock\x0a\x09\x22All exceptions thrown in the Smalltalk stack are cought.\x0a Convert all JS exceptions to JavaScriptException instances.\x22\x0a \x0a\x09^self try: self catch: [ :error | | smalltalkError |\x0a \x09smalltalkError := Smalltalk current asSmalltalkException: error.\x0a\x09 (smalltalkError isKindOf: anErrorClass) \x0a\x09 ifTrue: [ aBlock value: smalltalkError ]\x0a\x09 ifFalse: [ smalltalkError signal ] ]",
|
187
|
+
messageSends: ["try:catch:", "asSmalltalkException:", "current", "ifTrue:ifFalse:", "value:", "signal", "isKindOf:"],
|
188
|
+
referencedClasses: ["Smalltalk"]
|
171
189
|
}),
|
172
190
|
smalltalk.BlockClosure);
|
173
191
|
|
@@ -176,12 +194,12 @@ smalltalk.addMethod(
|
|
176
194
|
smalltalk.method({
|
177
195
|
selector: "timeToRun",
|
178
196
|
category: 'evaluating',
|
179
|
-
fn: function ()
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
},
|
197
|
+
fn: function (){
|
198
|
+
var self=this;
|
199
|
+
return smalltalk.withContext(function($ctx1) {
|
200
|
+
$1=_st((smalltalk.Date || Date))._millisecondsToRun_(self);
|
201
|
+
return $1;
|
202
|
+
}, function($ctx1) {$ctx1.fill(self,"timeToRun",{}, smalltalk.BlockClosure)})},
|
185
203
|
args: [],
|
186
204
|
source: "timeToRun\x0a\x09\x22Answer the number of milliseconds taken to execute this block.\x22\x0a\x0a\x09^ Date millisecondsToRun: self",
|
187
205
|
messageSends: ["millisecondsToRun:"],
|
@@ -194,11 +212,10 @@ smalltalk.addMethod(
|
|
194
212
|
smalltalk.method({
|
195
213
|
selector: "value",
|
196
214
|
category: 'evaluating',
|
197
|
-
fn: function ()
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
},
|
215
|
+
fn: function (){
|
216
|
+
var self=this;
|
217
|
+
return smalltalk.withContext(function($ctx1) {
|
218
|
+
return self}, function($ctx1) {$ctx1.fill(self,"value",{}, smalltalk.BlockClosure)})},
|
202
219
|
args: [],
|
203
220
|
source: "value\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<return self();>",
|
204
221
|
messageSends: [],
|
@@ -211,11 +228,10 @@ smalltalk.addMethod(
|
|
211
228
|
smalltalk.method({
|
212
229
|
selector: "value:",
|
213
230
|
category: 'evaluating',
|
214
|
-
fn: function (anArg)
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
},
|
231
|
+
fn: function (anArg){
|
232
|
+
var self=this;
|
233
|
+
return smalltalk.withContext(function($ctx1) {
|
234
|
+
return self}, function($ctx1) {$ctx1.fill(self,"value:",{anArg:anArg}, smalltalk.BlockClosure)})},
|
219
235
|
args: ["anArg"],
|
220
236
|
source: "value: anArg\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<return self(anArg);>",
|
221
237
|
messageSends: [],
|
@@ -228,11 +244,10 @@ smalltalk.addMethod(
|
|
228
244
|
smalltalk.method({
|
229
245
|
selector: "value:value:",
|
230
246
|
category: 'evaluating',
|
231
|
-
fn: function (firstArg,
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
},
|
247
|
+
fn: function (firstArg,secondArg){
|
248
|
+
var self=this;
|
249
|
+
return smalltalk.withContext(function($ctx1) {
|
250
|
+
return self}, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArg:firstArg,secondArg:secondArg}, smalltalk.BlockClosure)})},
|
236
251
|
args: ["firstArg", "secondArg"],
|
237
252
|
source: "value: firstArg value: secondArg\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<return self(firstArg, secondArg);>",
|
238
253
|
messageSends: [],
|
@@ -245,11 +260,10 @@ smalltalk.addMethod(
|
|
245
260
|
smalltalk.method({
|
246
261
|
selector: "value:value:value:",
|
247
262
|
category: 'evaluating',
|
248
|
-
fn: function (firstArg,
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
},
|
263
|
+
fn: function (firstArg,secondArg,thirdArg){
|
264
|
+
var self=this;
|
265
|
+
return smalltalk.withContext(function($ctx1) {
|
266
|
+
return self}, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArg:firstArg,secondArg:secondArg,thirdArg:thirdArg}, smalltalk.BlockClosure)})},
|
253
267
|
args: ["firstArg", "secondArg", "thirdArg"],
|
254
268
|
source: "value: firstArg value: secondArg value: thirdArg\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<return self(firstArg, secondArg, thirdArg);>",
|
255
269
|
messageSends: [],
|
@@ -262,13 +276,15 @@ smalltalk.addMethod(
|
|
262
276
|
smalltalk.method({
|
263
277
|
selector: "valueWithInterval:",
|
264
278
|
category: 'timeout/interval',
|
265
|
-
fn: function (aNumber)
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
279
|
+
fn: function (aNumber){
|
280
|
+
var self=this;
|
281
|
+
return smalltalk.withContext(function($ctx1) {
|
282
|
+
var interval = setInterval(self, aNumber);
|
283
|
+
return smalltalk.Timeout._on_(interval);
|
284
|
+
;
|
285
|
+
return self}, function($ctx1) {$ctx1.fill(self,"valueWithInterval:",{aNumber:aNumber}, smalltalk.BlockClosure)})},
|
270
286
|
args: ["aNumber"],
|
271
|
-
source: "valueWithInterval: aNumber\x0a\x09
|
287
|
+
source: "valueWithInterval: aNumber\x0a\x09<\x0a \x09var interval = setInterval(self, aNumber);\x0a \x09return smalltalk.Timeout._on_(interval);\x0a >",
|
272
288
|
messageSends: [],
|
273
289
|
referencedClasses: []
|
274
290
|
}),
|
@@ -279,11 +295,10 @@ smalltalk.addMethod(
|
|
279
295
|
smalltalk.method({
|
280
296
|
selector: "valueWithPossibleArguments:",
|
281
297
|
category: 'evaluating',
|
282
|
-
fn: function (aCollection)
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
},
|
298
|
+
fn: function (aCollection){
|
299
|
+
var self=this;
|
300
|
+
return smalltalk.withContext(function($ctx1) {
|
301
|
+
return self}, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection}, smalltalk.BlockClosure)})},
|
287
302
|
args: ["aCollection"],
|
288
303
|
source: "valueWithPossibleArguments: aCollection\x0a\x09<return self.apply(null, aCollection);>",
|
289
304
|
messageSends: [],
|
@@ -296,13 +311,15 @@ smalltalk.addMethod(
|
|
296
311
|
smalltalk.method({
|
297
312
|
selector: "valueWithTimeout:",
|
298
313
|
category: 'timeout/interval',
|
299
|
-
fn: function (aNumber)
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
314
|
+
fn: function (aNumber){
|
315
|
+
var self=this;
|
316
|
+
return smalltalk.withContext(function($ctx1) {
|
317
|
+
var timeout = setTimeout(self, aNumber);
|
318
|
+
return smalltalk.Timeout._on_(timeout);
|
319
|
+
;
|
320
|
+
return self}, function($ctx1) {$ctx1.fill(self,"valueWithTimeout:",{aNumber:aNumber}, smalltalk.BlockClosure)})},
|
304
321
|
args: ["aNumber"],
|
305
|
-
source: "valueWithTimeout: aNumber\x0a\x09
|
322
|
+
source: "valueWithTimeout: aNumber\x0a\x09<\x0a \x09var timeout = setTimeout(self, aNumber);\x0a \x09return smalltalk.Timeout._on_(timeout);\x0a >",
|
306
323
|
messageSends: [],
|
307
324
|
referencedClasses: []
|
308
325
|
}),
|
@@ -313,11 +330,11 @@ smalltalk.addMethod(
|
|
313
330
|
smalltalk.method({
|
314
331
|
selector: "whileFalse",
|
315
332
|
category: 'controlling',
|
316
|
-
fn: function ()
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
},
|
333
|
+
fn: function (){
|
334
|
+
var self=this;
|
335
|
+
return smalltalk.withContext(function($ctx1) {
|
336
|
+
return smalltalk.withContext(function($ctx2) {
|
337
|
+
return self}, function($ctx1) {$ctx1.fill(self,"whileFalse",{}, smalltalk.BlockClosure)})},
|
321
338
|
args: [],
|
322
339
|
source: "whileFalse\x0a\x09\x22inlined in the Compiler\x22\x0a\x09self whileFalse: []",
|
323
340
|
messageSends: ["whileFalse:"],
|
@@ -330,13 +347,10 @@ smalltalk.addMethod(
|
|
330
347
|
smalltalk.method({
|
331
348
|
selector: "whileFalse:",
|
332
349
|
category: 'controlling',
|
333
|
-
fn: function (aBlock)
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
}
|
338
|
-
return self;
|
339
|
-
},
|
350
|
+
fn: function (aBlock){
|
351
|
+
var self=this;
|
352
|
+
return smalltalk.withContext(function($ctx1) {
|
353
|
+
return self}, function($ctx1) {$ctx1.fill(self,"whileFalse:",{aBlock:aBlock}, smalltalk.BlockClosure)})},
|
340
354
|
args: ["aBlock"],
|
341
355
|
source: "whileFalse: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<while(!self()) {aBlock()}>",
|
342
356
|
messageSends: [],
|
@@ -349,11 +363,11 @@ smalltalk.addMethod(
|
|
349
363
|
smalltalk.method({
|
350
364
|
selector: "whileTrue",
|
351
365
|
category: 'controlling',
|
352
|
-
fn: function ()
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
},
|
366
|
+
fn: function (){
|
367
|
+
var self=this;
|
368
|
+
return smalltalk.withContext(function($ctx1) {
|
369
|
+
return smalltalk.withContext(function($ctx2) {
|
370
|
+
return self}, function($ctx1) {$ctx1.fill(self,"whileTrue",{}, smalltalk.BlockClosure)})},
|
357
371
|
args: [],
|
358
372
|
source: "whileTrue\x0a\x09\x22inlined in the Compiler\x22\x0a\x09self whileTrue: []",
|
359
373
|
messageSends: ["whileTrue:"],
|
@@ -366,13 +380,10 @@ smalltalk.addMethod(
|
|
366
380
|
smalltalk.method({
|
367
381
|
selector: "whileTrue:",
|
368
382
|
category: 'controlling',
|
369
|
-
fn: function (aBlock)
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
}
|
374
|
-
return self;
|
375
|
-
},
|
383
|
+
fn: function (aBlock){
|
384
|
+
var self=this;
|
385
|
+
return smalltalk.withContext(function($ctx1) {
|
386
|
+
return self}, function($ctx1) {$ctx1.fill(self,"whileTrue:",{aBlock:aBlock}, smalltalk.BlockClosure)})},
|
376
387
|
args: ["aBlock"],
|
377
388
|
source: "whileTrue: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<while(self()) {aBlock()}>",
|
378
389
|
messageSends: [],
|
@@ -389,11 +400,10 @@ smalltalk.addMethod(
|
|
389
400
|
smalltalk.method({
|
390
401
|
selector: "arguments",
|
391
402
|
category: 'accessing',
|
392
|
-
fn: function ()
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
},
|
403
|
+
fn: function (){
|
404
|
+
var self=this;
|
405
|
+
return smalltalk.withContext(function($ctx1) {
|
406
|
+
return self}, function($ctx1) {$ctx1.fill(self,"arguments",{}, smalltalk.CompiledMethod)})},
|
397
407
|
args: [],
|
398
408
|
source: "arguments\x0a\x09<return self.args || []>",
|
399
409
|
messageSends: [],
|
@@ -406,17 +416,17 @@ smalltalk.addMethod(
|
|
406
416
|
smalltalk.method({
|
407
417
|
selector: "category",
|
408
418
|
category: 'accessing',
|
409
|
-
fn: function ()
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
},
|
419
|
+
fn: function (){
|
420
|
+
var self=this;
|
421
|
+
return smalltalk.withContext(function($ctx1) {
|
422
|
+
$2=_st(self)._basicAt_("category");
|
423
|
+
if(($receiver = $2) == nil || $receiver == undefined){
|
424
|
+
$1="";
|
425
|
+
} else {
|
426
|
+
$1=$2;
|
427
|
+
};
|
428
|
+
return $1;
|
429
|
+
}, function($ctx1) {$ctx1.fill(self,"category",{}, smalltalk.CompiledMethod)})},
|
420
430
|
args: [],
|
421
431
|
source: "category\x0a\x09^(self basicAt: 'category') ifNil: ['']",
|
422
432
|
messageSends: ["ifNil:", "basicAt:"],
|
@@ -431,22 +441,22 @@ selector: "category:",
|
|
431
441
|
category: 'accessing',
|
432
442
|
fn: function (aString){
|
433
443
|
var self=this;
|
434
|
-
var $1;
|
435
444
|
var oldCategory;
|
436
|
-
|
437
|
-
|
438
|
-
|
445
|
+
return smalltalk.withContext(function($ctx1) {
|
446
|
+
oldCategory=_st(self)._category();
|
447
|
+
_st(self)._basicAt_put_("category",aString);
|
448
|
+
$1=_st(self)._methodClass();
|
439
449
|
if(($receiver = $1) == nil || $receiver == undefined){
|
440
450
|
$1;
|
441
451
|
} else {
|
442
|
-
|
443
|
-
|
444
|
-
return smalltalk.
|
445
|
-
})
|
446
|
-
return smalltalk.
|
447
|
-
})
|
452
|
+
_st(_st(_st(self)._methodClass())._organization())._addElement_(aString);
|
453
|
+
_st(_st(_st(_st(self)._methodClass())._methods())._select_((function(each){
|
454
|
+
return smalltalk.withContext(function($ctx2) {
|
455
|
+
}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})))._ifEmpty_((function(){
|
456
|
+
return smalltalk.withContext(function($ctx2) {
|
457
|
+
}, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
|
448
458
|
};
|
449
|
-
return self},
|
459
|
+
return self}, function($ctx1) {$ctx1.fill(self,"category:",{aString:aString,oldCategory:oldCategory}, smalltalk.CompiledMethod)})},
|
450
460
|
args: ["aString"],
|
451
461
|
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
462
|
messageSends: ["category", "basicAt:put:", "ifNotNil:", "addElement:", "organization", "methodClass", "ifEmpty:", "removeElement:", "select:", "=", "methods"],
|
@@ -459,12 +469,12 @@ smalltalk.addMethod(
|
|
459
469
|
smalltalk.method({
|
460
470
|
selector: "fn",
|
461
471
|
category: 'accessing',
|
462
|
-
fn: function ()
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
},
|
472
|
+
fn: function (){
|
473
|
+
var self=this;
|
474
|
+
return smalltalk.withContext(function($ctx1) {
|
475
|
+
$1=_st(self)._basicAt_("fn");
|
476
|
+
return $1;
|
477
|
+
}, function($ctx1) {$ctx1.fill(self,"fn",{}, smalltalk.CompiledMethod)})},
|
468
478
|
args: [],
|
469
479
|
source: "fn\x0a\x09^self basicAt: 'fn'",
|
470
480
|
messageSends: ["basicAt:"],
|
@@ -477,11 +487,10 @@ smalltalk.addMethod(
|
|
477
487
|
smalltalk.method({
|
478
488
|
selector: "fn:",
|
479
489
|
category: 'accessing',
|
480
|
-
fn: function (aBlock)
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
},
|
490
|
+
fn: function (aBlock){
|
491
|
+
var self=this;
|
492
|
+
return smalltalk.withContext(function($ctx1) {
|
493
|
+
return self}, function($ctx1) {$ctx1.fill(self,"fn:",{aBlock:aBlock}, smalltalk.CompiledMethod)})},
|
485
494
|
args: ["aBlock"],
|
486
495
|
source: "fn: aBlock\x0a\x09self basicAt: 'fn' put: aBlock",
|
487
496
|
messageSends: ["basicAt:put:"],
|
@@ -494,12 +503,12 @@ smalltalk.addMethod(
|
|
494
503
|
smalltalk.method({
|
495
504
|
selector: "messageSends",
|
496
505
|
category: 'accessing',
|
497
|
-
fn: function ()
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
},
|
506
|
+
fn: function (){
|
507
|
+
var self=this;
|
508
|
+
return smalltalk.withContext(function($ctx1) {
|
509
|
+
$1=_st(self)._basicAt_("messageSends");
|
510
|
+
return $1;
|
511
|
+
}, function($ctx1) {$ctx1.fill(self,"messageSends",{}, smalltalk.CompiledMethod)})},
|
503
512
|
args: [],
|
504
513
|
source: "messageSends\x0a\x09^self basicAt: 'messageSends'",
|
505
514
|
messageSends: ["basicAt:"],
|
@@ -512,12 +521,12 @@ smalltalk.addMethod(
|
|
512
521
|
smalltalk.method({
|
513
522
|
selector: "methodClass",
|
514
523
|
category: 'accessing',
|
515
|
-
fn: function ()
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
},
|
524
|
+
fn: function (){
|
525
|
+
var self=this;
|
526
|
+
return smalltalk.withContext(function($ctx1) {
|
527
|
+
$1=_st(self)._basicAt_("methodClass");
|
528
|
+
return $1;
|
529
|
+
}, function($ctx1) {$ctx1.fill(self,"methodClass",{}, smalltalk.CompiledMethod)})},
|
521
530
|
args: [],
|
522
531
|
source: "methodClass\x0a\x09^self basicAt: 'methodClass'",
|
523
532
|
messageSends: ["basicAt:"],
|
@@ -530,12 +539,12 @@ smalltalk.addMethod(
|
|
530
539
|
smalltalk.method({
|
531
540
|
selector: "protocol",
|
532
541
|
category: 'accessing',
|
533
|
-
fn: function ()
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
},
|
542
|
+
fn: function (){
|
543
|
+
var self=this;
|
544
|
+
return smalltalk.withContext(function($ctx1) {
|
545
|
+
$1=_st(self)._category();
|
546
|
+
return $1;
|
547
|
+
}, function($ctx1) {$ctx1.fill(self,"protocol",{}, smalltalk.CompiledMethod)})},
|
539
548
|
args: [],
|
540
549
|
source: "protocol\x0a\x09^ self category",
|
541
550
|
messageSends: ["category"],
|
@@ -548,12 +557,12 @@ smalltalk.addMethod(
|
|
548
557
|
smalltalk.method({
|
549
558
|
selector: "referencedClasses",
|
550
559
|
category: 'accessing',
|
551
|
-
fn: function ()
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
},
|
560
|
+
fn: function (){
|
561
|
+
var self=this;
|
562
|
+
return smalltalk.withContext(function($ctx1) {
|
563
|
+
$1=_st(self)._basicAt_("referencedClasses");
|
564
|
+
return $1;
|
565
|
+
}, function($ctx1) {$ctx1.fill(self,"referencedClasses",{}, smalltalk.CompiledMethod)})},
|
557
566
|
args: [],
|
558
567
|
source: "referencedClasses\x0a\x09^self basicAt: 'referencedClasses'",
|
559
568
|
messageSends: ["basicAt:"],
|
@@ -566,12 +575,12 @@ smalltalk.addMethod(
|
|
566
575
|
smalltalk.method({
|
567
576
|
selector: "selector",
|
568
577
|
category: 'accessing',
|
569
|
-
fn: function ()
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
},
|
578
|
+
fn: function (){
|
579
|
+
var self=this;
|
580
|
+
return smalltalk.withContext(function($ctx1) {
|
581
|
+
$1=_st(self)._basicAt_("selector");
|
582
|
+
return $1;
|
583
|
+
}, function($ctx1) {$ctx1.fill(self,"selector",{}, smalltalk.CompiledMethod)})},
|
575
584
|
args: [],
|
576
585
|
source: "selector\x0a\x09^self basicAt: 'selector'",
|
577
586
|
messageSends: ["basicAt:"],
|
@@ -584,11 +593,10 @@ smalltalk.addMethod(
|
|
584
593
|
smalltalk.method({
|
585
594
|
selector: "selector:",
|
586
595
|
category: 'accessing',
|
587
|
-
fn: function (aString)
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
},
|
596
|
+
fn: function (aString){
|
597
|
+
var self=this;
|
598
|
+
return smalltalk.withContext(function($ctx1) {
|
599
|
+
return self}, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString}, smalltalk.CompiledMethod)})},
|
592
600
|
args: ["aString"],
|
593
601
|
source: "selector: aString\x0a\x09self basicAt: 'selector' put: aString",
|
594
602
|
messageSends: ["basicAt:put:"],
|
@@ -601,17 +609,17 @@ smalltalk.addMethod(
|
|
601
609
|
smalltalk.method({
|
602
610
|
selector: "source",
|
603
611
|
category: 'accessing',
|
604
|
-
fn: function ()
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
},
|
612
|
+
fn: function (){
|
613
|
+
var self=this;
|
614
|
+
return smalltalk.withContext(function($ctx1) {
|
615
|
+
$2=_st(self)._basicAt_("source");
|
616
|
+
if(($receiver = $2) == nil || $receiver == undefined){
|
617
|
+
$1="";
|
618
|
+
} else {
|
619
|
+
$1=$2;
|
620
|
+
};
|
621
|
+
return $1;
|
622
|
+
}, function($ctx1) {$ctx1.fill(self,"source",{}, smalltalk.CompiledMethod)})},
|
615
623
|
args: [],
|
616
624
|
source: "source\x0a\x09^(self basicAt: 'source') ifNil: ['']",
|
617
625
|
messageSends: ["ifNil:", "basicAt:"],
|
@@ -624,11 +632,10 @@ smalltalk.addMethod(
|
|
624
632
|
smalltalk.method({
|
625
633
|
selector: "source:",
|
626
634
|
category: 'accessing',
|
627
|
-
fn: function (aString)
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
},
|
635
|
+
fn: function (aString){
|
636
|
+
var self=this;
|
637
|
+
return smalltalk.withContext(function($ctx1) {
|
638
|
+
return self}, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString}, smalltalk.CompiledMethod)})},
|
632
639
|
args: ["aString"],
|
633
640
|
source: "source: aString\x0a\x09self basicAt: 'source' put: aString",
|
634
641
|
messageSends: ["basicAt:put:"],
|
@@ -639,16 +646,17 @@ smalltalk.CompiledMethod);
|
|
639
646
|
|
640
647
|
|
641
648
|
smalltalk.addClass('ForkPool', smalltalk.Object, ['poolSize', 'maxPoolSize', 'queue', 'worker'], 'Kernel-Methods');
|
649
|
+
smalltalk.ForkPool.comment="A ForkPool is responsible for handling forked blocks.\x0aThe pool size sets the maximum concurrent forked blocks.\x0a\x0aThe default instance is accessed with `ForkPool default`"
|
642
650
|
smalltalk.addMethod(
|
643
651
|
"_addWorker",
|
644
652
|
smalltalk.method({
|
645
653
|
selector: "addWorker",
|
646
|
-
category: '
|
654
|
+
category: 'private',
|
647
655
|
fn: function (){
|
648
656
|
var self=this;
|
649
|
-
smalltalk.
|
650
|
-
self["@poolSize"]=
|
651
|
-
return self},
|
657
|
+
return smalltalk.withContext(function($ctx1) {
|
658
|
+
self["@poolSize"]=_st(self["@poolSize"]).__plus((1));
|
659
|
+
return self}, function($ctx1) {$ctx1.fill(self,"addWorker",{}, smalltalk.ForkPool)})},
|
652
660
|
args: [],
|
653
661
|
source: "addWorker\x0a\x09worker valueWithTimeout: 0.\x0a poolSize := poolSize + 1",
|
654
662
|
messageSends: ["valueWithTimeout:", "+"],
|
@@ -656,23 +664,41 @@ referencedClasses: []
|
|
656
664
|
}),
|
657
665
|
smalltalk.ForkPool);
|
658
666
|
|
667
|
+
smalltalk.addMethod(
|
668
|
+
"_defaultMaxPoolSize",
|
669
|
+
smalltalk.method({
|
670
|
+
selector: "defaultMaxPoolSize",
|
671
|
+
category: 'defaults',
|
672
|
+
fn: function (){
|
673
|
+
var self=this;
|
674
|
+
return smalltalk.withContext(function($ctx1) {
|
675
|
+
$1=_st(_st(self)._class())._defaultMaxPoolSize();
|
676
|
+
return $1;
|
677
|
+
}, function($ctx1) {$ctx1.fill(self,"defaultMaxPoolSize",{}, smalltalk.ForkPool)})},
|
678
|
+
args: [],
|
679
|
+
source: "defaultMaxPoolSize\x0a\x09^ self class defaultMaxPoolSize",
|
680
|
+
messageSends: ["defaultMaxPoolSize", "class"],
|
681
|
+
referencedClasses: []
|
682
|
+
}),
|
683
|
+
smalltalk.ForkPool);
|
684
|
+
|
659
685
|
smalltalk.addMethod(
|
660
686
|
"_fork_",
|
661
687
|
smalltalk.method({
|
662
688
|
selector: "fork:",
|
663
|
-
category: '
|
689
|
+
category: 'actions',
|
664
690
|
fn: function (aBlock){
|
665
691
|
var self=this;
|
666
|
-
|
667
|
-
$1=
|
692
|
+
return smalltalk.withContext(function($ctx1) {
|
693
|
+
$1=_st(self["@poolSize"]).__lt(_st(self)._maxPoolSize());
|
668
694
|
if(smalltalk.assert($1)){
|
669
|
-
|
695
|
+
_st(self)._addWorker();
|
670
696
|
};
|
671
|
-
|
672
|
-
return self},
|
697
|
+
_st(self["@queue"])._back_(aBlock);
|
698
|
+
return self}, function($ctx1) {$ctx1.fill(self,"fork:",{aBlock:aBlock}, smalltalk.ForkPool)})},
|
673
699
|
args: ["aBlock"],
|
674
|
-
source: "fork: aBlock\x0a\x09poolSize < maxPoolSize ifTrue: [ self addWorker ].\x0a\x09queue back: aBlock",
|
675
|
-
messageSends: ["ifTrue:", "addWorker", "<", "back:"],
|
700
|
+
source: "fork: aBlock\x0a\x09poolSize < self maxPoolSize ifTrue: [ self addWorker ].\x0a\x09queue back: aBlock",
|
701
|
+
messageSends: ["ifTrue:", "addWorker", "<", "maxPoolSize", "back:"],
|
676
702
|
referencedClasses: []
|
677
703
|
}),
|
678
704
|
smalltalk.ForkPool);
|
@@ -684,34 +710,90 @@ selector: "initialize",
|
|
684
710
|
category: 'initialization',
|
685
711
|
fn: function (){
|
686
712
|
var self=this;
|
687
|
-
|
688
|
-
var sentinel;
|
713
|
+
return smalltalk.withContext(function($ctx1) {
|
689
714
|
self["@poolSize"]=(0);
|
690
|
-
self["@
|
691
|
-
self["@
|
692
|
-
|
693
|
-
|
715
|
+
self["@queue"]=_st((smalltalk.Queue || Queue))._new();
|
716
|
+
self["@worker"]=_st(self)._makeWorker();
|
717
|
+
return self}, function($ctx1) {$ctx1.fill(self,"initialize",{}, smalltalk.ForkPool)})},
|
718
|
+
args: [],
|
719
|
+
source: "initialize\x0a super initialize.\x0a \x0a\x09poolSize := 0.\x0a queue := Queue new.\x0a worker := self makeWorker",
|
720
|
+
messageSends: ["initialize", "new", "makeWorker"],
|
721
|
+
referencedClasses: ["Queue"]
|
722
|
+
}),
|
723
|
+
smalltalk.ForkPool);
|
724
|
+
|
725
|
+
smalltalk.addMethod(
|
726
|
+
"_makeWorker",
|
727
|
+
smalltalk.method({
|
728
|
+
selector: "makeWorker",
|
729
|
+
category: 'initialization',
|
730
|
+
fn: function (){
|
731
|
+
var self=this;
|
732
|
+
var sentinel;
|
733
|
+
return smalltalk.withContext(function($ctx1) {
|
734
|
+
sentinel=_st((smalltalk.Object || Object))._new();
|
735
|
+
$1=(function(){
|
694
736
|
var block;
|
695
|
-
|
737
|
+
return smalltalk.withContext(function($ctx2) {
|
696
738
|
self["@poolSize"];
|
697
|
-
block=
|
698
|
-
return
|
699
|
-
})
|
739
|
+
block=_st(self["@queue"])._frontIfAbsent_((function(){
|
740
|
+
return smalltalk.withContext(function($ctx3) {
|
741
|
+
}, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
|
700
742
|
block;
|
701
|
-
$
|
702
|
-
if(! smalltalk.assert($
|
703
|
-
return
|
704
|
-
return smalltalk.
|
705
|
-
})
|
706
|
-
return smalltalk.
|
707
|
-
})
|
743
|
+
$2=_st(block).__eq_eq(sentinel);
|
744
|
+
if(! smalltalk.assert($2)){
|
745
|
+
return _st((function(){
|
746
|
+
return smalltalk.withContext(function($ctx3) {
|
747
|
+
}, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}))._ensure_((function(){
|
748
|
+
return smalltalk.withContext(function($ctx3) {
|
749
|
+
}, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
|
708
750
|
};
|
709
|
-
});
|
710
|
-
return
|
751
|
+
}, function($ctx2) {$ctx2.fillBlock({block:block},$ctx1)})});
|
752
|
+
return $1;
|
753
|
+
}, function($ctx1) {$ctx1.fill(self,"makeWorker",{sentinel:sentinel}, smalltalk.ForkPool)})},
|
711
754
|
args: [],
|
712
|
-
source: "
|
713
|
-
messageSends: ["
|
714
|
-
referencedClasses: ["
|
755
|
+
source: "makeWorker\x0a\x09| sentinel |\x0a sentinel := Object new.\x0a ^[ | block |\x0a poolSize := poolSize - 1.\x0a\x09\x09block := queue frontIfAbsent: [ sentinel ].\x0a block == sentinel ifFalse: [\x0a \x09[ block value ] ensure: [ self addWorker ]]]",
|
756
|
+
messageSends: ["new", "-", "frontIfAbsent:", "ifFalse:", "ensure:", "addWorker", "value", "=="],
|
757
|
+
referencedClasses: ["Object"]
|
758
|
+
}),
|
759
|
+
smalltalk.ForkPool);
|
760
|
+
|
761
|
+
smalltalk.addMethod(
|
762
|
+
"_maxPoolSize",
|
763
|
+
smalltalk.method({
|
764
|
+
selector: "maxPoolSize",
|
765
|
+
category: 'accessing',
|
766
|
+
fn: function (){
|
767
|
+
var self=this;
|
768
|
+
return smalltalk.withContext(function($ctx1) {
|
769
|
+
$2=self["@maxPoolSize"];
|
770
|
+
if(($receiver = $2) == nil || $receiver == undefined){
|
771
|
+
$1=_st(self)._defaultMaxPoolSize();
|
772
|
+
} else {
|
773
|
+
$1=$2;
|
774
|
+
};
|
775
|
+
return $1;
|
776
|
+
}, function($ctx1) {$ctx1.fill(self,"maxPoolSize",{}, smalltalk.ForkPool)})},
|
777
|
+
args: [],
|
778
|
+
source: "maxPoolSize\x0a\x09^ maxPoolSize ifNil: [ self defaultMaxPoolSize ]",
|
779
|
+
messageSends: ["ifNil:", "defaultMaxPoolSize"],
|
780
|
+
referencedClasses: []
|
781
|
+
}),
|
782
|
+
smalltalk.ForkPool);
|
783
|
+
|
784
|
+
smalltalk.addMethod(
|
785
|
+
"_maxPoolSize_",
|
786
|
+
smalltalk.method({
|
787
|
+
selector: "maxPoolSize:",
|
788
|
+
category: 'accessing',
|
789
|
+
fn: function (anInteger){
|
790
|
+
var self=this;
|
791
|
+
return smalltalk.withContext(function($ctx1) {
|
792
|
+
return self}, function($ctx1) {$ctx1.fill(self,"maxPoolSize:",{anInteger:anInteger}, smalltalk.ForkPool)})},
|
793
|
+
args: ["anInteger"],
|
794
|
+
source: "maxPoolSize: anInteger\x0a\x09maxPoolSize := anInteger",
|
795
|
+
messageSends: [],
|
796
|
+
referencedClasses: []
|
715
797
|
}),
|
716
798
|
smalltalk.ForkPool);
|
717
799
|
|
@@ -724,15 +806,16 @@ selector: "default",
|
|
724
806
|
category: 'accessing',
|
725
807
|
fn: function (){
|
726
808
|
var self=this;
|
727
|
-
|
728
|
-
|
729
|
-
|
809
|
+
return smalltalk.withContext(function($ctx1) {
|
810
|
+
$2=self["@default"];
|
811
|
+
if(($receiver = $2) == nil || $receiver == undefined){
|
812
|
+
self["@default"]=_st(self)._new();
|
730
813
|
$1=self["@default"];
|
731
814
|
} else {
|
732
|
-
$1
|
815
|
+
$1=$2;
|
733
816
|
};
|
734
817
|
return $1;
|
735
|
-
},
|
818
|
+
}, function($ctx1) {$ctx1.fill(self,"default",{}, smalltalk.ForkPool.klass)})},
|
736
819
|
args: [],
|
737
820
|
source: "default\x0a\x09^default ifNil: [ default := self new ]",
|
738
821
|
messageSends: ["ifNil:", "new"],
|
@@ -747,8 +830,8 @@ selector: "defaultMaxPoolSize",
|
|
747
830
|
category: 'accessing',
|
748
831
|
fn: function (){
|
749
832
|
var self=this;
|
750
|
-
return (
|
751
|
-
},
|
833
|
+
return smalltalk.withContext(function($ctx1) {
|
834
|
+
}, function($ctx1) {$ctx1.fill(self,"defaultMaxPoolSize",{}, smalltalk.ForkPool.klass)})},
|
752
835
|
args: [],
|
753
836
|
source: "defaultMaxPoolSize\x0a\x09^100",
|
754
837
|
messageSends: [],
|
@@ -763,8 +846,8 @@ selector: "resetDefault",
|
|
763
846
|
category: 'accessing',
|
764
847
|
fn: function (){
|
765
848
|
var self=this;
|
766
|
-
|
767
|
-
return self},
|
849
|
+
return smalltalk.withContext(function($ctx1) {
|
850
|
+
return self}, function($ctx1) {$ctx1.fill(self,"resetDefault",{}, smalltalk.ForkPool.klass)})},
|
768
851
|
args: [],
|
769
852
|
source: "resetDefault\x0a\x09default := nil",
|
770
853
|
messageSends: [],
|
@@ -780,10 +863,12 @@ smalltalk.addMethod(
|
|
780
863
|
smalltalk.method({
|
781
864
|
selector: "arguments",
|
782
865
|
category: 'accessing',
|
783
|
-
fn: function ()
|
784
|
-
|
785
|
-
|
786
|
-
|
866
|
+
fn: function (){
|
867
|
+
var self=this;
|
868
|
+
return smalltalk.withContext(function($ctx1) {
|
869
|
+
$1=self["@arguments"];
|
870
|
+
return $1;
|
871
|
+
}, function($ctx1) {$ctx1.fill(self,"arguments",{}, smalltalk.Message)})},
|
787
872
|
args: [],
|
788
873
|
source: "arguments\x0a\x09^arguments",
|
789
874
|
messageSends: [],
|
@@ -796,11 +881,10 @@ smalltalk.addMethod(
|
|
796
881
|
smalltalk.method({
|
797
882
|
selector: "arguments:",
|
798
883
|
category: 'accessing',
|
799
|
-
fn: function (anArray)
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
},
|
884
|
+
fn: function (anArray){
|
885
|
+
var self=this;
|
886
|
+
return smalltalk.withContext(function($ctx1) {
|
887
|
+
return self}, function($ctx1) {$ctx1.fill(self,"arguments:",{anArray:anArray}, smalltalk.Message)})},
|
804
888
|
args: ["anArray"],
|
805
889
|
source: "arguments: anArray\x0a\x09arguments := anArray",
|
806
890
|
messageSends: [],
|
@@ -813,12 +897,19 @@ smalltalk.addMethod(
|
|
813
897
|
smalltalk.method({
|
814
898
|
selector: "printString",
|
815
899
|
category: 'printing',
|
816
|
-
fn: function ()
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
900
|
+
fn: function (){
|
901
|
+
var self=this;
|
902
|
+
return smalltalk.withContext(function($ctx1) {
|
903
|
+
$1=_st((smalltalk.String || String))._streamContents_((function(aStream){
|
904
|
+
return smalltalk.withContext(function($ctx2) {
|
905
|
+
_st($2)._nextPutAll_(smalltalk.Object.fn.prototype._printString.apply(_st(self), []));
|
906
|
+
_st($2)._nextPutAll_("(");
|
907
|
+
_st($2)._nextPutAll_(self["@selector"]);
|
908
|
+
$3=_st($2)._nextPutAll_(")");
|
909
|
+
return $3;
|
910
|
+
}, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1)})}));
|
911
|
+
return $1;
|
912
|
+
}, function($ctx1) {$ctx1.fill(self,"printString",{}, smalltalk.Message)})},
|
822
913
|
args: [],
|
823
914
|
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]",
|
824
915
|
messageSends: ["streamContents:", "nextPutAll:", "printString"],
|
@@ -831,10 +922,12 @@ smalltalk.addMethod(
|
|
831
922
|
smalltalk.method({
|
832
923
|
selector: "selector",
|
833
924
|
category: 'accessing',
|
834
|
-
fn: function ()
|
835
|
-
|
836
|
-
|
837
|
-
|
925
|
+
fn: function (){
|
926
|
+
var self=this;
|
927
|
+
return smalltalk.withContext(function($ctx1) {
|
928
|
+
$1=self["@selector"];
|
929
|
+
return $1;
|
930
|
+
}, function($ctx1) {$ctx1.fill(self,"selector",{}, smalltalk.Message)})},
|
838
931
|
args: [],
|
839
932
|
source: "selector\x0a\x09^selector",
|
840
933
|
messageSends: [],
|
@@ -847,11 +940,10 @@ smalltalk.addMethod(
|
|
847
940
|
smalltalk.method({
|
848
941
|
selector: "selector:",
|
849
942
|
category: 'accessing',
|
850
|
-
fn: function (aString)
|
851
|
-
|
852
|
-
|
853
|
-
|
854
|
-
},
|
943
|
+
fn: function (aString){
|
944
|
+
var self=this;
|
945
|
+
return smalltalk.withContext(function($ctx1) {
|
946
|
+
return self}, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString}, smalltalk.Message)})},
|
855
947
|
args: ["aString"],
|
856
948
|
source: "selector: aString\x0a\x09selector := aString",
|
857
949
|
messageSends: [],
|
@@ -864,16 +956,16 @@ smalltalk.addMethod(
|
|
864
956
|
smalltalk.method({
|
865
957
|
selector: "sendTo:",
|
866
958
|
category: 'printing',
|
867
|
-
fn: function (anObject)
|
868
|
-
|
869
|
-
|
870
|
-
|
871
|
-
|
872
|
-
},
|
959
|
+
fn: function (anObject){
|
960
|
+
var self=this;
|
961
|
+
return smalltalk.withContext(function($ctx1) {
|
962
|
+
$1=_st(anObject)._perform_withArguments_(_st(self)._selector(),_st(self)._arguments());
|
963
|
+
return $1;
|
964
|
+
}, function($ctx1) {$ctx1.fill(self,"sendTo:",{anObject:anObject}, smalltalk.Message)})},
|
873
965
|
args: ["anObject"],
|
874
|
-
source: "sendTo: anObject\x0a\x09^
|
875
|
-
messageSends: ["
|
876
|
-
referencedClasses: [
|
966
|
+
source: "sendTo: anObject\x0a\x09^ anObject perform: self selector withArguments: self arguments",
|
967
|
+
messageSends: ["perform:withArguments:", "selector", "arguments"],
|
968
|
+
referencedClasses: []
|
877
969
|
}),
|
878
970
|
smalltalk.Message);
|
879
971
|
|
@@ -883,16 +975,16 @@ smalltalk.addMethod(
|
|
883
975
|
smalltalk.method({
|
884
976
|
selector: "selector:arguments:",
|
885
977
|
category: 'instance creation',
|
886
|
-
fn: function (aString,
|
887
|
-
|
888
|
-
|
889
|
-
|
890
|
-
|
891
|
-
|
892
|
-
|
893
|
-
|
894
|
-
|
895
|
-
},
|
978
|
+
fn: function (aString,anArray){
|
979
|
+
var self=this;
|
980
|
+
return smalltalk.withContext(function($ctx1) {
|
981
|
+
$2=_st(self)._new();
|
982
|
+
_st($2)._selector_(aString);
|
983
|
+
_st($2)._arguments_(anArray);
|
984
|
+
$3=_st($2)._yourself();
|
985
|
+
$1=$3;
|
986
|
+
return $1;
|
987
|
+
}, function($ctx1) {$ctx1.fill(self,"selector:arguments:",{aString:aString,anArray:anArray}, smalltalk.Message.klass)})},
|
896
988
|
args: ["aString", "anArray"],
|
897
989
|
source: "selector: aString arguments: anArray\x0a\x09^self new\x0a\x09\x09selector: aString;\x0a\x09\x09arguments: anArray;\x0a\x09\x09yourself",
|
898
990
|
messageSends: ["selector:", "new", "arguments:", "yourself"],
|
@@ -902,21 +994,26 @@ smalltalk.Message.klass);
|
|
902
994
|
|
903
995
|
|
904
996
|
smalltalk.addClass('MethodContext', smalltalk.Object, [], 'Kernel-Methods');
|
905
|
-
smalltalk.MethodContext.comment="MethodContext holds all the dynamic state associated with the execution of either a method activation resulting from a message send. That is used to build the call stack while debugging.\x0a \x0aMethodContext instances are JavaScript `SmalltalkMethodContext` objects defined in boot.js
|
997
|
+
smalltalk.MethodContext.comment="MethodContext holds all the dynamic state associated with the execution of either a method activation resulting from a message send. That is used to build the call stack while debugging.\x0a \x0aMethodContext instances are JavaScript `SmalltalkMethodContext` objects defined in boot.js "
|
906
998
|
smalltalk.addMethod(
|
907
999
|
"_asString",
|
908
1000
|
smalltalk.method({
|
909
1001
|
selector: "asString",
|
910
|
-
category: '
|
911
|
-
fn: function ()
|
912
|
-
|
913
|
-
|
914
|
-
|
915
|
-
|
916
|
-
|
1002
|
+
category: 'converting',
|
1003
|
+
fn: function (){
|
1004
|
+
var self=this;
|
1005
|
+
return smalltalk.withContext(function($ctx1) {
|
1006
|
+
$2=_st(self)._isBlockContext();
|
1007
|
+
if(smalltalk.assert($2)){
|
1008
|
+
$1=_st(_st("a block (in ").__comma(_st(_st(_st(_st(self)._methodContext())._receiver())._class())._printString())).__comma(")");
|
1009
|
+
} else {
|
1010
|
+
$1=_st(_st(_st(_st(_st(self)._receiver())._class())._printString()).__comma(" >> ")).__comma(_st(self)._selector());
|
1011
|
+
};
|
1012
|
+
return $1;
|
1013
|
+
}, function($ctx1) {$ctx1.fill(self,"asString",{}, smalltalk.MethodContext)})},
|
917
1014
|
args: [],
|
918
|
-
source: "asString\x0a\x09^self receiver class printString, ' >> ', self selector",
|
919
|
-
messageSends: ["
|
1015
|
+
source: "asString\x0a\x09^self isBlockContext \x0a \x09ifTrue: [ 'a block (in ', self methodContext receiver class printString, ')' ]\x0a \x09ifFalse: [ self receiver class printString, ' >> ', self selector ]",
|
1016
|
+
messageSends: ["ifTrue:ifFalse:", ",", "printString", "class", "receiver", "methodContext", "selector", "isBlockContext"],
|
920
1017
|
referencedClasses: []
|
921
1018
|
}),
|
922
1019
|
smalltalk.MethodContext);
|
@@ -926,13 +1023,103 @@ smalltalk.addMethod(
|
|
926
1023
|
smalltalk.method({
|
927
1024
|
selector: "home",
|
928
1025
|
category: 'accessing',
|
929
|
-
fn: function ()
|
930
|
-
|
931
|
-
|
932
|
-
|
933
|
-
|
1026
|
+
fn: function (){
|
1027
|
+
var self=this;
|
1028
|
+
return smalltalk.withContext(function($ctx1) {
|
1029
|
+
return self}, function($ctx1) {$ctx1.fill(self,"home",{}, smalltalk.MethodContext)})},
|
1030
|
+
args: [],
|
1031
|
+
source: "home\x0a\x09<return self.methodContext || self.homeContext>",
|
1032
|
+
messageSends: [],
|
1033
|
+
referencedClasses: []
|
1034
|
+
}),
|
1035
|
+
smalltalk.MethodContext);
|
1036
|
+
|
1037
|
+
smalltalk.addMethod(
|
1038
|
+
"_isBlockContext",
|
1039
|
+
smalltalk.method({
|
1040
|
+
selector: "isBlockContext",
|
1041
|
+
category: 'testing',
|
1042
|
+
fn: function (){
|
1043
|
+
var self=this;
|
1044
|
+
return smalltalk.withContext(function($ctx1) {
|
1045
|
+
$1=_st(_st(self)._selector())._isNil();
|
1046
|
+
return $1;
|
1047
|
+
}, function($ctx1) {$ctx1.fill(self,"isBlockContext",{}, smalltalk.MethodContext)})},
|
1048
|
+
args: [],
|
1049
|
+
source: "isBlockContext\x0a\x09\x22Block context do not have selectors.\x22\x0a \x0a\x09^ self selector isNil",
|
1050
|
+
messageSends: ["isNil", "selector"],
|
1051
|
+
referencedClasses: []
|
1052
|
+
}),
|
1053
|
+
smalltalk.MethodContext);
|
1054
|
+
|
1055
|
+
smalltalk.addMethod(
|
1056
|
+
"_locals",
|
1057
|
+
smalltalk.method({
|
1058
|
+
selector: "locals",
|
1059
|
+
category: 'accessing',
|
1060
|
+
fn: function (){
|
1061
|
+
var self=this;
|
1062
|
+
return smalltalk.withContext(function($ctx1) {
|
1063
|
+
return self}, function($ctx1) {$ctx1.fill(self,"locals",{}, smalltalk.MethodContext)})},
|
1064
|
+
args: [],
|
1065
|
+
source: "locals\x0a\x09<return self.locals>",
|
1066
|
+
messageSends: [],
|
1067
|
+
referencedClasses: []
|
1068
|
+
}),
|
1069
|
+
smalltalk.MethodContext);
|
1070
|
+
|
1071
|
+
smalltalk.addMethod(
|
1072
|
+
"_method",
|
1073
|
+
smalltalk.method({
|
1074
|
+
selector: "method",
|
1075
|
+
category: 'accessing',
|
1076
|
+
fn: function (){
|
1077
|
+
var self=this;
|
1078
|
+
return smalltalk.withContext(function($ctx1) {
|
1079
|
+
$1=_st(_st(_st(_st(self)._methodContext())._receiver())._class())._lookupSelector_(_st(_st(self)._methodContext())._selector());
|
1080
|
+
return $1;
|
1081
|
+
}, function($ctx1) {$ctx1.fill(self,"method",{}, smalltalk.MethodContext)})},
|
1082
|
+
args: [],
|
1083
|
+
source: "method\x0a\x09^self methodContext receiver class lookupSelector: self methodContext selector",
|
1084
|
+
messageSends: ["lookupSelector:", "selector", "methodContext", "class", "receiver"],
|
1085
|
+
referencedClasses: []
|
1086
|
+
}),
|
1087
|
+
smalltalk.MethodContext);
|
1088
|
+
|
1089
|
+
smalltalk.addMethod(
|
1090
|
+
"_methodContext",
|
1091
|
+
smalltalk.method({
|
1092
|
+
selector: "methodContext",
|
1093
|
+
category: 'accessing',
|
1094
|
+
fn: function (){
|
1095
|
+
var self=this;
|
1096
|
+
return smalltalk.withContext(function($ctx1) {
|
1097
|
+
$1=_st(self)._isBlockContext();
|
1098
|
+
if(! smalltalk.assert($1)){
|
1099
|
+
$2=self;
|
1100
|
+
return $2;
|
1101
|
+
};
|
1102
|
+
$3=_st(self)._home();
|
1103
|
+
return $3;
|
1104
|
+
}, function($ctx1) {$ctx1.fill(self,"methodContext",{}, smalltalk.MethodContext)})},
|
1105
|
+
args: [],
|
1106
|
+
source: "methodContext\x0a\x09self isBlockContext ifFalse: [ ^ self ].\x0a \x0a ^ self home",
|
1107
|
+
messageSends: ["ifFalse:", "isBlockContext", "home"],
|
1108
|
+
referencedClasses: []
|
1109
|
+
}),
|
1110
|
+
smalltalk.MethodContext);
|
1111
|
+
|
1112
|
+
smalltalk.addMethod(
|
1113
|
+
"_outerContext",
|
1114
|
+
smalltalk.method({
|
1115
|
+
selector: "outerContext",
|
1116
|
+
category: 'accessing',
|
1117
|
+
fn: function (){
|
1118
|
+
var self=this;
|
1119
|
+
return smalltalk.withContext(function($ctx1) {
|
1120
|
+
return self}, function($ctx1) {$ctx1.fill(self,"outerContext",{}, smalltalk.MethodContext)})},
|
934
1121
|
args: [],
|
935
|
-
source: "
|
1122
|
+
source: "outerContext\x0a\x09<return self.homeContext>",
|
936
1123
|
messageSends: [],
|
937
1124
|
referencedClasses: []
|
938
1125
|
}),
|
@@ -943,11 +1130,10 @@ smalltalk.addMethod(
|
|
943
1130
|
smalltalk.method({
|
944
1131
|
selector: "pc",
|
945
1132
|
category: 'accessing',
|
946
|
-
fn: function ()
|
947
|
-
|
948
|
-
|
949
|
-
|
950
|
-
},
|
1133
|
+
fn: function (){
|
1134
|
+
var self=this;
|
1135
|
+
return smalltalk.withContext(function($ctx1) {
|
1136
|
+
return self}, function($ctx1) {$ctx1.fill(self,"pc",{}, smalltalk.MethodContext)})},
|
951
1137
|
args: [],
|
952
1138
|
source: "pc\x0a\x09<return self.pc>",
|
953
1139
|
messageSends: [],
|
@@ -960,12 +1146,12 @@ smalltalk.addMethod(
|
|
960
1146
|
smalltalk.method({
|
961
1147
|
selector: "printString",
|
962
1148
|
category: 'accessing',
|
963
|
-
fn: function ()
|
964
|
-
|
965
|
-
|
966
|
-
|
967
|
-
|
968
|
-
},
|
1149
|
+
fn: function (){
|
1150
|
+
var self=this;
|
1151
|
+
return smalltalk.withContext(function($ctx1) {
|
1152
|
+
$1=_st(_st(_st(smalltalk.Object.fn.prototype._printString.apply(_st(self), [])).__comma("(")).__comma(_st(self)._asString())).__comma(")");
|
1153
|
+
return $1;
|
1154
|
+
}, function($ctx1) {$ctx1.fill(self,"printString",{}, smalltalk.MethodContext)})},
|
969
1155
|
args: [],
|
970
1156
|
source: "printString\x0a\x09^super printString, '(', self asString, ')'",
|
971
1157
|
messageSends: [",", "asString", "printString"],
|
@@ -978,11 +1164,10 @@ smalltalk.addMethod(
|
|
978
1164
|
smalltalk.method({
|
979
1165
|
selector: "receiver",
|
980
1166
|
category: 'accessing',
|
981
|
-
fn: function ()
|
982
|
-
|
983
|
-
|
984
|
-
|
985
|
-
},
|
1167
|
+
fn: function (){
|
1168
|
+
var self=this;
|
1169
|
+
return smalltalk.withContext(function($ctx1) {
|
1170
|
+
return self}, function($ctx1) {$ctx1.fill(self,"receiver",{}, smalltalk.MethodContext)})},
|
986
1171
|
args: [],
|
987
1172
|
source: "receiver\x0a\x09<return self.receiver>",
|
988
1173
|
messageSends: [],
|
@@ -995,13 +1180,18 @@ smalltalk.addMethod(
|
|
995
1180
|
smalltalk.method({
|
996
1181
|
selector: "selector",
|
997
1182
|
category: 'accessing',
|
998
|
-
fn: function ()
|
999
|
-
|
1000
|
-
|
1001
|
-
|
1002
|
-
|
1183
|
+
fn: function (){
|
1184
|
+
var self=this;
|
1185
|
+
return smalltalk.withContext(function($ctx1) {
|
1186
|
+
if(self.selector) {
|
1187
|
+
return smalltalk.convertSelector(self.selector);
|
1188
|
+
} else {
|
1189
|
+
return nil;
|
1190
|
+
}
|
1191
|
+
;
|
1192
|
+
return self}, function($ctx1) {$ctx1.fill(self,"selector",{}, smalltalk.MethodContext)})},
|
1003
1193
|
args: [],
|
1004
|
-
source: "selector\x0a\x09
|
1194
|
+
source: "selector\x0a\x09<\x0a \x09if(self.selector) {\x0a \x09return smalltalk.convertSelector(self.selector);\x0a } else {\x0a \x09return nil;\x0a }\x0a >",
|
1005
1195
|
messageSends: [],
|
1006
1196
|
referencedClasses: []
|
1007
1197
|
}),
|
@@ -1012,17 +1202,121 @@ smalltalk.addMethod(
|
|
1012
1202
|
smalltalk.method({
|
1013
1203
|
selector: "temps",
|
1014
1204
|
category: 'accessing',
|
1015
|
-
fn: function ()
|
1016
|
-
|
1017
|
-
|
1018
|
-
|
1019
|
-
|
1205
|
+
fn: function (){
|
1206
|
+
var self=this;
|
1207
|
+
return smalltalk.withContext(function($ctx1) {
|
1208
|
+
_st(self)._deprecatedAPI();
|
1209
|
+
$1=_st(self)._locals();
|
1210
|
+
return $1;
|
1211
|
+
}, function($ctx1) {$ctx1.fill(self,"temps",{}, smalltalk.MethodContext)})},
|
1020
1212
|
args: [],
|
1021
|
-
source: "temps\x0a\x09
|
1022
|
-
messageSends: [],
|
1213
|
+
source: "temps\x0a\x09self deprecatedAPI.\x0a \x0a\x09^ self locals",
|
1214
|
+
messageSends: ["deprecatedAPI", "locals"],
|
1023
1215
|
referencedClasses: []
|
1024
1216
|
}),
|
1025
1217
|
smalltalk.MethodContext);
|
1026
1218
|
|
1027
1219
|
|
1028
1220
|
|
1221
|
+
smalltalk.addClass('NativeFunction', smalltalk.Object, [], 'Kernel-Methods');
|
1222
|
+
smalltalk.NativeFunction.comment="NativeFunction is a wrapper around native functions, such as `WebSocket`.\x0aFor 'normal' functions (whose constructor is the JavaScript `Function` object), use `BlockClosure`.\x0a\x0aSee the class-side `instance creation` methods.\x0a\x0aCreated instances will most probably be instance of `JSObjectProxy`.\x0a\x0aUsage example:\x0a\x0a | ws |\x0a ws := NativeFunction constructor: 'WebSocket' value: 'ws://localhost'.\x0a ws at: 'onopen' put: [ ws send: 'hey there from Amber' ]"
|
1223
|
+
|
1224
|
+
smalltalk.addMethod(
|
1225
|
+
"_constructor_",
|
1226
|
+
smalltalk.method({
|
1227
|
+
selector: "constructor:",
|
1228
|
+
category: 'instance creation',
|
1229
|
+
fn: function (aString){
|
1230
|
+
var self=this;
|
1231
|
+
return smalltalk.withContext(function($ctx1) {
|
1232
|
+
var native=eval(aString);
|
1233
|
+
return new native();
|
1234
|
+
;
|
1235
|
+
return self}, function($ctx1) {$ctx1.fill(self,"constructor:",{aString:aString}, smalltalk.NativeFunction.klass)})},
|
1236
|
+
args: ["aString"],
|
1237
|
+
source: "constructor: aString\x0a\x09<\x0a \x09var native=eval(aString); \x0a return new native();\x0a\x09>\x0a",
|
1238
|
+
messageSends: [],
|
1239
|
+
referencedClasses: []
|
1240
|
+
}),
|
1241
|
+
smalltalk.NativeFunction.klass);
|
1242
|
+
|
1243
|
+
smalltalk.addMethod(
|
1244
|
+
"_constructor_value_",
|
1245
|
+
smalltalk.method({
|
1246
|
+
selector: "constructor:value:",
|
1247
|
+
category: 'instance creation',
|
1248
|
+
fn: function (aString,anObject){
|
1249
|
+
var self=this;
|
1250
|
+
return smalltalk.withContext(function($ctx1) {
|
1251
|
+
var native=eval(aString);
|
1252
|
+
return new native(anObject);
|
1253
|
+
;
|
1254
|
+
return self}, function($ctx1) {$ctx1.fill(self,"constructor:value:",{aString:aString,anObject:anObject}, smalltalk.NativeFunction.klass)})},
|
1255
|
+
args: ["aString", "anObject"],
|
1256
|
+
source: "constructor: aString value:anObject\x0a\x09<\x0a \x09var native=eval(aString); \x0a return new native(anObject);\x0a\x09>\x0a",
|
1257
|
+
messageSends: [],
|
1258
|
+
referencedClasses: []
|
1259
|
+
}),
|
1260
|
+
smalltalk.NativeFunction.klass);
|
1261
|
+
|
1262
|
+
smalltalk.addMethod(
|
1263
|
+
"_constructor_value_value_",
|
1264
|
+
smalltalk.method({
|
1265
|
+
selector: "constructor:value:value:",
|
1266
|
+
category: 'instance creation',
|
1267
|
+
fn: function (aString,anObject,anObject2){
|
1268
|
+
var self=this;
|
1269
|
+
return smalltalk.withContext(function($ctx1) {
|
1270
|
+
var native=eval(aString);
|
1271
|
+
return new native(anObject,anObject2);
|
1272
|
+
;
|
1273
|
+
return self}, function($ctx1) {$ctx1.fill(self,"constructor:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2}, smalltalk.NativeFunction.klass)})},
|
1274
|
+
args: ["aString", "anObject", "anObject2"],
|
1275
|
+
source: "constructor: aString value:anObject value: anObject2\x0a\x09<\x0a \x09var native=eval(aString); \x0a return new native(anObject,anObject2);\x0a\x09>\x0a",
|
1276
|
+
messageSends: [],
|
1277
|
+
referencedClasses: []
|
1278
|
+
}),
|
1279
|
+
smalltalk.NativeFunction.klass);
|
1280
|
+
|
1281
|
+
smalltalk.addMethod(
|
1282
|
+
"_constructor_value_value_value_",
|
1283
|
+
smalltalk.method({
|
1284
|
+
selector: "constructor:value:value:value:",
|
1285
|
+
category: 'instance creation',
|
1286
|
+
fn: function (aString,anObject,anObject2,anObject3){
|
1287
|
+
var self=this;
|
1288
|
+
return smalltalk.withContext(function($ctx1) {
|
1289
|
+
var native=eval(aString);
|
1290
|
+
return new native(anObject,anObject2, anObject3);
|
1291
|
+
;
|
1292
|
+
return self}, function($ctx1) {$ctx1.fill(self,"constructor:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3}, smalltalk.NativeFunction.klass)})},
|
1293
|
+
args: ["aString", "anObject", "anObject2", "anObject3"],
|
1294
|
+
source: "constructor: aString value:anObject value: anObject2 value:anObject3\x0a\x09<\x0a \x09var native=eval(aString); \x0a return new native(anObject,anObject2, anObject3);\x0a\x09>\x0a",
|
1295
|
+
messageSends: [],
|
1296
|
+
referencedClasses: []
|
1297
|
+
}),
|
1298
|
+
smalltalk.NativeFunction.klass);
|
1299
|
+
|
1300
|
+
smalltalk.addMethod(
|
1301
|
+
"_exists_",
|
1302
|
+
smalltalk.method({
|
1303
|
+
selector: "exists:",
|
1304
|
+
category: 'testing',
|
1305
|
+
fn: function (aString){
|
1306
|
+
var self=this;
|
1307
|
+
return smalltalk.withContext(function($ctx1) {
|
1308
|
+
if(aString in window) {
|
1309
|
+
return true
|
1310
|
+
} else {
|
1311
|
+
return false
|
1312
|
+
}
|
1313
|
+
;
|
1314
|
+
return self}, function($ctx1) {$ctx1.fill(self,"exists:",{aString:aString}, smalltalk.NativeFunction.klass)})},
|
1315
|
+
args: ["aString"],
|
1316
|
+
source: "exists: aString\x0a\x09<\x0a \x09if(aString in window) {\x0a \x09return true\x0a } else {\x0a \x09return false\x0a }\x0a >",
|
1317
|
+
messageSends: [],
|
1318
|
+
referencedClasses: []
|
1319
|
+
}),
|
1320
|
+
smalltalk.NativeFunction.klass);
|
1321
|
+
|
1322
|
+
|