11Class {
22 #name : ' ExReqTracingPoint' ,
3- #superclass : ' Breakpoint ' ,
3+ #superclass : ' DebugPoint ' ,
44 #instVars : [
5+ ' isPrecondition' ,
56 ' stepReports'
67 ],
78 #classVars : [
@@ -15,47 +16,93 @@ Class {
1516{ #category : ' accessing' }
1617ExReqTracingPoint class >> all [
1718
18- ^ TracingPoints ifNil: [
19- TracingPoints := OrderedCollection new ]
19+ ^ TracingPoints ifNil: [ TracingPoints := Set new ]
2020]
2121
22- { #category : ' cleanup' }
23- ExReqTracingPoint class >> cleanUp [
24-
25- < script>
26- ExReqPreconditionTracingPoint allInstances do: [ :each |
27- each link uninstall.
28- each remove ].
29- ExReqPostconditionTracingPoint allInstances do: [ :each |
30- each link uninstall.
31- each remove ].
32- self all removeAll.
33- Smalltalk image garbageCollect
22+ { #category : ' accessing' }
23+ ExReqTracingPoint >> bePostcondition [
24+
25+ isPrecondition := false
3426]
3527
3628{ #category : ' accessing' }
37- ExReqTracingPoint class >> removeBreakpoint: aBreakpoint [
29+ ExReqTracingPoint >> bePrecondition [
30+
31+ isPrecondition := true
32+ ]
3833
39- | nodes |
40- nodes := aBreakpoint link nodes copy.
41- self notifyBreakpointRemoved: aBreakpoint fromNodes: nodes.
42- self all remove: aBreakpoint ifAbsent: [ ].
34+ { #category : ' API' }
35+ ExReqTracingPoint >> hitWithContext: aContext [
36+
37+ " We do not emit an event for some obscure reason ..."
38+ self enabled ifFalse: [ ^ false ].
39+ self saveContext: aContext.
40+ (self checkBehaviors allSatisfy: [ :behavior | behavior execute ])
41+ ifFalse: [ ^ false ].
42+ self sideEffectBehaviors do: [ :behavior | behavior execute ].
43+
44+ self enabled: false .
45+ self verifyStepsConditionWithContext: aContext.
46+ self enabled: true .
47+ ^ true
4348]
4449
45- { #category : ' api ' }
46- ExReqTracingPoint >> breakInContext : aContext node: aNode [
50+ { #category : ' API ' }
51+ ExReqTracingPoint >> hitWithContext : aContext value: aValue [
4752
48- self isEnabled ifFalse: [ ^ self ].
53+ (self hitWithContext: aContext) ifFalse: [ ^ self ].
54+ self enabled ifFalse: [ ^ self ].
4955 self enabled: false .
5056 self verifyStepsConditionWithContext: aContext.
5157 self enabled: true
5258]
5359
54- { #category : ' initialization ' }
60+ { #category : ' accessing ' }
5561ExReqTracingPoint >> initialize [
5662
5763 super initialize.
58- enabled := true
64+ isPrecondition := true .
65+ ]
66+
67+ { #category : ' accessing' }
68+ ExReqTracingPoint >> isPrecondition [
69+
70+ ^ isPrecondition
71+ ]
72+
73+ { #category : ' default values' }
74+ ExReqTracingPoint >> metaLink [
75+
76+ ^ self isPrecondition
77+ ifTrue: [ self preconditionMetaLink ]
78+ ifFalse: [ self postconditionMetaLink ]
79+ ]
80+
81+ { #category : ' accessing' }
82+ ExReqTracingPoint >> name [
83+
84+ ^ name ifNil: [ #TracingPoint ]
85+ ]
86+
87+ { #category : ' default values' }
88+ ExReqTracingPoint >> postconditionMetaLink [
89+
90+ ^ MetaLink new
91+ metaObject: self ;
92+ options: #( #+ optionCompileOnLinkInstallation ) ;
93+ selector: #hitWithContext: ;
94+ control: #after ;
95+ arguments: #( context )
96+ ]
97+
98+ { #category : ' default values' }
99+ ExReqTracingPoint >> preconditionMetaLink [
100+
101+ ^ MetaLink new
102+ metaObject: self ;
103+ options: #( #+ optionCompileOnLinkInstallation ) ;
104+ selector: #hitWithContext: ;
105+ arguments: #( context )
59106]
60107
61108{ #category : ' accessing' }
@@ -65,13 +112,25 @@ ExReqTracingPoint >> stepReports [
65112]
66113
67114{ #category : ' accessing' }
68- ExReqTracingPoint >> stepReports: aCollection [
115+ ExReqTracingPoint >> stepReports: anObject [
116+
117+ stepReports := anObject
118+ ]
119+
120+ { #category : ' accessing' }
121+ ExReqTracingPoint >> type [
69122
70- stepReports := aCollection
123+ ^ #TracingPoint
71124]
72125
73- { #category : ' api ' }
126+ { #category : ' API ' }
74127ExReqTracingPoint >> verifyStepsConditionWithContext: aContext [
75128
76- self shouldBeImplemented
129+ self isPrecondition
130+ ifTrue: [
131+ self stepReports do: [ :stepReport |
132+ stepReport verifyStepPreconditionWithContext: aContext ] ]
133+ ifFalse: [
134+ self stepReports do: [ :stepReport |
135+ stepReport verifyStepPostconditionWithContext: aContext ] ]
77136]
0 commit comments