/
PragmaType.class.st
123 lines (106 loc) · 2.75 KB
/
PragmaType.class.st
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
"
This models the type of pragma instances.
It essentially knows the keyword that defines the Pragma, and can obtain all occurences of that Pragma.
!!Example
[[[
PragmaType all
]]]
"
Class {
#name : #PragmaType,
#superclass : #Object,
#instVars : [
'keyword',
'pragmas'
],
#category : #'GT-SpotterExtensions-Core'
}
{ #category : #accessing }
PragmaType class >> all [
| pragmas |
pragmas := OrderedCollection new.
Object withAllSubclassesDo: [:each |
Pragma withPragmasIn: each do: [:p |
pragmas add: p]].
^ (pragmas groupedBy: #keyword) associations collect: [ :association |
PragmaType new
keyword: association key;
pragmas: association value ]
]
{ #category : #examples }
PragmaType class >> gtExampleAnyOne [
<gtExample>
^ self all anyOne
]
{ #category : #ui }
PragmaType >> gtInspectorPragmasIn: composite [
<gtInspectorPresentationOrder: 0>
composite list
title: 'Pragmas';
display: [ self pragmas ];
format: #gtDisplayString
]
{ #category : #ui }
PragmaType >> gtInspectorUsersIn: composite [
<gtInspectorPresentationOrder: 1>
composite list
title: 'Users';
display: [ self users sorted: [ :a :b | a selector < b selector ] ];
format: #gtDisplayString
]
{ #category : #accessing }
PragmaType >> keyword [
^ keyword
]
{ #category : #accessing }
PragmaType >> keyword: anObject [
keyword := anObject
]
{ #category : #accessing }
PragmaType >> pragmas [
^ pragmas ifNil: [
pragmas := OrderedCollection new.
SystemNavigation new allBehaviorsDo: [ :each |
Pragma withPragmasIn: each do: [ :p |
p keyword = self keyword ifTrue: [
pragmas add: p ] ] ].
pragmas ]
]
{ #category : #accessing }
PragmaType >> pragmas: aCollection [
pragmas := aCollection
]
{ #category : #printing }
PragmaType >> printOn: stream [
stream nextPutAll: self keyword
]
{ #category : #ui }
PragmaType >> spotterPragmasFor: aStep [
<spotterOrder: 40>
^ aStep listProcessor
title: 'Pragmas';
allCandidates: [ self pragmas ];
itemName: [ :pragma | pragma method printString , ' ' , pragma asString ];
filter: GTFilterSubstring
]
{ #category : #ui }
PragmaType >> spotterPreviewItemsIn: aComposite [
<spotterPreview: 10>
aComposite list
title: '<', self gtDisplayString, '>';
display: [ :x | x ];
format: [ :pragma | GTSpotterItemBrick new text: pragma method gtDisplayString; disable; yourself ];
entity: self pragmas asArray.
]
{ #category : #ui }
PragmaType >> spotterUsersFor: aStep [
<spotterOrder: 50>
^ aStep listProcessor
title: 'Users';
filter: GTFilterSubstring item: [ :filter :context |
self users do: [ :sender | filter value: sender ] ]
]
{ #category : #accessing }
PragmaType >> users [
^ (self keyword senders collect: [ :each | each compiledMethod ]) \ (self pragmas collect: [ :each | each method ])
]