resin 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +2 -0
- data/amber/bin/nodecompile.js +3 -3
- data/amber/css/amber.css +47 -23
- data/amber/images/off.amber.png +0 -0
- data/amber/images/offHover.amber.png +0 -0
- data/amber/images/sprite.amber.png +0 -0
- data/amber/images/tinylogo.amber.png +0 -0
- data/amber/js/Benchfib.deploy.js +34 -34
- data/amber/js/Benchfib.js +49 -49
- data/amber/js/Canvas.deploy.js +937 -937
- data/amber/js/Canvas.js +1622 -1622
- data/amber/js/Compiler-Tests.deploy.js +97 -0
- data/amber/js/Compiler-Tests.js +137 -0
- data/amber/js/Compiler.deploy.js +1030 -924
- data/amber/js/Compiler.js +1613 -1467
- data/amber/js/Documentation.deploy.js +417 -417
- data/amber/js/Documentation.js +728 -728
- data/amber/js/Examples.deploy.js +24 -13
- data/amber/js/Examples.js +36 -19
- data/amber/js/IDE.deploy.js +1583 -1527
- data/amber/js/IDE.js +2586 -2510
- data/amber/js/Kernel-Announcements.deploy.js +19 -19
- data/amber/js/Kernel-Announcements.js +28 -28
- data/amber/js/Kernel-Classes.deploy.js +332 -229
- data/amber/js/Kernel-Classes.js +532 -384
- data/amber/js/Kernel-Collections.deploy.js +1516 -1712
- data/amber/js/Kernel-Collections.js +2436 -2712
- data/amber/js/Kernel-Exceptions.deploy.js +85 -62
- data/amber/js/Kernel-Exceptions.js +131 -98
- data/amber/js/Kernel-Methods.deploy.js +326 -378
- data/amber/js/Kernel-Methods.js +473 -525
- data/amber/js/Kernel-Objects.deploy.js +1777 -2428
- data/amber/js/Kernel-Objects.js +2599 -3426
- data/amber/js/Kernel-Tests.deploy.js +871 -772
- data/amber/js/Kernel-Tests.js +1207 -1083
- data/amber/js/Kernel-Transcript.deploy.js +57 -57
- data/amber/js/Kernel-Transcript.js +94 -94
- data/amber/js/SUnit.deploy.js +116 -116
- data/amber/js/SUnit.js +211 -211
- data/amber/js/amber.js +10 -11
- data/amber/js/boot.js +132 -156
- data/amber/js/init.js +2 -2
- data/amber/js/parser.js +2095 -3014
- data/amber/js/parser.pegjs +1 -1
- data/amber/st/Benchfib.st +22 -22
- data/amber/st/Canvas.st +471 -471
- data/amber/st/Compiler-Tests.st +471 -0
- data/amber/st/Compiler.st +858 -794
- data/amber/st/Examples.st +22 -5
- data/amber/st/IDE.st +1326 -1291
- data/amber/st/Kernel-Announcements.st +2 -2
- data/amber/st/Kernel-Classes.st +148 -90
- data/amber/st/Kernel-Collections.st +950 -1061
- data/amber/st/Kernel-Exceptions.st +33 -25
- data/amber/st/Kernel-Methods.st +151 -151
- data/amber/st/Kernel-Objects.st +891 -1036
- data/amber/st/Kernel-Tests.st +622 -544
- data/amber/st/Kernel-Transcript.st +38 -38
- data/amber/st/SUnit.st +53 -53
- metadata +27 -20
@@ -0,0 +1,471 @@
|
|
1
|
+
Smalltalk current createPackage: 'Compiler-Tests' properties: #{}!
|
2
|
+
TestCase subclass: #ImporterTest
|
3
|
+
instanceVariableNames: ''
|
4
|
+
category: 'Compiler-Tests'!
|
5
|
+
|
6
|
+
!ImporterTest methodsFor: 'private'!
|
7
|
+
|
8
|
+
chunkString
|
9
|
+
|
10
|
+
^'!!Object methodsFor: ''importer test method''!!
|
11
|
+
|
12
|
+
importerTestMethod
|
13
|
+
|
14
|
+
^''success''
|
15
|
+
!! !!
|
16
|
+
'
|
17
|
+
!
|
18
|
+
|
19
|
+
bigChunkString
|
20
|
+
|
21
|
+
^'Smalltalk current createPackage: ''Cypress-Definitions'' properties: #{}!!
|
22
|
+
Object subclass: #CypressSnapshot
|
23
|
+
instanceVariableNames: ''definitions''
|
24
|
+
package: ''Cypress-Definitions''!!
|
25
|
+
|
26
|
+
!!CypressSnapshot methodsFor: ''not yet classified''!!
|
27
|
+
|
28
|
+
definitions: aDefinitions
|
29
|
+
|
30
|
+
definitions := aDefinitions
|
31
|
+
!!
|
32
|
+
|
33
|
+
definitions
|
34
|
+
|
35
|
+
^definitions
|
36
|
+
!! !!
|
37
|
+
|
38
|
+
!!CypressSnapshot class methodsFor: ''not yet classified''!!
|
39
|
+
|
40
|
+
definitions: aDefinitions
|
41
|
+
|
42
|
+
^(self new) definitions: aDefinitions
|
43
|
+
!! !!
|
44
|
+
|
45
|
+
Object subclass: #CypressPackage
|
46
|
+
instanceVariableNames: ''name''
|
47
|
+
package: ''Cypress-Definitions''!!
|
48
|
+
|
49
|
+
!!CypressPackage methodsFor: ''not yet classified''!!
|
50
|
+
|
51
|
+
= other
|
52
|
+
^ other species = self species and: [other name sameAs: name]
|
53
|
+
!!
|
54
|
+
|
55
|
+
name
|
56
|
+
^ name
|
57
|
+
!!
|
58
|
+
|
59
|
+
name: aString
|
60
|
+
name := aString
|
61
|
+
!!
|
62
|
+
|
63
|
+
snapshot
|
64
|
+
| package definitions name |
|
65
|
+
package := Package named: self name.
|
66
|
+
definitions := OrderedCollection new.
|
67
|
+
package sortedClasses do: [:cls |
|
68
|
+
definitions add: cls asCypressClassDefinition.
|
69
|
+
cls methodDictionary values do: [:method |
|
70
|
+
(method category match: ''^\*'') ifFalse: [
|
71
|
+
definitions add: method asCypressMethodDefinition ]].
|
72
|
+
cls class methodDictionary values do: [:method |
|
73
|
+
(method category match: ''^\*'') ifFalse: [
|
74
|
+
definitions add: method asCypressMethodDefinition ]]].
|
75
|
+
name := package name.
|
76
|
+
Smalltalk current classes, (Smalltalk current classes collect: [:each | each class]) do: [:each |
|
77
|
+
each methodDictionary values do: [:method |
|
78
|
+
method category = (''*'', name) ifTrue: [
|
79
|
+
definitions add: method asCypressMethodDefinition ]]].
|
80
|
+
^ CypressSnapshot definitions: definitions
|
81
|
+
!!
|
82
|
+
|
83
|
+
printString
|
84
|
+
^super printString, ''('', name, '')''
|
85
|
+
!! !!
|
86
|
+
|
87
|
+
Object subclass: #CypressDefinition
|
88
|
+
instanceVariableNames: ''''
|
89
|
+
package: ''Cypress-Definitions''!!
|
90
|
+
|
91
|
+
!!CypressDefinition methodsFor: ''not yet classified''!!
|
92
|
+
|
93
|
+
= aDefinition
|
94
|
+
^(aDefinition isKindOf: CypressDefinition) and: [self isRevisionOf: aDefinition]
|
95
|
+
!!
|
96
|
+
|
97
|
+
isRevisionOf: aDefinition
|
98
|
+
^ (aDefinition isKindOf: CypressDefinition) and: [aDefinition description = self description]
|
99
|
+
!!
|
100
|
+
|
101
|
+
description
|
102
|
+
self subclassResponsibility
|
103
|
+
!!
|
104
|
+
|
105
|
+
isSameRevisionAs: aDefinition
|
106
|
+
^ self = aDefinition
|
107
|
+
!! !!
|
108
|
+
|
109
|
+
Object subclass: #CypressPatch
|
110
|
+
instanceVariableNames: ''operations''
|
111
|
+
package: ''Cypress-Definitions''!!
|
112
|
+
|
113
|
+
!!CypressPatch methodsFor: ''not yet classified''!!
|
114
|
+
|
115
|
+
fromBase: baseSnapshot toTarget: targetSnapshot
|
116
|
+
| base target |
|
117
|
+
operations := OrderedCollection new.
|
118
|
+
base := CypressDefinitionIndex definitions: baseSnapshot definitions.
|
119
|
+
target := CypressDefinitionIndex definitions: targetSnapshot definitions.
|
120
|
+
|
121
|
+
target definitions do:
|
122
|
+
[:t |
|
123
|
+
base
|
124
|
+
definitionLike: t
|
125
|
+
ifPresent: [:b | (b isSameRevisionAs: t) ifFalse: [operations add: (CypressModification of: b to: t)]]
|
126
|
+
ifAbsent: [operations add: (CypressAddition of: t)]].
|
127
|
+
|
128
|
+
base definitions do:
|
129
|
+
[:b |
|
130
|
+
target
|
131
|
+
definitionLike: b
|
132
|
+
ifPresent: [:t | ]
|
133
|
+
ifAbsent: [operations add: (CypressRemoval of: b)]]
|
134
|
+
!!
|
135
|
+
|
136
|
+
operations
|
137
|
+
|
138
|
+
^operations
|
139
|
+
!! !!
|
140
|
+
|
141
|
+
!!CypressPatch class methodsFor: ''not yet classified''!!
|
142
|
+
|
143
|
+
fromBase: baseSnapshot toTarget: targetSnapshot
|
144
|
+
^ (self new)
|
145
|
+
fromBase: baseSnapshot
|
146
|
+
toTarget: targetSnapshot
|
147
|
+
!! !!
|
148
|
+
|
149
|
+
Object subclass: #CypressDefinitionIndex
|
150
|
+
instanceVariableNames: ''definitionMap''
|
151
|
+
package: ''Cypress-Definitions''!!
|
152
|
+
|
153
|
+
!!CypressDefinitionIndex methodsFor: ''not yet classified''!!
|
154
|
+
|
155
|
+
add: aDefinition
|
156
|
+
^ self definitionMap at: aDefinition description put: aDefinition
|
157
|
+
!!
|
158
|
+
|
159
|
+
addAll: aCollection
|
160
|
+
aCollection do: [:ea | self add: ea]
|
161
|
+
!!
|
162
|
+
|
163
|
+
definitionLike: aDefinition ifPresent: foundBlock ifAbsent: errorBlock
|
164
|
+
| definition |
|
165
|
+
definition := self definitionMap at: aDefinition description ifAbsent: [].
|
166
|
+
^ definition
|
167
|
+
ifNil: errorBlock
|
168
|
+
ifNotNil: [foundBlock value: definition]
|
169
|
+
!!
|
170
|
+
|
171
|
+
definitions
|
172
|
+
^self definitionMap values
|
173
|
+
!!
|
174
|
+
|
175
|
+
definitionMap
|
176
|
+
definitionMap ifNil: [ definitionMap := Dictionary new ].
|
177
|
+
^ definitionMap
|
178
|
+
!!
|
179
|
+
|
180
|
+
remove: aDefinition
|
181
|
+
self definitionMap removeKey: aDefinition description ifAbsent: []
|
182
|
+
!! !!
|
183
|
+
|
184
|
+
!!CypressDefinitionIndex class methodsFor: ''not yet classified''!!
|
185
|
+
|
186
|
+
definitions: aCollection
|
187
|
+
^ self new addAll: aCollection
|
188
|
+
!! !!
|
189
|
+
|
190
|
+
Object subclass: #CypressPatchOperation
|
191
|
+
instanceVariableNames: ''''
|
192
|
+
package: ''Cypress-Definitions''!!
|
193
|
+
|
194
|
+
CypressDefinition subclass: #CypressClassDefinition
|
195
|
+
instanceVariableNames: ''name superclassName category comment instVarNames classInstVarNames''
|
196
|
+
package: ''Cypress-Definitions''!!
|
197
|
+
|
198
|
+
!!CypressClassDefinition methodsFor: ''not yet classified''!!
|
199
|
+
|
200
|
+
name: aClassName superclassName: aSuperclassName category: aCategory instVarNames: anInstanceVariableNames classInstVarNames: aClassInstanceVariableNames comment: aComment
|
201
|
+
|
202
|
+
name := aClassName.
|
203
|
+
superclassName := aSuperclassName.
|
204
|
+
category := aCategory.
|
205
|
+
instVarNames := anInstanceVariableNames.
|
206
|
+
classInstVarNames := aClassInstanceVariableNames.
|
207
|
+
comment := aComment
|
208
|
+
!!
|
209
|
+
|
210
|
+
= aDefinition
|
211
|
+
^(super = aDefinition)
|
212
|
+
and: [superclassName = aDefinition superclassName
|
213
|
+
and: [category = aDefinition category
|
214
|
+
and: [instVarNames = aDefinition instVarNames
|
215
|
+
and: [classInstVarNames = aDefinition classInstVarNames
|
216
|
+
and: [comment = aDefinition comment]]]]]
|
217
|
+
!!
|
218
|
+
|
219
|
+
superclassName
|
220
|
+
|
221
|
+
^superclassName
|
222
|
+
!!
|
223
|
+
|
224
|
+
name
|
225
|
+
|
226
|
+
^name
|
227
|
+
!!
|
228
|
+
|
229
|
+
category
|
230
|
+
|
231
|
+
^category
|
232
|
+
!!
|
233
|
+
|
234
|
+
comment
|
235
|
+
|
236
|
+
^comment
|
237
|
+
!!
|
238
|
+
|
239
|
+
description
|
240
|
+
|
241
|
+
^ Array with: name
|
242
|
+
!!
|
243
|
+
|
244
|
+
instVarNames
|
245
|
+
|
246
|
+
^instVarNames
|
247
|
+
!!
|
248
|
+
|
249
|
+
classInstVarNames
|
250
|
+
|
251
|
+
^classInstVarNames
|
252
|
+
!! !!
|
253
|
+
|
254
|
+
!!CypressClassDefinition class methodsFor: ''not yet classified''!!
|
255
|
+
|
256
|
+
name: aClassName
|
257
|
+
superclassName: aSuperclassName
|
258
|
+
category: aCategory
|
259
|
+
instVarNames: anInstanceVariableNames
|
260
|
+
classInstVarNames: aClassInstanceVariableNames
|
261
|
+
comment: aComment
|
262
|
+
|
263
|
+
^(self new)
|
264
|
+
name: aClassName
|
265
|
+
superclassName: aSuperclassName
|
266
|
+
category: aCategory
|
267
|
+
instVarNames: anInstanceVariableNames
|
268
|
+
classInstVarNames: aClassInstanceVariableNames
|
269
|
+
comment: aComment
|
270
|
+
!! !!
|
271
|
+
|
272
|
+
CypressDefinition subclass: #CypressMethodDefinition
|
273
|
+
instanceVariableNames: ''classIsMeta source category selector className''
|
274
|
+
package: ''Cypress-Definitions''!!
|
275
|
+
|
276
|
+
!!CypressMethodDefinition methodsFor: ''not yet classified''!!
|
277
|
+
|
278
|
+
className: aName classIsMeta: isMetaclass selector: aSelector category: aCategory source: aSource
|
279
|
+
|
280
|
+
className := aName.
|
281
|
+
classIsMeta := isMetaclass.
|
282
|
+
selector := aSelector.
|
283
|
+
category := aCategory.
|
284
|
+
source := aSource.
|
285
|
+
!!
|
286
|
+
|
287
|
+
= aDefinition
|
288
|
+
^ super = aDefinition
|
289
|
+
and: [ aDefinition source = self source
|
290
|
+
and: [ aDefinition category = self category ] ]
|
291
|
+
!!
|
292
|
+
|
293
|
+
source
|
294
|
+
|
295
|
+
^source
|
296
|
+
!!
|
297
|
+
|
298
|
+
category
|
299
|
+
|
300
|
+
^category
|
301
|
+
!!
|
302
|
+
|
303
|
+
description
|
304
|
+
^ Array
|
305
|
+
with: className
|
306
|
+
with: selector
|
307
|
+
with: classIsMeta
|
308
|
+
!! !!
|
309
|
+
|
310
|
+
!!CypressMethodDefinition class methodsFor: ''not yet classified''!!
|
311
|
+
|
312
|
+
className: aName
|
313
|
+
classIsMeta: isMetaclass
|
314
|
+
selector: aSelector
|
315
|
+
category: aCategory
|
316
|
+
source: aSource
|
317
|
+
|
318
|
+
^(self new)
|
319
|
+
className: aName
|
320
|
+
classIsMeta: isMetaclass
|
321
|
+
selector: aSelector
|
322
|
+
category: aCategory
|
323
|
+
source: aSource
|
324
|
+
!! !!
|
325
|
+
|
326
|
+
CypressPatchOperation subclass: #CypressAddition
|
327
|
+
instanceVariableNames: ''definition''
|
328
|
+
package: ''Cypress-Definitions''!!
|
329
|
+
|
330
|
+
!!CypressAddition methodsFor: ''not yet classified''!!
|
331
|
+
|
332
|
+
definition: aDefinition
|
333
|
+
|
334
|
+
definition := aDefinition
|
335
|
+
!! !!
|
336
|
+
|
337
|
+
!!CypressAddition class methodsFor: ''not yet classified''!!
|
338
|
+
|
339
|
+
of: aDefinition
|
340
|
+
^ self new definition: aDefinition
|
341
|
+
!! !!
|
342
|
+
|
343
|
+
CypressPatchOperation subclass: #CypressModification
|
344
|
+
instanceVariableNames: ''obsoletion modification''
|
345
|
+
package: ''Cypress-Definitions''!!
|
346
|
+
|
347
|
+
!!CypressModification methodsFor: ''not yet classified''!!
|
348
|
+
|
349
|
+
base: base target: target
|
350
|
+
|
351
|
+
obsoletion := base.
|
352
|
+
modification := target.
|
353
|
+
!! !!
|
354
|
+
|
355
|
+
!!CypressModification class methodsFor: ''not yet classified''!!
|
356
|
+
|
357
|
+
of: base to: target
|
358
|
+
^ self new base: base target: target
|
359
|
+
!! !!
|
360
|
+
|
361
|
+
CypressPatchOperation subclass: #CypressRemoval
|
362
|
+
instanceVariableNames: ''definition''
|
363
|
+
package: ''Cypress-Definitions''!!
|
364
|
+
|
365
|
+
!!CypressRemoval methodsFor: ''not yet classified''!!
|
366
|
+
|
367
|
+
definition: aDefinition
|
368
|
+
|
369
|
+
definition := aDefinition
|
370
|
+
!! !!
|
371
|
+
|
372
|
+
!!CypressRemoval class methodsFor: ''not yet classified''!!
|
373
|
+
|
374
|
+
of: aDefinition
|
375
|
+
^ self new definition: aDefinition
|
376
|
+
!! !!
|
377
|
+
|
378
|
+
!!Object methodsFor: ''*Cypress-Definitions''!!
|
379
|
+
|
380
|
+
species
|
381
|
+
|
382
|
+
^self class
|
383
|
+
!! !!
|
384
|
+
|
385
|
+
!!Class methodsFor: ''*Cypress-Definitions''!!
|
386
|
+
|
387
|
+
asCypressClassDefinition
|
388
|
+
^CypressClassDefinition
|
389
|
+
name: self name
|
390
|
+
superclassName: self superclass name
|
391
|
+
category: self category
|
392
|
+
instVarNames: self instanceVariableNames
|
393
|
+
classInstVarNames: self class instanceVariableNames
|
394
|
+
comment: self comment
|
395
|
+
!! !!
|
396
|
+
|
397
|
+
!!CompiledMethod methodsFor: ''*Cypress-Definitions''!!
|
398
|
+
|
399
|
+
asCypressMethodDefinition
|
400
|
+
|
401
|
+
^CypressMethodDefinition
|
402
|
+
className: self methodClass name
|
403
|
+
classIsMeta: self methodClass isMetaclass
|
404
|
+
selector: self selector
|
405
|
+
category: self category
|
406
|
+
source: self source
|
407
|
+
!! !!
|
408
|
+
|
409
|
+
!!CharacterArray methodsFor: ''*Cypress-Definitions''!!
|
410
|
+
|
411
|
+
sameAs: aString
|
412
|
+
|
413
|
+
^self asUppercase = aString asUppercase
|
414
|
+
!! !!
|
415
|
+
|
416
|
+
'
|
417
|
+
! !
|
418
|
+
|
419
|
+
!ImporterTest methodsFor: 'running'!
|
420
|
+
|
421
|
+
setUp
|
422
|
+
|
423
|
+
super setUp.
|
424
|
+
self cleanUp
|
425
|
+
!
|
426
|
+
|
427
|
+
tearDown
|
428
|
+
|
429
|
+
super tearDown.
|
430
|
+
self cleanUp
|
431
|
+
!
|
432
|
+
|
433
|
+
cleanUp
|
434
|
+
|
435
|
+
(Object methodDictionary includesKey: #importerTestMethod)
|
436
|
+
ifTrue: [ Object removeCompiledMethod: (Object methodAt: #importerTestMethod)].
|
437
|
+
! !
|
438
|
+
|
439
|
+
!ImporterTest methodsFor: 'tests'!
|
440
|
+
|
441
|
+
testBigChunkString
|
442
|
+
"importer does not correctly add extension methods.
|
443
|
+
|
444
|
+
After loading in AmberProjectImporter, the following import fails...get a MNU from `CypressPackage new species`:
|
445
|
+
|
446
|
+
AmberProjectImporter
|
447
|
+
importSTPackage: 'Cypress-Definitions'
|
448
|
+
prefix: 'tests/'.
|
449
|
+
|
450
|
+
CypressPackage new species.
|
451
|
+
|
452
|
+
WARNING this guy isn't cleaned up automatically"
|
453
|
+
|
454
|
+
Importer new import: self bigChunkString readStream.
|
455
|
+
CypressPackage new species.
|
456
|
+
!
|
457
|
+
|
458
|
+
testChunkString
|
459
|
+
|
460
|
+
Importer new import: self chunkString readStream.
|
461
|
+
self assert: (Object methodDictionary includesKey: 'importerTestMethod').
|
462
|
+
self assert: (Object new importerTestMethod = 'success').
|
463
|
+
! !
|
464
|
+
|
465
|
+
!Object methodsFor: '*Compiler-Tests'!
|
466
|
+
|
467
|
+
importerLoadMethod
|
468
|
+
|
469
|
+
^'success'
|
470
|
+
! !
|
471
|
+
|