resin 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/amber/css/amber-normalize.css +73 -73
- data/amber/css/amber-normalize.less +1 -1
- data/amber/css/amber.css +106 -106
- data/amber/css/helios.css +242 -0
- data/amber/images/hsplitter.png +0 -0
- data/amber/images/vsplitter.png +0 -0
- data/amber/js/Benchfib.deploy.js +116 -38
- data/amber/js/Benchfib.js +120 -42
- data/amber/js/Canvas.deploy.js +674 -403
- data/amber/js/Canvas.js +682 -411
- data/amber/js/Compiler-AST.deploy.js +1150 -0
- data/amber/js/Compiler-AST.js +1591 -0
- data/amber/js/Compiler-Core.deploy.js +1562 -0
- data/amber/js/Compiler-Core.js +1972 -0
- data/amber/js/Compiler-Exceptions.deploy.js +114 -0
- data/amber/js/Compiler-Exceptions.js +161 -0
- data/amber/js/Compiler-IR.deploy.js +2326 -0
- data/amber/js/Compiler-IR.js +3146 -0
- data/amber/js/Compiler-Inlining.deploy.js +1147 -0
- data/amber/js/Compiler-Inlining.js +1514 -0
- data/amber/js/Compiler-Semantic.deploy.js +1207 -0
- data/amber/js/Compiler-Semantic.js +1628 -0
- data/amber/js/Compiler-Tests.deploy.js +646 -60
- data/amber/js/Compiler-Tests.js +843 -82
- data/amber/js/Compiler.deploy.js +1097 -159
- data/amber/js/Compiler.js +1414 -161
- data/amber/js/Examples.deploy.js +31 -15
- data/amber/js/Examples.js +33 -17
- data/amber/js/Helios-Announcements.deploy.js +127 -0
- data/amber/js/Helios-Announcements.js +157 -0
- data/amber/js/Helios-Browser.deploy.js +1473 -0
- data/amber/js/Helios-Browser.js +1953 -0
- data/amber/js/Helios-Commands.deploy.js +403 -0
- data/amber/js/Helios-Commands.js +563 -0
- data/amber/js/Helios-Core.deploy.js +1070 -0
- data/amber/js/Helios-Core.js +1445 -0
- data/amber/js/Helios-Environments.deploy.js +132 -0
- data/amber/js/Helios-Environments.js +179 -0
- data/amber/js/Helios-Inspector.deploy.js +855 -0
- data/amber/js/Helios-Inspector.js +1155 -0
- data/amber/js/Helios-KeyBindings.deploy.js +753 -0
- data/amber/js/Helios-KeyBindings.js +1023 -0
- data/amber/js/Helios-Layout.deploy.js +383 -0
- data/amber/js/Helios-Layout.js +523 -0
- data/amber/js/Helios-Workspace.deploy.js +799 -0
- data/amber/js/Helios-Workspace.js +1074 -0
- data/amber/js/IDE.deploy.js +2541 -1490
- data/amber/js/IDE.js +2721 -1660
- data/amber/js/Importer-Exporter.deploy.js +671 -0
- data/amber/js/Importer-Exporter.js +816 -0
- data/amber/js/Kernel-Announcements.deploy.js +137 -20
- data/amber/js/Kernel-Announcements.js +176 -22
- data/amber/js/Kernel-Classes.deploy.js +555 -168
- data/amber/js/Kernel-Classes.js +662 -205
- data/amber/js/Kernel-Collections.deploy.js +1403 -618
- data/amber/js/Kernel-Collections.js +1545 -690
- data/amber/js/Kernel-Exceptions.deploy.js +109 -45
- data/amber/js/Kernel-Exceptions.js +123 -49
- data/amber/js/Kernel-Methods.deploy.js +196 -81
- data/amber/js/Kernel-Methods.js +214 -89
- data/amber/js/Kernel-Objects.deploy.js +1542 -1117
- data/amber/js/Kernel-Objects.js +1593 -1148
- data/amber/js/Kernel-Tests.deploy.js +1725 -772
- data/amber/js/Kernel-Tests.js +2301 -1123
- data/amber/js/Kernel-Transcript.deploy.js +23 -25
- data/amber/js/Kernel-Transcript.js +24 -26
- data/amber/js/SUnit.deploy.js +204 -131
- data/amber/js/SUnit.js +222 -139
- data/amber/js/Spaces.deploy.js +240 -0
- data/amber/js/Spaces.js +326 -0
- data/amber/js/amber.js +26 -7
- data/amber/js/boot.js +65 -47
- data/amber/js/init.js +1 -1
- data/amber/js/lib/CodeMirror/amber.css +21 -21
- data/amber/js/lib/CodeMirror/codemirror.css +119 -13
- data/amber/js/lib/CodeMirror/codemirror.js +2219 -1220
- data/amber/js/lib/CodeMirror/smalltalk.js +134 -129
- data/amber/js/lib/bootstrap/css/bootstrap.css +5837 -0
- data/amber/js/lib/bootstrap/css/bootstrap.min.css +841 -0
- data/amber/js/lib/bootstrap/img/glyphicons-halflings-white.png +0 -0
- data/amber/js/lib/bootstrap/img/glyphicons-halflings.png +0 -0
- data/amber/js/lib/bootstrap/js/bootstrap.js +2038 -0
- data/amber/js/lib/bootstrap/js/bootstrap.min.js +7 -0
- data/amber/js/lib/jQuery/jquery-1.8.2.min.js +2 -0
- data/amber/js/lib/jQuery/jquery-ui-1.8.24.custom.min.js +125 -0
- data/amber/st/Compiler-AST.st +505 -0
- data/amber/st/Compiler-Core.st +835 -0
- data/amber/st/Compiler-Exceptions.st +87 -0
- data/amber/st/Compiler-IR.st +1097 -0
- data/amber/st/Compiler-Inlining.st +650 -0
- data/amber/st/Compiler-Semantic.st +558 -0
- data/amber/st/Compiler-Tests.st +285 -381
- data/amber/st/Compiler.st +725 -2
- data/amber/st/Helios-Announcements.st +104 -0
- data/amber/st/Helios-Browser.st +708 -0
- data/amber/st/Helios-Commands.st +223 -0
- data/amber/st/Helios-Core.st +532 -0
- data/amber/st/Helios-Environments.st +98 -0
- data/amber/st/Helios-Inspector.st +367 -0
- data/amber/st/Helios-KeyBindings.st +337 -0
- data/amber/st/Helios-Layout.st +199 -0
- data/amber/st/Helios-Workspace.st +367 -0
- data/amber/st/IDE.st +75 -53
- data/amber/st/Importer-Exporter.st +386 -0
- data/amber/st/Kernel-Announcements.st +92 -0
- data/amber/st/Kernel-Classes.st +137 -15
- data/amber/st/Kernel-Collections.st +137 -47
- data/amber/st/Kernel-Exceptions.st +14 -0
- data/amber/st/Kernel-Methods.st +9 -1
- data/amber/st/Kernel-Objects.st +29 -5
- data/amber/st/Kernel-Tests.st +545 -199
- data/amber/st/SUnit.st +10 -0
- data/amber/st/Spaces.st +142 -0
- data/lib/resin/app.rb +1 -1
- metadata +86 -31
- data/amber/js/lib/jQuery/jquery-1.4.4.min.js +0 -167
- data/amber/js/lib/jQuery/jquery-1.6.4.min.js +0 -4
data/amber/st/Kernel-Classes.st
CHANGED
@@ -29,12 +29,25 @@ allSubclasses
|
|
29
29
|
^result
|
30
30
|
!
|
31
31
|
|
32
|
+
allSuperclasses
|
33
|
+
|
34
|
+
self superclass ifNil: [ ^ #() ].
|
35
|
+
|
36
|
+
^ (OrderedCollection with: self superclass)
|
37
|
+
addAll: self superclass allSuperclasses;
|
38
|
+
yourself
|
39
|
+
!
|
40
|
+
|
32
41
|
comment
|
33
42
|
^(self basicAt: 'comment') ifNil: ['']
|
34
43
|
!
|
35
44
|
|
36
45
|
comment: aString
|
37
|
-
self basicAt: 'comment' put: aString
|
46
|
+
self basicAt: 'comment' put: aString.
|
47
|
+
SystemAnnouncer current
|
48
|
+
announce: (ClassCommentChanged new
|
49
|
+
theClass: self;
|
50
|
+
yourself)
|
38
51
|
!
|
39
52
|
|
40
53
|
commentStamp
|
@@ -47,12 +60,16 @@ commentStamp: aStamp prior: prior
|
|
47
60
|
^self commentStamp
|
48
61
|
!
|
49
62
|
|
63
|
+
definition
|
64
|
+
^ ''
|
65
|
+
!
|
66
|
+
|
50
67
|
instanceVariableNames
|
51
68
|
<return self.iVarNames>
|
52
69
|
!
|
53
70
|
|
54
|
-
methodAt:
|
55
|
-
<return smalltalk.methods(self)[
|
71
|
+
methodAt: aSymbol
|
72
|
+
<return smalltalk.methods(self)[aSymbol._asString()]>
|
56
73
|
!
|
57
74
|
|
58
75
|
methodDictionary
|
@@ -66,6 +83,10 @@ methodDictionary
|
|
66
83
|
return dict>
|
67
84
|
!
|
68
85
|
|
86
|
+
methods
|
87
|
+
^ self methodDictionary values
|
88
|
+
!
|
89
|
+
|
69
90
|
methodsFor: aString
|
70
91
|
^ClassCategoryReader new
|
71
92
|
class: self category: aString;
|
@@ -77,6 +98,10 @@ methodsFor: aString stamp: aStamp
|
|
77
98
|
^self methodsFor: aString
|
78
99
|
!
|
79
100
|
|
101
|
+
methodsInProtocol: aString
|
102
|
+
^ self methodDictionary values select: [ :each | each protocol = aString ]
|
103
|
+
!
|
104
|
+
|
80
105
|
name
|
81
106
|
<return self.className || nil>
|
82
107
|
!
|
@@ -107,6 +132,10 @@ prototype
|
|
107
132
|
<return self.fn.prototype>
|
108
133
|
!
|
109
134
|
|
135
|
+
selectors
|
136
|
+
^ self methodDictionary keys
|
137
|
+
!
|
138
|
+
|
110
139
|
subclasses
|
111
140
|
<return smalltalk.subclasses(self)>
|
112
141
|
!
|
@@ -115,6 +144,14 @@ superclass
|
|
115
144
|
<return self.superclass || nil>
|
116
145
|
!
|
117
146
|
|
147
|
+
theMetaClass
|
148
|
+
^ self class
|
149
|
+
!
|
150
|
+
|
151
|
+
theNonMetaClass
|
152
|
+
^ self
|
153
|
+
!
|
154
|
+
|
118
155
|
withAllSubclasses
|
119
156
|
^(Array with: self) addAll: self allSubclasses; yourself
|
120
157
|
! !
|
@@ -122,7 +159,13 @@ withAllSubclasses
|
|
122
159
|
!Behavior methodsFor: 'compiling'!
|
123
160
|
|
124
161
|
addCompiledMethod: aMethod
|
125
|
-
<smalltalk.addMethod(aMethod.selector._asSelector(), aMethod, self)
|
162
|
+
<smalltalk.addMethod(aMethod.selector._asSelector(), aMethod, self)>.
|
163
|
+
|
164
|
+
SystemAnnouncer current
|
165
|
+
announce: (MethodAdded new
|
166
|
+
theClass: self;
|
167
|
+
method: aMethod;
|
168
|
+
yourself)
|
126
169
|
!
|
127
170
|
|
128
171
|
compile: aString
|
@@ -131,14 +174,21 @@ compile: aString
|
|
131
174
|
|
132
175
|
compile: aString category: anotherString
|
133
176
|
Compiler new
|
134
|
-
install: aString
|
135
|
-
|
177
|
+
install: aString
|
178
|
+
forClass: self
|
179
|
+
category: anotherString
|
136
180
|
!
|
137
181
|
|
138
182
|
removeCompiledMethod: aMethod
|
139
183
|
<delete self.fn.prototype[aMethod.selector._asSelector()];
|
140
184
|
delete self.fn.prototype.methods[aMethod.selector];
|
141
|
-
smalltalk.init(self)
|
185
|
+
smalltalk.init(self);>.
|
186
|
+
|
187
|
+
SystemAnnouncer current
|
188
|
+
announce: (MethodRemoved new
|
189
|
+
theClass: self;
|
190
|
+
method: aMethod;
|
191
|
+
yourself)
|
142
192
|
! !
|
143
193
|
|
144
194
|
!Behavior methodsFor: 'instance creation'!
|
@@ -177,6 +227,24 @@ category
|
|
177
227
|
^self package ifNil: ['Unclassified'] ifNotNil: [self package name]
|
178
228
|
!
|
179
229
|
|
230
|
+
definition
|
231
|
+
^ String streamContents: [ :stream |
|
232
|
+
stream
|
233
|
+
nextPutAll: self superclass asString;
|
234
|
+
nextPutAll: ' subclass: #';
|
235
|
+
nextPutAll: self name;
|
236
|
+
nextPutAll: String lf, String tab;
|
237
|
+
nextPutAll: 'instanceVariableNames: '''.
|
238
|
+
self instanceVariableNames
|
239
|
+
do: [ :each | stream nextPutAll: each ]
|
240
|
+
separatedBy: [ stream nextPutAll: ' ' ].
|
241
|
+
stream
|
242
|
+
nextPutAll: '''', String lf, String tab;
|
243
|
+
nextPutAll: 'package: ''';
|
244
|
+
nextPutAll: self category;
|
245
|
+
nextPutAll: '''' ]
|
246
|
+
!
|
247
|
+
|
180
248
|
package
|
181
249
|
<return self.pkg>
|
182
250
|
!
|
@@ -186,11 +254,7 @@ package: aPackage
|
|
186
254
|
!
|
187
255
|
|
188
256
|
rename: aString
|
189
|
-
|
190
|
-
smalltalk[aString] = self;
|
191
|
-
delete smalltalk[self.className];
|
192
|
-
self.className = aString;
|
193
|
-
>
|
257
|
+
ClassBuilder new renameClass: self to: aString
|
194
258
|
! !
|
195
259
|
|
196
260
|
!Class methodsFor: 'class creation'!
|
@@ -216,6 +280,12 @@ subclass: aString instanceVariableNames: aString2 package: aString3
|
|
216
280
|
superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3
|
217
281
|
! !
|
218
282
|
|
283
|
+
!Class methodsFor: 'converting'!
|
284
|
+
|
285
|
+
asJavascript
|
286
|
+
^ 'smalltalk.', self name
|
287
|
+
! !
|
288
|
+
|
219
289
|
!Class methodsFor: 'printing'!
|
220
290
|
|
221
291
|
printString
|
@@ -239,6 +309,18 @@ Metaclass instances have a single instance, which they hold onto, which is the c
|
|
239
309
|
|
240
310
|
!Metaclass methodsFor: 'accessing'!
|
241
311
|
|
312
|
+
definition
|
313
|
+
^ String streamContents: [ :stream |
|
314
|
+
stream
|
315
|
+
nextPutAll: self asString;
|
316
|
+
nextPutAll: ' class ';
|
317
|
+
nextPutAll: 'instanceVariableNames: '''.
|
318
|
+
self instanceVariableNames
|
319
|
+
do: [ :each | stream nextPutAll: each ]
|
320
|
+
separatedBy: [ stream nextPutAll: ' ' ].
|
321
|
+
stream nextPutAll: '''' ]
|
322
|
+
!
|
323
|
+
|
242
324
|
instanceClass
|
243
325
|
<return self.instanceClass>
|
244
326
|
!
|
@@ -246,6 +328,20 @@ instanceClass
|
|
246
328
|
instanceVariableNames: aCollection
|
247
329
|
ClassBuilder new
|
248
330
|
class: self instanceVariableNames: aCollection
|
331
|
+
!
|
332
|
+
|
333
|
+
theMetaClass
|
334
|
+
^ self
|
335
|
+
!
|
336
|
+
|
337
|
+
theNonMetaClass
|
338
|
+
^ self instanceClass
|
339
|
+
! !
|
340
|
+
|
341
|
+
!Metaclass methodsFor: 'converting'!
|
342
|
+
|
343
|
+
asJavascript
|
344
|
+
^ 'smalltalk.', self instanceClass name, '.klass'
|
249
345
|
! !
|
250
346
|
|
251
347
|
!Metaclass methodsFor: 'printing'!
|
@@ -273,19 +369,45 @@ Rather than using ClassBuilder directly to compile a class, use `Class >> subcla
|
|
273
369
|
class: aClass instanceVariableNames: aString
|
274
370
|
aClass isMetaclass ifFalse: [self error: aClass name, ' is not a metaclass'].
|
275
371
|
aClass basicAt: 'iVarNames' put: (self instanceVariableNamesFor: aString).
|
372
|
+
|
373
|
+
SystemAnnouncer current
|
374
|
+
announce: (ClassDefinitionChanged new
|
375
|
+
theClass: aClass;
|
376
|
+
yourself).
|
377
|
+
|
276
378
|
self setupClass: aClass
|
277
379
|
!
|
278
380
|
|
381
|
+
renameClass: aClass to: aString
|
382
|
+
<
|
383
|
+
smalltalk[aString] = aClass;
|
384
|
+
delete smalltalk[aClass.className];
|
385
|
+
aClass.className = aString;
|
386
|
+
>.
|
387
|
+
|
388
|
+
SystemAnnouncer current
|
389
|
+
announce: (ClassRenamed new
|
390
|
+
theClass: aClass;
|
391
|
+
yourself)
|
392
|
+
!
|
393
|
+
|
279
394
|
superclass: aClass subclass: aString
|
280
395
|
^self superclass: aClass subclass: aString instanceVariableNames: '' package: nil
|
281
396
|
!
|
282
397
|
|
283
398
|
superclass: aClass subclass: aString instanceVariableNames: aString2 package: aString3
|
284
399
|
| newClass |
|
285
|
-
|
286
|
-
|
287
|
-
|
400
|
+
|
401
|
+
newClass := self addSubclassOf: aClass
|
402
|
+
named: aString instanceVariableNames: (self instanceVariableNamesFor: aString2)
|
403
|
+
package: (aString3 ifNil: ['unclassified']).
|
288
404
|
self setupClass: newClass.
|
405
|
+
|
406
|
+
SystemAnnouncer current
|
407
|
+
announce: (ClassAdded new
|
408
|
+
theClass: newClass;
|
409
|
+
yourself).
|
410
|
+
|
289
411
|
^newClass
|
290
412
|
! !
|
291
413
|
|
@@ -27,16 +27,22 @@ value: aValue
|
|
27
27
|
^self class = anAssociation class and: [
|
28
28
|
self key = anAssociation key and: [
|
29
29
|
self value = anAssociation value]]
|
30
|
+
! !
|
31
|
+
|
32
|
+
!Association methodsFor: 'printing'!
|
33
|
+
|
34
|
+
printString
|
35
|
+
"print the contents of the Association into a string and return the string"
|
36
|
+
^String streamContents: [:aStream |
|
37
|
+
self storeOn: aStream]
|
30
38
|
!
|
31
39
|
|
32
40
|
storeOn: aStream
|
33
|
-
"Store in the format
|
41
|
+
"Store in the format: key->value"
|
34
42
|
|
35
|
-
"aStream nextPutAll: '('."
|
36
43
|
key storeOn: aStream.
|
37
44
|
aStream nextPutAll: '->'.
|
38
45
|
value storeOn: aStream.
|
39
|
-
"aStream nextPutAll: ')'"
|
40
46
|
! !
|
41
47
|
|
42
48
|
!Association class methodsFor: 'instance creation'!
|
@@ -54,6 +60,15 @@ Object subclass: #Collection
|
|
54
60
|
|
55
61
|
!Collection methodsFor: 'accessing'!
|
56
62
|
|
63
|
+
occurrencesOf: anObject
|
64
|
+
"Answer how many of the receiver's elements are equal to anObject."
|
65
|
+
|
66
|
+
| tally |
|
67
|
+
tally := 0.
|
68
|
+
self do: [:each | anObject = each ifTrue: [tally := tally + 1]].
|
69
|
+
^tally
|
70
|
+
!
|
71
|
+
|
57
72
|
readStream
|
58
73
|
^self stream
|
59
74
|
!
|
@@ -138,11 +153,11 @@ copyWithoutAll: aCollection
|
|
138
153
|
!Collection methodsFor: 'enumerating'!
|
139
154
|
|
140
155
|
collect: aBlock
|
141
|
-
|
|
142
|
-
|
143
|
-
self do: [:each |
|
144
|
-
|
145
|
-
^
|
156
|
+
| stream |
|
157
|
+
stream := self class new writeStream.
|
158
|
+
self do: [ :each |
|
159
|
+
stream nextPut: (aBlock value: each) ].
|
160
|
+
^stream contents
|
146
161
|
!
|
147
162
|
|
148
163
|
detect: aBlock
|
@@ -180,6 +195,22 @@ inject: anObject into: aBlock
|
|
180
195
|
^result
|
181
196
|
!
|
182
197
|
|
198
|
+
intersection: aCollection
|
199
|
+
"Answer the set theoretic intersection of two collections."
|
200
|
+
|
201
|
+
| set outputSet |
|
202
|
+
|
203
|
+
set := self asSet.
|
204
|
+
outputSet := Set new.
|
205
|
+
|
206
|
+
aCollection do: [ :each |
|
207
|
+
((set includes: each) and: [(outputSet includes: each) not])
|
208
|
+
ifTrue: [
|
209
|
+
outputSet add: each]].
|
210
|
+
|
211
|
+
^ self class withAll: outputSet asArray
|
212
|
+
!
|
213
|
+
|
183
214
|
reject: aBlock
|
184
215
|
^self select: [:each | (aBlock value: each) = false]
|
185
216
|
!
|
@@ -199,6 +230,18 @@ errorNotFound
|
|
199
230
|
self error: 'Object is not in the collection'
|
200
231
|
! !
|
201
232
|
|
233
|
+
!Collection methodsFor: 'printing'!
|
234
|
+
|
235
|
+
printString
|
236
|
+
"print the contents of the Collection into a string and return it"
|
237
|
+
^String streamContents: [:aStream |
|
238
|
+
aStream
|
239
|
+
nextPutAll: super printString, ' ('.
|
240
|
+
self do: [:each | aStream nextPutAll: each printString]
|
241
|
+
separatedBy: [aStream nextPutAll: ' '].
|
242
|
+
aStream nextPutAll: ')']
|
243
|
+
! !
|
244
|
+
|
202
245
|
!Collection methodsFor: 'testing'!
|
203
246
|
|
204
247
|
ifEmpty: aBlock
|
@@ -304,13 +347,21 @@ at: aKey ifAbsentPut: aBlock
|
|
304
347
|
!
|
305
348
|
|
306
349
|
at: aKey ifPresent: aBlock
|
307
|
-
|
350
|
+
"Lookup the given key in the receiver.
|
351
|
+
If it is present, answer the value of evaluating the given block with the value associated with the key.
|
352
|
+
Otherwise, answer nil."
|
353
|
+
^(self includesKey: aKey)
|
354
|
+
ifTrue: [ aBlock value: (self at: aKey) ]
|
355
|
+
ifFalse: [ nil ]
|
308
356
|
!
|
309
357
|
|
310
358
|
at: aKey ifPresent: aBlock ifAbsent: anotherBlock
|
311
|
-
|
312
|
-
|
313
|
-
|
359
|
+
"Lookup the given key in the receiver.
|
360
|
+
If it is present, answer the value of evaluating the oneArgBlock with the value associated with the key,
|
361
|
+
otherwise answer the value of absentBlock."
|
362
|
+
^(self includesKey: aKey)
|
363
|
+
ifTrue: [ aBlock value: (self at: aKey) ]
|
364
|
+
ifFalse: anotherBlock
|
314
365
|
!
|
315
366
|
|
316
367
|
at: aKey put: aValue
|
@@ -453,18 +504,13 @@ select: aBlock
|
|
453
504
|
!HashedCollection methodsFor: 'printing'!
|
454
505
|
|
455
506
|
printString
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
nextPutAll: anAssociation key printString;
|
464
|
-
nextPutAll: ' -> ';
|
465
|
-
nextPutAll: anAssociation value printString]
|
466
|
-
separatedBy: [aStream nextPutAll: ' , '].
|
467
|
-
aStream nextPutAll: ')']
|
507
|
+
"print the contents of the HashedCollection into a string and return the string"
|
508
|
+
^String streamContents: [:aStream |
|
509
|
+
aStream nextPutAll: 'a ', self class name, '('.
|
510
|
+
self associations
|
511
|
+
do: [:each | each storeOn: aStream]
|
512
|
+
separatedBy: [ aStream nextPutAll: ' , '].
|
513
|
+
aStream nextPutAll: ')']
|
468
514
|
!
|
469
515
|
|
470
516
|
storeOn: aStream
|
@@ -524,10 +570,22 @@ at: aKey put: aValue
|
|
524
570
|
>
|
525
571
|
!
|
526
572
|
|
573
|
+
keyAtValue: anObject
|
574
|
+
|
575
|
+
^ (self associations
|
576
|
+
detect:[:k :v| v == anObject]
|
577
|
+
ifNone:[self error: 'Not found']) key
|
578
|
+
!
|
579
|
+
|
527
580
|
keys
|
528
581
|
^keys copy
|
529
582
|
!
|
530
583
|
|
584
|
+
valueAt: anObject
|
585
|
+
|
586
|
+
^ self associationsDo:2
|
587
|
+
!
|
588
|
+
|
531
589
|
values
|
532
590
|
^values copy
|
533
591
|
! !
|
@@ -624,9 +682,9 @@ indexOf: anObject
|
|
624
682
|
|
625
683
|
indexOf: anObject ifAbsent: aBlock
|
626
684
|
<
|
627
|
-
for(var i=0;i<self.length;i++){
|
628
|
-
if(self[i]
|
629
|
-
}
|
685
|
+
for(var i=0;i<self.length;i++) {
|
686
|
+
if(smalltalk.send(self[i], '__eq', [anObject])) {return i+1}
|
687
|
+
};
|
630
688
|
return aBlock();
|
631
689
|
>
|
632
690
|
!
|
@@ -718,19 +776,6 @@ withIndexDo: aBlock
|
|
718
776
|
<for(var i=0;i<self.length;i++){aBlock(self[i], i+1);}>
|
719
777
|
! !
|
720
778
|
|
721
|
-
!SequenceableCollection methodsFor: 'printing'!
|
722
|
-
|
723
|
-
printString
|
724
|
-
| str |
|
725
|
-
str := '' writeStream.
|
726
|
-
str nextPutAll: super printString, ' ('.
|
727
|
-
self
|
728
|
-
do: [:each | str nextPutAll: each printString]
|
729
|
-
separatedBy: [str nextPutAll: ' '].
|
730
|
-
str nextPutAll: ')'.
|
731
|
-
^str contents
|
732
|
-
! !
|
733
|
-
|
734
779
|
SequenceableCollection subclass: #Array
|
735
780
|
instanceVariableNames: ''
|
736
781
|
package: 'Kernel-Collections'!
|
@@ -758,15 +803,16 @@ add: anObject
|
|
758
803
|
<self.push(anObject); return anObject;>
|
759
804
|
!
|
760
805
|
|
761
|
-
remove: anObject
|
806
|
+
remove: anObject ifAbsent: aBlock
|
762
807
|
<
|
763
808
|
for(var i=0;i<self.length;i++) {
|
764
809
|
if(self[i] == anObject) {
|
765
810
|
self.splice(i,1);
|
766
|
-
|
811
|
+
return self;
|
767
812
|
}
|
768
813
|
}
|
769
|
-
|
814
|
+
>.
|
815
|
+
aBlock value
|
770
816
|
!
|
771
817
|
|
772
818
|
removeFrom: aNumber to: anotherNumber
|
@@ -837,10 +883,12 @@ with: anObject with: anObject2 with: anObject3
|
|
837
883
|
!
|
838
884
|
|
839
885
|
withAll: aCollection
|
840
|
-
| instance |
|
886
|
+
| instance index |
|
887
|
+
index := 1.
|
841
888
|
instance := self new: aCollection size.
|
842
|
-
aCollection
|
843
|
-
instance at: index put: each
|
889
|
+
aCollection do: [:each |
|
890
|
+
instance at: index put: each.
|
891
|
+
index := index + 1].
|
844
892
|
^instance
|
845
893
|
! !
|
846
894
|
|
@@ -921,7 +969,7 @@ asciiValue
|
|
921
969
|
!
|
922
970
|
|
923
971
|
at: anIndex ifAbsent: aBlock
|
924
|
-
<return self
|
972
|
+
<return String(self).charAt(anIndex - 1) || aBlock()>
|
925
973
|
!
|
926
974
|
|
927
975
|
escaped
|
@@ -1046,6 +1094,16 @@ shallowCopy
|
|
1046
1094
|
^self class fromString: self
|
1047
1095
|
! !
|
1048
1096
|
|
1097
|
+
!String methodsFor: 'enumerating'!
|
1098
|
+
|
1099
|
+
do: aBlock
|
1100
|
+
<for(var i=0;i<self.length;i++){aBlock(self.charAt(i));}>
|
1101
|
+
!
|
1102
|
+
|
1103
|
+
withIndexDo: aBlock
|
1104
|
+
<for(var i=0;i<self.length;i++){aBlock(self.charAt(i), i+1);}>
|
1105
|
+
! !
|
1106
|
+
|
1049
1107
|
!String methodsFor: 'printing'!
|
1050
1108
|
|
1051
1109
|
printNl
|
@@ -1210,6 +1268,10 @@ tab
|
|
1210
1268
|
|
1211
1269
|
!String class methodsFor: 'instance creation'!
|
1212
1270
|
|
1271
|
+
fromCharCode: anInteger
|
1272
|
+
<return String.fromCharCode(anInteger)>
|
1273
|
+
!
|
1274
|
+
|
1213
1275
|
fromString: aString
|
1214
1276
|
<return new self.fn(aString)>
|
1215
1277
|
!
|
@@ -1299,6 +1361,34 @@ shallowCopy
|
|
1299
1361
|
^self
|
1300
1362
|
! !
|
1301
1363
|
|
1364
|
+
!Symbol methodsFor: 'enumerating'!
|
1365
|
+
|
1366
|
+
collect: aBlock
|
1367
|
+
^ (self asString collect: aBlock) asSymbol
|
1368
|
+
!
|
1369
|
+
|
1370
|
+
detect: aBlock
|
1371
|
+
^ self asString detect: aBlock
|
1372
|
+
!
|
1373
|
+
|
1374
|
+
do: aBlock
|
1375
|
+
self asString do: aBlock
|
1376
|
+
!
|
1377
|
+
|
1378
|
+
select: aBlock
|
1379
|
+
^ (self asString select: aBlock) asSymbol
|
1380
|
+
!
|
1381
|
+
|
1382
|
+
withIndexDo: aBlock
|
1383
|
+
self asString withIndexDo: aBlock
|
1384
|
+
! !
|
1385
|
+
|
1386
|
+
!Symbol methodsFor: 'evaluating'!
|
1387
|
+
|
1388
|
+
value: anObject
|
1389
|
+
^anObject perform: self
|
1390
|
+
! !
|
1391
|
+
|
1302
1392
|
!Symbol methodsFor: 'printing'!
|
1303
1393
|
|
1304
1394
|
isSymbol
|