-
Notifications
You must be signed in to change notification settings - Fork 0
/
Webside.pax
969 lines (819 loc) · 30.3 KB
/
Webside.pax
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
| package |
package := Package name: 'Webside'.
package paxVersion: 1;
basicComment: ''.
package classNames
add: #AddCategoryChange;
add: #AddPackageChange;
add: #ClassifyMethodChange;
add: #CommentClassChange;
add: #HttpRequestRouter;
add: #MatchAlgorithm;
add: #MatchToken;
add: #PercentEncoder;
add: #RefactoryCategoryChange;
add: #RefactoryPackageChange;
add: #RemoveCategoryChange;
add: #RemovePackageChange;
add: #RenameCategoryChange;
add: #RenamePackageChange;
add: #StarToken;
add: #StringPattern;
add: #URL;
add: #URLTemplate;
add: #URLTemplateTest;
add: #URLTest;
add: #WebsideAPI;
add: #WebsideClient;
add: #WebsideEvaluation;
add: #WebsideResource;
add: #WebsideServer;
add: #WebsideWorkspace;
yourself.
package methodNames
add: #AddClassChange -> #asWebsideJson;
add: #AddClassChange -> #fromWebsideJson:;
add: #AddClassChange -> #websideExecute;
add: #AddMethodChange -> #asWebsideJson;
add: #AddMethodChange -> #fromWebsideJson:;
add: #Character -> #isAsterisk;
add: #Character -> #isQuestionMark;
add: #ClassDescription -> #asWebsideJson;
add: #Collection -> #anyone;
add: #Collection -> #gather:;
add: #Collection -> #gather:in:;
add: #Collection -> #groupBy:;
add: #CompiledMethod -> #asWebsideJson;
add: #CompilerNotification -> #asWebsideJson;
add: #Exception -> #asWebsideJson;
add: #MethodCompileFailed -> #asWebsideJson;
add: #MethodRefactoring -> #asWebsideJson;
add: #MethodRefactoring -> #fromWebsideJson:;
add: #Object -> #asWebsideJson;
add: #Object -> #websideViews;
add: #Package -> #asWebsideJson;
add: #PullUpInstanceVariableRefactoring -> #fromWebsideJson:;
add: #Refactoring -> #asWebsideJson;
add: #Refactoring -> #fromWebsideJson:;
add: #Refactoring -> #websideExecute;
add: #RefactoryChange -> #asWebsideJson;
add: #RefactoryChange -> #fromWebsideJson:;
add: #RefactoryChange -> #websideExecute;
add: #RefactoryClassChange -> #asWebsideJson;
add: #RefactoryClassChange -> #fromWebsideJson:;
add: #RefactoryVariableChange -> #asWebsideJson;
add: #RefactoryVariableChange -> #fromWebsideJson:;
add: #RemoveMethodChange -> #asWebsideJson;
add: #RemoveMethodChange -> #fromWebsideJson:;
add: #RenameClassChange -> #asWebsideJson;
add: #RenameClassChange -> #fromWebsideJson:;
add: #RenameMethodRefactoring -> #asWebsideJson;
add: #RenameMethodRefactoring -> #fromWebsideJson:;
add: #RenameVariableChange -> #asWebsideJson;
add: #RenameVariableChange -> #fromWebsideJson:;
add: #StackFrame -> #asWebsideJson;
add: #StAssignmentNode -> #asWebsideJson;
add: #StCascadeNode -> #asWebsideJson;
add: #StLiteralToken -> #asWebsideJson;
add: #StLiteralValueNode -> #asWebsideJson;
add: #StMessageNode -> #asWebsideJson;
add: #StMethodNode -> #asWebsideJson;
add: #StProgramNode -> #asWebsideJson;
add: #StProgramNode -> #websideType;
add: #StReturnNode -> #asWebsideJson;
add: #String -> #asURL;
add: #String -> #indexOfString:from:to:;
add: #StSequenceNode -> #asWebsideJson;
add: #StVariableNode -> #asWebsideJson;
add: #Symbol -> #evaluateWith:;
add: #VariableRefactoring -> #asWebsideJson;
add: #VariableRefactoring -> #fromWebsideJson:;
add: 'AddClassChange class' -> #websideType;
add: 'AddClassVariableChange class' -> #websideType;
add: 'AddInstanceVariableChange class' -> #websideType;
add: 'AddMethodChange class' -> #websideType;
add: 'DolphinAddMethodChange class' -> #websideType;
add: 'PullUpInstanceVariableRefactoring class' -> #websideType;
add: 'PushDownInstanceVariableRefactoring class' -> #websideType;
add: 'Refactoring class' -> #acceptsWebsideJson:;
add: 'Refactoring class' -> #classForWebsideJson:;
add: 'Refactoring class' -> #fromWebsideJson:;
add: 'Refactoring class' -> #websideType;
add: 'RefactoryChange class' -> #acceptsWebsideJson:;
add: 'RefactoryChange class' -> #classForWebsideJson:;
add: 'RefactoryChange class' -> #fromWebsideJson:;
add: 'RefactoryChange class' -> #websideType;
add: 'RemoveClassChange class' -> #websideType;
add: 'RemoveClassVariableChange class' -> #websideType;
add: 'RemoveInstanceVariableChange class' -> #websideType;
add: 'RemoveMethodChange class' -> #websideType;
add: 'RenameClassChange class' -> #websideType;
add: 'RenameClassVariableChange class' -> #websideType;
add: 'RenameInstanceVariableChange class' -> #websideType;
add: 'StProgramNode class' -> #websideType;
add: 'String class' -> #fromUTF8:;
yourself.
package binaryGlobalNames: (Set new
yourself).
package globalAliases: (Set new
yourself).
package setPrerequisites: #(
'..\Core\Object Arts\Dolphin\IDE\Base\Development System'
'..\Core\Object Arts\Dolphin\Base\Dolphin'
'..\DolphinHttpServer\DolphinHttpServer\DolphinHttpServer\Dolphin Http Server'
'..\Core\Object Arts\Dolphin\ActiveX\COM\OLE COM'
'..\Core\Contributions\Refactory\Refactoring Browser\Change Objects\RBChangeObjects'
'..\Core\Contributions\Refactory\Refactoring Browser\Refactorings\RBRefactorings'
'..\Core\Object Arts\Dolphin\System\Compiler\Smalltalk Parser'
'..\Core\Contributions\svenc\STON\STON-Core'
'..\Core\Contributions\Camp Smalltalk\SUnit\SUnit').
package!
"Class Definitions"!
Object subclass: #HttpRequestRouter
instanceVariableNames: 'routes receiver'
classVariableNames: ''
poolDictionaries: ''
classInstanceVariableNames: ''!
Object subclass: #MatchAlgorithm
instanceVariableNames: 'string pattern start stop tokens failure ranges'
classVariableNames: ''
poolDictionaries: ''
classInstanceVariableNames: ''!
Object subclass: #MatchToken
instanceVariableNames: 'string start stop'
classVariableNames: ''
poolDictionaries: ''
classInstanceVariableNames: ''!
Object subclass: #PercentEncoder
instanceVariableNames: 'reserved'
classVariableNames: 'Current'
poolDictionaries: ''
classInstanceVariableNames: ''!
Object subclass: #StarToken
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
classInstanceVariableNames: 'current'!
Object subclass: #StringPattern
instanceVariableNames: 'stream tokens'
classVariableNames: ''
poolDictionaries: ''
classInstanceVariableNames: ''!
Object subclass: #URL
instanceVariableNames: 'scheme user password host port segments query fragment'
classVariableNames: ''
poolDictionaries: ''
classInstanceVariableNames: ''!
Object subclass: #URLTemplate
instanceVariableNames: 'raw pattern parameters sample description'
classVariableNames: ''
poolDictionaries: ''
classInstanceVariableNames: ''!
Object subclass: #WebsideAPI
instanceVariableNames: 'server request'
classVariableNames: ''
poolDictionaries: ''
classInstanceVariableNames: ''!
Object subclass: #WebsideClient
instanceVariableNames: 'url client'
classVariableNames: ''
poolDictionaries: ''
classInstanceVariableNames: ''!
Object subclass: #WebsideEvaluation
instanceVariableNames: 'id expression receiver context requestor priority process state result error'
classVariableNames: ''
poolDictionaries: ''
classInstanceVariableNames: ''!
Object subclass: #WebsideResource
instanceVariableNames: 'id'
classVariableNames: ''
poolDictionaries: ''
classInstanceVariableNames: ''!
Object subclass: #WebsideServer
instanceVariableNames: 'server router baseUri port resources'
classVariableNames: ''
poolDictionaries: ''
classInstanceVariableNames: ''!
RefactoryChange subclass: #RefactoryPackageChange
instanceVariableNames: 'packageName'
classVariableNames: ''
poolDictionaries: ''
classInstanceVariableNames: ''!
RefactoryClassChange subclass: #ClassifyMethodChange
instanceVariableNames: 'selector category'
classVariableNames: ''
poolDictionaries: ''
classInstanceVariableNames: ''!
RefactoryClassChange subclass: #CommentClassChange
instanceVariableNames: 'comment'
classVariableNames: ''
poolDictionaries: ''
classInstanceVariableNames: ''!
RefactoryClassChange subclass: #RefactoryCategoryChange
instanceVariableNames: 'category'
classVariableNames: ''
poolDictionaries: ''
classInstanceVariableNames: ''!
RefactoryCategoryChange subclass: #AddCategoryChange
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
classInstanceVariableNames: ''!
RefactoryCategoryChange subclass: #RemoveCategoryChange
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
classInstanceVariableNames: ''!
RefactoryCategoryChange subclass: #RenameCategoryChange
instanceVariableNames: 'newName'
classVariableNames: ''
poolDictionaries: ''
classInstanceVariableNames: ''!
RefactoryPackageChange subclass: #AddPackageChange
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
classInstanceVariableNames: ''!
RefactoryPackageChange subclass: #RemovePackageChange
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
classInstanceVariableNames: ''!
RefactoryPackageChange subclass: #RenamePackageChange
instanceVariableNames: 'newName'
classVariableNames: ''
poolDictionaries: ''
classInstanceVariableNames: ''!
TestCase subclass: #URLTemplateTest
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
classInstanceVariableNames: ''!
TestCase subclass: #URLTest
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
classInstanceVariableNames: ''!
WebsideResource subclass: #WebsideWorkspace
instanceVariableNames: 'contents bindings'
classVariableNames: ''
poolDictionaries: ''
classInstanceVariableNames: ''!
"Global Aliases"!
"Loose Methods"!
!AddClassChange methodsFor!
asWebsideJson
^super asWebsideJson
at: 'definition' put: definition;
yourself!
fromWebsideJson: json
| superclass msg keywords index instanceVariables classVariables poolDictionaries |
super fromWebsideJson: json.
definition := json at: 'definition' ifAbsent: [].
definition
ifNil:
[superclass := json at: 'superclass' ifAbsent: [].
superclass
ifNotNil:
[instanceVariables := json at: 'instanceVariables' ifAbsent: [#()].
classVariables := json at: 'classVariables' ifAbsent: [#()].
poolDictionaries := json at: 'poolDictionaries' ifAbsent: [#()].
definition := String streamContents:
[:s |
s
nextPutAll: superclass;
nextPutAll: ' subclass: ';
nextPutAll: className printString;
nextPutAll: ' instanceVariableNames: '''.
instanceVariables do: [:n | s nextPutAll: n] separatedBy: [s space].
s nextPutAll: ''' classVariableNames: '''.
classVariables do: [:n | s nextPutAll: n] separatedBy: [s space].
s nextPutAll: ''' poolDictionaries: '''.
poolDictionaries do: [:n | s nextPutAll: n] separatedBy: [s space].
s nextPut: $']]].
className
ifNil:
[msg := SmalltalkParser parseExpression: definition.
keywords := msg selector keywords collect: [:s | s asString].
index := keywords indexOf: 'subclass:'
ifAbsent: [keywords indexOf: 'variableByteSubclass:' ifAbsent: [keywords indexOf: 'variableSubclass:']].
className := (msg arguments at: index) value asString]!
websideExecute
| class packageName package |
super websideExecute.
class := self changeClass.
class ifNil: [^self].
packageName := self propertyAt: #packageName ifAbsent: [^self].
package := PackageManager current packageNamed: packageName ifNone: [^self].
package ifNotNil: [package addClass: self changeClass]! !
!AddClassChange categoriesFor: #asWebsideJson!public! !
!AddClassChange categoriesFor: #fromWebsideJson:!public! !
!AddClassChange categoriesFor: #websideExecute!public! !
!AddClassChange class methodsFor!
websideType
^'AddClass'! !
!AddClassChange class categoriesFor: #websideType!public! !
!AddClassVariableChange class methodsFor!
websideType
^'AddClassVariable'! !
!AddClassVariableChange class categoriesFor: #websideType!public! !
!AddInstanceVariableChange class methodsFor!
websideType
^'AddInstanceVariable'! !
!AddInstanceVariableChange class categoriesFor: #websideType!public! !
!AddMethodChange methodsFor!
asWebsideJson
| json |
json := super asWebsideJson.
source ifNotNil: [:s | json at: 'sourceCode' put: s].
^json
at: 'selector' put: self selector;
at: 'category' put: self protocol;
yourself!
fromWebsideJson: json
| category |
super fromWebsideJson: json.
selector := json at: 'selector' ifAbsent: [].
selector ifNotNil: [selector := selector asSymbol].
source := json at: 'sourceCode' ifAbsent: [].
category := json at: 'category' ifAbsent: [].
category ifNil: [category := MethodCategory unclassified asString].
self protocols: {category asSymbol}! !
!AddMethodChange categoriesFor: #asWebsideJson!public! !
!AddMethodChange categoriesFor: #fromWebsideJson:!public! !
!AddMethodChange class methodsFor!
websideType
^'AbstractAddMethod'! !
!AddMethodChange class categoriesFor: #websideType!instance creation!public! !
!Character methodsFor!
isAsterisk
^code = 42!
isQuestionMark
^code = 63! !
!Character categoriesFor: #isAsterisk!public!testing! !
!Character categoriesFor: #isQuestionMark!public!testing! !
!ClassDescription methodsFor!
asWebsideJson
| definition |
definition := self definition copyWithout: 10 asCharacter.
^super asWebsideJson
at: 'name' put: self name;
at: 'definition' put: definition;
at: 'superclass'
put: (self superclass ifNotNil: [:c | c name]);
at: 'comment' put: self comment;
at: 'variable' put: self isVariable;
at: 'project' put: (self owningPackage ifNotNil: [:p | p name]);
yourself! !
!ClassDescription categoriesFor: #asWebsideJson!converting!public! !
!Collection methodsFor!
anyone
^self detect: [:one | true] ifNone: []!
gather: aBlock
^self gather: aBlock in: (OrderedCollection new: self size)
!
gather: aBlock in: collection
self do: [:each | | things |
things := aBlock value: each.
collection addAll: things].
^collection!
groupBy: aspect
| answer key copy remove |
answer := Dictionary new.
(aspect numArgs = 0 or: [aspect class == BlockClosure and: [aspect numArgs = 1]]) ifTrue: [
self do: [:each |
key := aspect evaluateWith: each.
(answer at: key ifAbsentPut: [OrderedCollection new]) add: each].
^answer].
copy := IdentitySet withAll: self.
remove := IdentitySet new.
self do: [:each |
copy do: [:e |
(aspect value: each value: e) ifTrue: [
remove add: e.
(answer at: each ifAbsentPut: [OrderedCollection new]) add: e]].
copy removeAll: remove.
remove removeAll].
^answer! !
!Collection categoriesFor: #anyone!adding!public! !
!Collection categoriesFor: #gather:!enumerating!public! !
!Collection categoriesFor: #gather:in:!enumerating!public! !
!Collection categoriesFor: #groupBy:!operations!public! !
!CompiledMethod methodsFor!
asWebsideJson
| source category |
source := self getSource copyWithout: 10 asCharacter.
category := self categories detect: [:c | c isPrivacy not and: [c isVirtual not]] ifNone: [].
^super asWebsideJson
at: 'selector' put: selector;
at: 'methodClass' put: self methodClass name;
at: 'category' put: (category ifNotNil: [:c | c name]);
at: 'source' put: source;
at: 'author' put: 'Unknown';
at: 'timestamp' put: nil;
at: 'package' put: (self owningPackage ifNotNil: [:p | p name]);
at: 'overriding' put: self isOverride;
at: 'overriden' put: self isOverridden;
yourself! !
!CompiledMethod categoriesFor: #asWebsideJson!converting!public! !
!CompilerNotification methodsFor!
asWebsideJson
| interval json |
interval := Dictionary new
at: 'start' put: position;
at: 'end' put: position;
yourself.
json := super asWebsideJson.
json
at: 'fullDescription' put: self errorMessage;
at: 'interval' put: interval.
^json! !
!CompilerNotification categoriesFor: #asWebsideJson!accessing!public! !
!DolphinAddMethodChange class methodsFor!
websideType
^'AddMethod'! !
!DolphinAddMethodChange class categoriesFor: #websideType!public! !
!Exception methodsFor!
asWebsideJson
| json |
json := super asWebsideJson.
json at: 'description' put: self description.
^json! !
!Exception categoriesFor: #asWebsideJson!handling!public! !
!MethodCompileFailed methodsFor!
asWebsideJson
^compilerErrorNotification asWebsideJson! !
!MethodCompileFailed categoriesFor: #asWebsideJson!accessing!private! !
!MethodRefactoring methodsFor!
asWebsideJson
^super asWebsideJson
at: 'className' put: class name asString;
yourself!
fromWebsideJson: json
super fromWebsideJson: json.
json at: 'className'
ifPresent: [:n | Smalltalk at: n ifPresent: [:c | class := RBClass existingNamed: n]]! !
!MethodRefactoring categoriesFor: #asWebsideJson!private! !
!MethodRefactoring categoriesFor: #fromWebsideJson:!private! !
!Object methodsFor!
asWebsideJson
| printed |
printed := [self printString] on: Error
do: [:e | 'Error while printing ' , self class name , ' instance'].
^Dictionary new
at: 'class' put: self class name;
at: 'hasNamedSlots' put: self class isPointers;
at: 'hasIndexedSlots' put: self isIndexable;
at: 'size' put: (self class isVariable ifTrue: [self size] ifFalse: [0]);
at: 'printString' put: printed;
yourself!
websideViews
^#()! !
!Object categoriesFor: #asWebsideJson!converting!public! !
!Object categoriesFor: #websideViews!exceptions!private! !
!Package methodsFor!
asWebsideJson
| methods |
methods := Dictionary new.
self methodNames
do: [:a | (methods at: a key asString ifAbsentPut: [OrderedCollection new]) add: a value].
methods keysAndValuesDo: [:k :v | methods at: k put: v asArray].
^super asWebsideJson
at: 'name' put: name;
at: 'classes' put: self classNames asArray;
at: 'methods' put: methods;
yourself! !
!Package categoriesFor: #asWebsideJson!converting!private! !
!PullUpInstanceVariableRefactoring methodsFor!
fromWebsideJson: json
super fromWebsideJson: json.
json at: 'target'
ifPresent:
[:n |
Smalltalk at: n
ifPresent:
[:c |
class := RBClass existingNamed: n.
class model: model]]! !
!PullUpInstanceVariableRefactoring categoriesFor: #fromWebsideJson:!public! !
!PullUpInstanceVariableRefactoring class methodsFor!
websideType
^'MoveUpInstanceVariable'! !
!PullUpInstanceVariableRefactoring class categoriesFor: #websideType!public! !
!PushDownInstanceVariableRefactoring class methodsFor!
websideType
^'MoveDownInstanceVariable'! !
!PushDownInstanceVariableRefactoring class categoriesFor: #websideType!public! !
!Refactoring methodsFor!
asWebsideJson
^Dictionary new
at: 'type' put: self class websideType;
at: 'label' put: self class websideType;
at: 'package' put: (self propertyAt: #packageName ifAbsent: []);
at: 'timestamp' put: DateAndTime now printString;
at: 'author' put: nil;
yourself!
fromWebsideJson: json
json at: 'package' ifPresent: [:n | self propertyAt: #packageName put: n].
self model "Only to initialize it"!
websideExecute
^self execute! !
!Refactoring categoriesFor: #asWebsideJson!public! !
!Refactoring categoriesFor: #fromWebsideJson:!public! !
!Refactoring categoriesFor: #websideExecute!public! !
!Refactoring class methodsFor!
acceptsWebsideJson: json
| type |
type := json at: 'type' ifAbsent: nil.
^self websideType = type!
classForWebsideJson: json
^self allSubclasses detect: [:c | c acceptsWebsideJson: json] ifNone: []!
fromWebsideJson: json
| class |
class := self classForWebsideJson: json.
^class ifNotNil: [class new fromWebsideJson: json]!
websideType
| type |
type := self name asString.
(type endsWith: 'Refactoring') ifTrue: [type := type copyFrom: 1 to: type size - 11].
^type! !
!Refactoring class categoriesFor: #acceptsWebsideJson:!class hierarchy-removing!public! !
!Refactoring class categoriesFor: #classForWebsideJson:!class hierarchy-removing!public! !
!Refactoring class categoriesFor: #fromWebsideJson:!class hierarchy-removing!public! !
!Refactoring class categoriesFor: #websideType!class hierarchy-removing!public! !
!RefactoryChange methodsFor!
asWebsideJson
^Dictionary new
at: 'type' put: self class websideType;
at: 'label' put: ([self changeString] on: Error do: [:e | self class websideType]);
at: 'package' put: (self propertyAt: #packageName ifAbsent: []);
at: 'timestamp' put: DateAndTime now printString;
at: 'author' put: nil;
yourself!
fromWebsideJson: json
json at: 'package' ifPresent: [:n | self propertyAt: #packageName put: n]!
websideExecute
^self execute! !
!RefactoryChange categoriesFor: #asWebsideJson!initialize/release!public! !
!RefactoryChange categoriesFor: #fromWebsideJson:!initialize/release!public! !
!RefactoryChange categoriesFor: #websideExecute!initialize/release!public! !
!RefactoryChange class methodsFor!
acceptsWebsideJson: json
| type |
type := json at: 'type' ifAbsent: nil.
^self websideType = type!
classForWebsideJson: json
^self allSubclasses detect: [:c | c acceptsWebsideJson: json] ifNone: []!
fromWebsideJson: json
| class |
class := self classForWebsideJson: json.
^class ifNotNil: [class new fromWebsideJson: json]!
websideType
| type |
type := self name asString.
(type endsWith: 'Change') ifTrue: [type := type copyFrom: 1 to: type size - 6].
^type! !
!RefactoryChange class categoriesFor: #acceptsWebsideJson:!public! !
!RefactoryChange class categoriesFor: #classForWebsideJson:!public! !
!RefactoryChange class categoriesFor: #fromWebsideJson:!public! !
!RefactoryChange class categoriesFor: #websideType!public! !
!RefactoryClassChange methodsFor!
asWebsideJson
^super asWebsideJson
at: 'className' put: self changeClass name asString;
yourself!
fromWebsideJson: json
super fromWebsideJson: json.
className := json at: 'className' ifAbsent: [].
isMeta := className notNil and: [className endsWith: ' class'].
(className notNil and: [isMeta])
ifTrue: [className := (className copyFrom: 1 to: className size - 6) asSymbol]! !
!RefactoryClassChange categoriesFor: #asWebsideJson!accessing!public! !
!RefactoryClassChange categoriesFor: #fromWebsideJson:!accessing!public! !
!RefactoryVariableChange methodsFor!
asWebsideJson
^super asWebsideJson at: 'variable' put: variable; yourself!
fromWebsideJson: json
super fromWebsideJson: json.
variable := json at: 'variable' ifAbsent: nil! !
!RefactoryVariableChange categoriesFor: #asWebsideJson!initialize/release!public! !
!RefactoryVariableChange categoriesFor: #fromWebsideJson:!initialize/release!public! !
!RemoveClassChange class methodsFor!
websideType
^'RemoveClass'! !
!RemoveClassChange class categoriesFor: #websideType!public! !
!RemoveClassVariableChange class methodsFor!
websideType
^'RemoveClassVariable'! !
!RemoveClassVariableChange class categoriesFor: #websideType!public! !
!RemoveInstanceVariableChange class methodsFor!
websideType
^'RemoveInstanceVariable'! !
!RemoveInstanceVariableChange class categoriesFor: #websideType!public! !
!RemoveMethodChange methodsFor!
asWebsideJson
^super asWebsideJson at: 'selector' put: selector; yourself!
fromWebsideJson: json
super fromWebsideJson: json.
selector := json at: 'selector' ifAbsent: [].
selector notNil ifTrue: [selector := selector asSymbol]! !
!RemoveMethodChange categoriesFor: #asWebsideJson!public! !
!RemoveMethodChange categoriesFor: #fromWebsideJson:!public! !
!RemoveMethodChange class methodsFor!
websideType
^'RemoveMethod'! !
!RemoveMethodChange class categoriesFor: #websideType!public! !
!RenameClassChange methodsFor!
asWebsideJson
^super asWebsideJson
at: 'className' put: oldName;
at: 'newName' put: newName;
at: 'renameReferences' put: true;
yourself!
fromWebsideJson: json
super fromWebsideJson: json.
oldName := json at: 'className' ifAbsent: [].
newName := json at: 'newName' ifAbsent: []! !
!RenameClassChange categoriesFor: #asWebsideJson!initialize/release!public! !
!RenameClassChange categoriesFor: #fromWebsideJson:!initialize/release!public! !
!RenameClassChange class methodsFor!
websideType
^'RenameClass'! !
!RenameClassChange class categoriesFor: #websideType!instance creation!public! !
!RenameClassVariableChange class methodsFor!
websideType
^'RenameClassVariable'! !
!RenameClassVariableChange class categoriesFor: #websideType!public! !
!RenameInstanceVariableChange class methodsFor!
websideType
^'RenameInstanceVariable'! !
!RenameInstanceVariableChange class categoriesFor: #websideType!public! !
!RenameMethodRefactoring methodsFor!
asWebsideJson
^super asWebsideJson
at: 'selector' put: oldSelector;
at: 'newSelector' put: newSelector;
yourself!
fromWebsideJson: json
super fromWebsideJson: json.
json at: 'selector' ifPresent: [:s | oldSelector := s asSymbol].
json at: 'newSelector'
ifPresent:
[:s |
newSelector := s asSymbol.
permutation := 1 to: newSelector argumentCount]! !
!RenameMethodRefactoring categoriesFor: #asWebsideJson!public!testing! !
!RenameMethodRefactoring categoriesFor: #fromWebsideJson:!public!testing! !
!RenameVariableChange methodsFor!
asWebsideJson
^super asWebsideJson
at: 'className' put: className;
at: 'variable' put: oldName;
at: 'newName' put: newName;
yourself!
fromWebsideJson: json
super fromWebsideJson: json.
className := json at: 'className' ifAbsent: [].
isMeta := className notNil and: [className endsWith: ' class'].
oldName := json at: 'variable' ifAbsent: [].
newName := json at: 'newName' ifAbsent: []! !
!RenameVariableChange categoriesFor: #asWebsideJson!printing!public! !
!RenameVariableChange categoriesFor: #fromWebsideJson:!printing!public! !
!StackFrame methodsFor!
asWebsideJson
^Dictionary new
at: 'label' put: self method printString;
at: 'class' put: self receiver class asWebsideJson;
at: 'method' put: self method asWebsideJson;
yourself! !
!StackFrame categoriesFor: #asWebsideJson!accessing!private! !
!StAssignmentNode methodsFor!
asWebsideJson ^super asWebsideJson at: 'children' put: { variable asWebsideJson . value asWebsideJson }! !
!StAssignmentNode categoriesFor: #asWebsideJson!accessing!public! !
!StCascadeNode methodsFor!
asWebsideJson
| children |
children := messages collect: [:n | n asWebsideJson].
^super asWebsideJson
at: 'children' put: children asArray;
yourself! !
!StCascadeNode categoriesFor: #asWebsideJson!public!visitor! !
!StLiteralToken methodsFor!
asWebsideJson
^value asString! !
!StLiteralToken categoriesFor: #asWebsideJson!printing!public! !
!StLiteralValueNode methodsFor!
asWebsideJson
| value |
value := token value isString ifTrue: [token value] ifFalse: [token printString].
^super asWebsideJson
at: 'value' put: value;
yourself! !
!StLiteralValueNode categoriesFor: #asWebsideJson!matching!public! !
!StMessageNode methodsFor!
asWebsideJson
| s children |
s := Dictionary new
at: 'type' put: 'Selector';
at: 'value' put: self selector;
at: 'start' put: selectorParts first start;
at: 'stop' put: selectorParts last stop;
yourself.
children := OrderedCollection with: receiver asWebsideJson with: s.
arguments do: [:n | children add: n asWebsideJson].
^super asWebsideJson
at: 'children' put: children asArray;
yourself! !
!StMessageNode categoriesFor: #asWebsideJson!matching!public! !
!StMethodNode methodsFor!
asWebsideJson | children | children := OrderedCollection with: self selector asWebsideJson. arguments do: [ :n | children add: n asWebsideJson ]. children add: body asWebsideJson . ^super asWebsideJson at: 'children' put: children asArray; yourself ! !
!StMethodNode categoriesFor: #asWebsideJson!public!visitor! !
!StProgramNode methodsFor!
asWebsideJson ^ super asWebsideJson at: 'type' put: self websideType; at: 'start' put: self start; at: 'end' put: self stop; yourself!
websideType ^self class websideType! !
!StProgramNode categoriesFor: #asWebsideJson!public!replacing! !
!StProgramNode categoriesFor: #websideType!public!replacing! !
!StProgramNode class methodsFor!
websideType ^self name copyFrom: 3 to: self name size - 4! !
!StProgramNode class categoriesFor: #websideType!constants!public! !
!StReturnNode methodsFor!
asWebsideJson ^super asWebsideJson at: 'children' put: { value asWebsideJson }; yourself! !
!StReturnNode categoriesFor: #asWebsideJson!public!visitor! !
!String methodsFor!
asURL
^URL fromString: self trimBlanks!
indexOfString: aString from: start to: stop
| n limit base i |
n := aString size.
limit := stop - n.
base := start - 1.
i := 1.
[
base > limit ifTrue: [^0].
i <= n]
whileTrue: [
i := (self at: base + i) = (aString at: i) ifTrue: [i + 1] ifFalse: [
base := base + 1.
1]].
^i > 1 ifTrue: [base + 1] ifFalse: [0]
! !
!String categoriesFor: #asURL!converting!public! !
!String categoriesFor: #indexOfString:from:to:!comparing!public! !
!String class methodsFor!
fromUTF8: aString
^(aString anySatisfy: [:byte | byte asInteger >= 128])
ifTrue: [aString asUtf8String]
ifFalse: [aString]! !
!String class categoriesFor: #fromUTF8:!instance creation!public! !
!StSequenceNode methodsFor!
asWebsideJson | children | children := OrderedCollection new. temporaries do: [ :n | children add: n asWebsideJson ]. statements do: [ :n | children add: n asWebsideJson]. ^super asWebsideJson at: 'children' put: children asArray ; yourself! !
!StSequenceNode categoriesFor: #asWebsideJson!public!visitor! !
!StVariableNode methodsFor!
asWebsideJson ^ super asWebsideJson at: 'value' put: name; yourself! !
!StVariableNode categoriesFor: #asWebsideJson!public!visitor! !
!Symbol methodsFor!
evaluateWith: anObject
^anObject perform: self! !
!Symbol categoriesFor: #evaluateWith:!converting!public! !
!VariableRefactoring methodsFor!
asWebsideJson
^super asWebsideJson
at: 'className' put: class name asString;
at: 'variable' put: variableName;
yourself!
fromWebsideJson: json
super fromWebsideJson: json.
json at: 'className'
ifPresent:
[:n |
Smalltalk at: n
ifPresent:
[:c |
class := RBClass existingNamed: n.
class model: model]].
variableName := json at: 'variable' ifAbsent: []! !
!VariableRefactoring categoriesFor: #asWebsideJson!initialize/release!public! !
!VariableRefactoring categoriesFor: #fromWebsideJson:!initialize/release!public! !
"End of package definition"!