To let you know that it exists
thisContext
is one of the three pseudovariables with self
and super
self halt
in the code to see it and walkWe declare deprecation
A >> foo
self deprecated: 'Use bar.' on: '31/12/2015' in: 'Pharo50'.
self bar
should print: 'Message foo is deprecated in Pharo50. Use bar'
deprecated: anExplanationString on: date in: version
"Warn that the sending method has been deprecated"
(Deprecation
method: thisContext sender method
explanation: anExplanationString
on: date
in: version) signal
thisContext sender method
returns compiled method A>>#foo
foo
...
Halt if: #testSetInitialized
...
Only halt if executed from testSetInitialized
Halt class >> if: condition
"This is the typical message to use for inserting breakpoints during debugging.
The argument can be one of the following:
- a block: if the Block has one arg, the calling object is bound to that.
- an expression
- a selector: Halt if found in the call chain"
condition isSymbol ifTrue: [ ^ self haltIfCallChainContains: condition ].
condition isBlock ifTrue: [ ^ self haltIfBlockWithCallingObject: condition].
condition ifTrue: [self signal].
Halt class >> haltIfCallChainContains: aSelector
| cntxt |
cntxt := thisContext.
[ cntxt sender isNil ] whileFalse: [
cntxt := cntxt sender.
(cntxt selector = aSelector) ifTrue: [ self signal ] ].
/