> On 14 Jun 2016, at 09:47, [email protected] wrote:
> 
> Hi,
> 
> Yesterday we improved #haltOnce to be more like a “once” BreakPoint:
> 
>       -> state per *each* haltOnce send
>               (this means you can put two in one method and they are 
> independent)
>       -> when putting a haltOnce, it is enabled by default
>       -> The global menu entry just resets all haltOnce to be active again.
> 
> Interesting is how trivial this was to implement… in class Halt 
> once
>    | node |
>    node := thisContext sender sender sourceNodeExecuted.
>    (node hasProperty: #haltOnce) ifTrue: [^self]. 
>    node propertyAt: #haltOnce put: true.
>    ^ self signal.
> 
> 
> This means, we get the AST node of the “haltOnce” message send. Then we put 
> an annotation there.

haltOnCount: can be implemented using AST send-site per node state, too:

        onCount: anInteger 
                "Halt on the anInteger-th time through"
                <debuggerCompleteToSender>      
                | node | 
                node := thisContext sender sender sourceNodeExecuted.
                (node hasProperty: #haltCount) ifFalse: [
                        node propertyAt: #haltCount put: 0.
                        ].
                 node propertyAt: #haltCount put: (node propertyAt: #haltCount) 
+ 1.
                ((node propertyAt: #haltCount) = anInteger) ifTrue: [ ^self 
signal ].


        Marcus

Reply via email to