resin 0.2.1 → 0.2.2

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 (60) hide show
  1. data/README.markdown +2 -0
  2. data/amber/bin/nodecompile.js +3 -3
  3. data/amber/css/amber.css +47 -23
  4. data/amber/images/off.amber.png +0 -0
  5. data/amber/images/offHover.amber.png +0 -0
  6. data/amber/images/sprite.amber.png +0 -0
  7. data/amber/images/tinylogo.amber.png +0 -0
  8. data/amber/js/Benchfib.deploy.js +34 -34
  9. data/amber/js/Benchfib.js +49 -49
  10. data/amber/js/Canvas.deploy.js +937 -937
  11. data/amber/js/Canvas.js +1622 -1622
  12. data/amber/js/Compiler-Tests.deploy.js +97 -0
  13. data/amber/js/Compiler-Tests.js +137 -0
  14. data/amber/js/Compiler.deploy.js +1030 -924
  15. data/amber/js/Compiler.js +1613 -1467
  16. data/amber/js/Documentation.deploy.js +417 -417
  17. data/amber/js/Documentation.js +728 -728
  18. data/amber/js/Examples.deploy.js +24 -13
  19. data/amber/js/Examples.js +36 -19
  20. data/amber/js/IDE.deploy.js +1583 -1527
  21. data/amber/js/IDE.js +2586 -2510
  22. data/amber/js/Kernel-Announcements.deploy.js +19 -19
  23. data/amber/js/Kernel-Announcements.js +28 -28
  24. data/amber/js/Kernel-Classes.deploy.js +332 -229
  25. data/amber/js/Kernel-Classes.js +532 -384
  26. data/amber/js/Kernel-Collections.deploy.js +1516 -1712
  27. data/amber/js/Kernel-Collections.js +2436 -2712
  28. data/amber/js/Kernel-Exceptions.deploy.js +85 -62
  29. data/amber/js/Kernel-Exceptions.js +131 -98
  30. data/amber/js/Kernel-Methods.deploy.js +326 -378
  31. data/amber/js/Kernel-Methods.js +473 -525
  32. data/amber/js/Kernel-Objects.deploy.js +1777 -2428
  33. data/amber/js/Kernel-Objects.js +2599 -3426
  34. data/amber/js/Kernel-Tests.deploy.js +871 -772
  35. data/amber/js/Kernel-Tests.js +1207 -1083
  36. data/amber/js/Kernel-Transcript.deploy.js +57 -57
  37. data/amber/js/Kernel-Transcript.js +94 -94
  38. data/amber/js/SUnit.deploy.js +116 -116
  39. data/amber/js/SUnit.js +211 -211
  40. data/amber/js/amber.js +10 -11
  41. data/amber/js/boot.js +132 -156
  42. data/amber/js/init.js +2 -2
  43. data/amber/js/parser.js +2095 -3014
  44. data/amber/js/parser.pegjs +1 -1
  45. data/amber/st/Benchfib.st +22 -22
  46. data/amber/st/Canvas.st +471 -471
  47. data/amber/st/Compiler-Tests.st +471 -0
  48. data/amber/st/Compiler.st +858 -794
  49. data/amber/st/Examples.st +22 -5
  50. data/amber/st/IDE.st +1326 -1291
  51. data/amber/st/Kernel-Announcements.st +2 -2
  52. data/amber/st/Kernel-Classes.st +148 -90
  53. data/amber/st/Kernel-Collections.st +950 -1061
  54. data/amber/st/Kernel-Exceptions.st +33 -25
  55. data/amber/st/Kernel-Methods.st +151 -151
  56. data/amber/st/Kernel-Objects.st +891 -1036
  57. data/amber/st/Kernel-Tests.st +622 -544
  58. data/amber/st/Kernel-Transcript.st +38 -38
  59. data/amber/st/SUnit.st +53 -53
  60. metadata +27 -20
@@ -1,30 +1,35 @@
1
1
  Smalltalk current createPackage: 'Kernel-Exceptions' properties: #{}!
2
2
  Object subclass: #Error
3
3
  instanceVariableNames: 'messageText'
4
- category: 'Kernel-Exceptions'!
4
+ package: 'Kernel-Exceptions'!
5
5
 
6
6
  !Error methodsFor: 'accessing'!
7
7
 
8
- messageText
9
- ^messageText
10
- !
11
-
12
- messageText: aString
13
- messageText := aString
14
- !
15
-
16
8
  context
17
9
  <return self.context>
18
10
  !
19
11
 
20
12
  jsStack
21
13
  <return self.stack>
14
+ !
15
+
16
+ messageText
17
+ ^messageText
18
+ !
19
+
20
+ messageText: aString
21
+ messageText := aString
22
22
  ! !
23
23
 
24
24
  !Error methodsFor: 'signaling'!
25
25
 
26
26
  signal
27
27
  <self.context = smalltalk.getThisContext(); self.smalltalkError = true; throw(self)>
28
+ !
29
+
30
+ signal: aString
31
+ self messageText: aString.
32
+ self signal
28
33
  ! !
29
34
 
30
35
  !Error methodsFor: 'testing'!
@@ -35,15 +40,18 @@ isSmalltalkError
35
40
 
36
41
  !Error class methodsFor: 'instance creation'!
37
42
 
43
+ signal
44
+ ^self new signal
45
+ !
46
+
38
47
  signal: aString
39
48
  ^self new
40
- messageText: aString;
41
- signal
49
+ signal: aString
42
50
  ! !
43
51
 
44
52
  Error subclass: #MessageNotUnderstood
45
53
  instanceVariableNames: 'message receiver'
46
- category: 'Kernel-Exceptions'!
54
+ package: 'Kernel-Exceptions'!
47
55
 
48
56
  !MessageNotUnderstood methodsFor: 'accessing'!
49
57
 
@@ -55,21 +63,21 @@ message: aMessage
55
63
  message := aMessage
56
64
  !
57
65
 
66
+ messageText
67
+ ^self receiver asString, ' does not understand #', self message selector
68
+ !
69
+
58
70
  receiver
59
71
  ^receiver
60
72
  !
61
73
 
62
74
  receiver: anObject
63
75
  receiver := anObject
64
- !
65
-
66
- messageText
67
- ^self receiver asString, ' does not understand #', self message selector
68
76
  ! !
69
77
 
70
78
  Object subclass: #ErrorHandler
71
79
  instanceVariableNames: ''
72
- category: 'Kernel-Exceptions'!
80
+ package: 'Kernel-Exceptions'!
73
81
 
74
82
  !ErrorHandler methodsFor: 'error handling'!
75
83
 
@@ -80,24 +88,24 @@ handleError: anError
80
88
 
81
89
  !ErrorHandler methodsFor: 'private'!
82
90
 
91
+ log: aString
92
+ console log: aString
93
+ !
94
+
83
95
  logContext: aContext
84
96
  aContext home ifNotNil: [
85
97
  self logContext: aContext home].
86
98
  self log: aContext receiver asString, '>>', aContext selector
87
99
  !
88
100
 
89
- logErrorContext: aContext
90
- aContext ifNotNil: [
91
- aContext home ifNotNil: [
92
- self logContext: aContext home]]
93
- !
94
-
95
101
  logError: anError
96
102
  self log: anError messageText
97
103
  !
98
104
 
99
- log: aString
100
- console log: aString
105
+ logErrorContext: aContext
106
+ aContext ifNotNil: [
107
+ aContext home ifNotNil: [
108
+ self logContext: aContext home]]
101
109
  ! !
102
110
 
103
111
  ErrorHandler class instanceVariableNames: 'current'!
@@ -1,95 +1,7 @@
1
1
  Smalltalk current createPackage: 'Kernel-Methods' properties: #{}!
2
- Object subclass: #Message
3
- instanceVariableNames: 'selector arguments'
4
- category: 'Kernel-Methods'!
5
- !Message commentStamp!
6
- Generally, the system does not use instances of Message for efficiency reasons.
7
- However, 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.
8
- This instance is sent it as an argument with the message `doesNotUnderstand:` to the receiver.
9
-
10
- See boot.js, `messageNotUnderstood` and its counterpart `Object>>doesNotUnderstand:`!
11
-
12
- !Message methodsFor: 'accessing'!
13
-
14
- selector
15
- ^selector
16
- !
17
-
18
- selector: aString
19
- selector := aString
20
- !
21
-
22
- arguments: anArray
23
- arguments := anArray
24
- !
25
-
26
- arguments
27
- ^arguments
28
- ! !
29
-
30
- !Message methodsFor: 'printing'!
31
-
32
- printString
33
- ^ String streamContents: [:aStream|
34
- aStream
35
- nextPutAll: super printString;
36
- nextPutAll: '(';
37
- nextPutAll: selector;
38
- nextPutAll: ')' ]
39
- !
40
-
41
- sendTo: anObject
42
- Smalltalk current send: self selector to: anObject arguments: self arguments
43
- ! !
44
-
45
- !Message class methodsFor: 'instance creation'!
46
-
47
- selector: aString arguments: anArray
48
- ^self new
49
- selector: aString;
50
- arguments: anArray;
51
- yourself
52
- ! !
53
-
54
- Object subclass: #MethodContext
55
- instanceVariableNames: ''
56
- category: 'Kernel-Methods'!
57
- !MethodContext commentStamp!
58
- 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.
59
-
60
- MethodContext instances are JavaScript `SmalltalkMethodContext` objects defined in boot.js
61
-
62
- Current limitation: MethodContext instances are not created on Block evaluation. That means it's actually impossible to debug inside a Block.!
63
-
64
- !MethodContext methodsFor: 'accessing'!
65
-
66
- receiver
67
- <return self.receiver>
68
- !
69
-
70
- selector
71
- <return smalltalk.convertSelector(self.selector)>
72
- !
73
-
74
- home
75
- <return self.homeContext>
76
- !
77
-
78
- temps
79
- <return self.temps>
80
- !
81
-
82
- printString
83
- ^super printString, '(', self asString, ')'
84
- !
85
-
86
- asString
87
- ^self receiver class printString, ' >> ', self selector
88
- ! !
89
-
90
2
  Object subclass: #BlockClosure
91
3
  instanceVariableNames: ''
92
- category: 'Kernel-Methods'!
4
+ package: 'Kernel-Methods'!
93
5
  !BlockClosure commentStamp!
94
6
  A BlockClosure is a lexical closure.
95
7
  The JavaScript representation is a function.
@@ -108,9 +20,9 @@ numArgs
108
20
 
109
21
  !BlockClosure methodsFor: 'controlling'!
110
22
 
111
- whileTrue: aBlock
23
+ whileFalse
112
24
  "inlined in the Compiler"
113
- <while(self()) {aBlock()}>
25
+ self whileFalse: []
114
26
  !
115
27
 
116
28
  whileFalse: aBlock
@@ -118,14 +30,14 @@ whileFalse: aBlock
118
30
  <while(!!self()) {aBlock()}>
119
31
  !
120
32
 
121
- whileFalse
33
+ whileTrue
122
34
  "inlined in the Compiler"
123
- self whileFalse: []
35
+ self whileTrue: []
124
36
  !
125
37
 
126
- whileTrue
38
+ whileTrue: aBlock
127
39
  "inlined in the Compiler"
128
- self whileTrue: []
40
+ <while(self()) {aBlock()}>
129
41
  ! !
130
42
 
131
43
  !BlockClosure methodsFor: 'error handling'!
@@ -139,46 +51,10 @@ on: anErrorClass do: aBlock
139
51
 
140
52
  !BlockClosure methodsFor: 'evaluating'!
141
53
 
142
- value
143
- "inlined in the Compiler"
144
- <return self();>
145
- !
146
-
147
- value: anArg
148
- "inlined in the Compiler"
149
- <return self(anArg);>
150
- !
151
-
152
- value: firstArg value: secondArg
153
- "inlined in the Compiler"
154
- <return self(firstArg, secondArg);>
155
- !
156
-
157
- value: firstArg value: secondArg value: thirdArg
158
- "inlined in the Compiler"
159
- <return self(firstArg, secondArg, thirdArg);>
160
- !
161
-
162
- valueWithPossibleArguments: aCollection
163
- <return self.apply(null, aCollection);>
164
- !
165
-
166
- new
167
- "Use the receiver as a JS constructor.
168
- *Do not* use this method to instanciate Smalltalk objects!!"
169
- <return new self()>
170
- !
171
-
172
54
  applyTo: anObject arguments: aCollection
173
55
  <return self.apply(anObject, aCollection)>
174
56
  !
175
57
 
176
- timeToRun
177
- "Answer the number of milliseconds taken to execute this block."
178
-
179
- ^ Date millisecondsToRun: self
180
- !
181
-
182
58
  ensure: aBlock
183
59
  | success |
184
60
  success := false.
@@ -189,6 +65,12 @@ ensure: aBlock
189
65
  ex signal]
190
66
  !
191
67
 
68
+ new
69
+ "Use the receiver as a JS constructor.
70
+ *Do not* use this method to instanciate Smalltalk objects!!"
71
+ <return new self()>
72
+ !
73
+
192
74
  newValue: anObject
193
75
  "Use the receiver as a JS constructor.
194
76
  *Do not* use this method to instanciate Smalltalk objects!!"
@@ -205,21 +87,51 @@ newValue: anObject value: anObject2 value: anObject3
205
87
  "Use the receiver as a JS constructor.
206
88
  *Do not* use this method to instanciate Smalltalk objects!!"
207
89
  <return new self(anObject, anObject2)>
208
- ! !
90
+ !
209
91
 
210
- !BlockClosure methodsFor: 'timeout/interval'!
92
+ timeToRun
93
+ "Answer the number of milliseconds taken to execute this block."
211
94
 
212
- valueWithTimeout: aNumber
213
- <return setTimeout(self, aNumber)>
95
+ ^ Date millisecondsToRun: self
96
+ !
97
+
98
+ value
99
+ "inlined in the Compiler"
100
+ <return self();>
214
101
  !
215
102
 
103
+ value: anArg
104
+ "inlined in the Compiler"
105
+ <return self(anArg);>
106
+ !
107
+
108
+ value: firstArg value: secondArg
109
+ "inlined in the Compiler"
110
+ <return self(firstArg, secondArg);>
111
+ !
112
+
113
+ value: firstArg value: secondArg value: thirdArg
114
+ "inlined in the Compiler"
115
+ <return self(firstArg, secondArg, thirdArg);>
116
+ !
117
+
118
+ valueWithPossibleArguments: aCollection
119
+ <return self.apply(null, aCollection);>
120
+ ! !
121
+
122
+ !BlockClosure methodsFor: 'timeout/interval'!
123
+
216
124
  valueWithInterval: aNumber
217
125
  <return setInterval(self, aNumber)>
126
+ !
127
+
128
+ valueWithTimeout: aNumber
129
+ <return setTimeout(self, aNumber)>
218
130
  ! !
219
131
 
220
132
  Object subclass: #CompiledMethod
221
133
  instanceVariableNames: ''
222
- category: 'Kernel-Methods'!
134
+ package: 'Kernel-Methods'!
223
135
  !CompiledMethod commentStamp!
224
136
  CompiledMethod hold the source and compiled code of a class method.
225
137
 
@@ -241,12 +153,8 @@ or messages sent from this method:
241
153
 
242
154
  !CompiledMethod methodsFor: 'accessing'!
243
155
 
244
- source
245
- ^(self basicAt: 'source') ifNil: ['']
246
- !
247
-
248
- source: aString
249
- self basicAt: 'source' put: aString
156
+ arguments
157
+ <return self.args || []>
250
158
  !
251
159
 
252
160
  category
@@ -257,14 +165,6 @@ category: aString
257
165
  self basicAt: 'category' put: aString
258
166
  !
259
167
 
260
- selector
261
- ^self basicAt: 'selector'
262
- !
263
-
264
- selector: aString
265
- self basicAt: 'selector' put: aString
266
- !
267
-
268
168
  fn
269
169
  ^self basicAt: 'fn'
270
170
  !
@@ -285,7 +185,107 @@ referencedClasses
285
185
  ^self basicAt: 'referencedClasses'
286
186
  !
287
187
 
188
+ selector
189
+ ^self basicAt: 'selector'
190
+ !
191
+
192
+ selector: aString
193
+ self basicAt: 'selector' put: aString
194
+ !
195
+
196
+ source
197
+ ^(self basicAt: 'source') ifNil: ['']
198
+ !
199
+
200
+ source: aString
201
+ self basicAt: 'source' put: aString
202
+ ! !
203
+
204
+ Object subclass: #Message
205
+ instanceVariableNames: 'selector arguments'
206
+ package: 'Kernel-Methods'!
207
+ !Message commentStamp!
208
+ Generally, the system does not use instances of Message for efficiency reasons.
209
+ However, 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.
210
+ This instance is sent it as an argument with the message `doesNotUnderstand:` to the receiver.
211
+
212
+ See boot.js, `messageNotUnderstood` and its counterpart `Object>>doesNotUnderstand:`!
213
+
214
+ !Message methodsFor: 'accessing'!
215
+
288
216
  arguments
289
- <return self.args || []>
217
+ ^arguments
218
+ !
219
+
220
+ arguments: anArray
221
+ arguments := anArray
222
+ !
223
+
224
+ selector
225
+ ^selector
226
+ !
227
+
228
+ selector: aString
229
+ selector := aString
230
+ ! !
231
+
232
+ !Message methodsFor: 'printing'!
233
+
234
+ printString
235
+ ^ String streamContents: [:aStream|
236
+ aStream
237
+ nextPutAll: super printString;
238
+ nextPutAll: '(';
239
+ nextPutAll: selector;
240
+ nextPutAll: ')' ]
241
+ !
242
+
243
+ sendTo: anObject
244
+ Smalltalk current send: self selector to: anObject arguments: self arguments
245
+ ! !
246
+
247
+ !Message class methodsFor: 'instance creation'!
248
+
249
+ selector: aString arguments: anArray
250
+ ^self new
251
+ selector: aString;
252
+ arguments: anArray;
253
+ yourself
254
+ ! !
255
+
256
+ Object subclass: #MethodContext
257
+ instanceVariableNames: ''
258
+ package: 'Kernel-Methods'!
259
+ !MethodContext commentStamp!
260
+ 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.
261
+
262
+ MethodContext instances are JavaScript `SmalltalkMethodContext` objects defined in boot.js
263
+
264
+ Current limitation: MethodContext instances are not created on Block evaluation. That means it's actually impossible to debug inside a Block.!
265
+
266
+ !MethodContext methodsFor: 'accessing'!
267
+
268
+ asString
269
+ ^self receiver class printString, ' >> ', self selector
270
+ !
271
+
272
+ home
273
+ <return self.homeContext>
274
+ !
275
+
276
+ printString
277
+ ^super printString, '(', self asString, ')'
278
+ !
279
+
280
+ receiver
281
+ <return self.receiver>
282
+ !
283
+
284
+ selector
285
+ <return smalltalk.convertSelector(self.selector)>
286
+ !
287
+
288
+ temps
289
+ <return self.temps>
290
290
  ! !
291
291