--- a/MessageTracer.st Mon Apr 30 21:52:05 2018 +0200
+++ b/MessageTracer.st Mon May 07 12:58:30 2018 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
"
COPYRIGHT (c) 1994 by Claus Gittinger
All Rights Reserved
@@ -2093,38 +2095,40 @@
unwrapMethod:aMethod
"remove any wrapper on aMethod"
- |selector class originalMethod dict mthd|
-
- aMethod isWrapped ifTrue:[
- originalMethod := aMethod originalMethod.
+ |wasWrapped selector class originalMethod dict mthd|
+
+ (aMethod isNil) ifTrue:[^ self].
+
+ (wasWrapped := aMethod isWrapped) ifTrue:[
+ originalMethod := aMethod originalMethod.
].
MethodCounts notNil ifTrue:[
- aMethod isWrapped ifTrue:[
- MethodCounts removeKey:originalMethod ifAbsent:nil.
- ].
- MethodCounts removeKey:aMethod ifAbsent:nil.
- MethodCounts := MethodCounts asNilIfEmpty.
+ originalMethod notNil ifTrue:[
+ MethodCounts removeKey:originalMethod ifAbsent:nil.
+ ].
+ MethodCounts removeKey:aMethod ifAbsent:nil.
+ MethodCounts := MethodCounts asNilIfEmpty.
].
MethodMemoryUsage notNil ifTrue:[
- aMethod isWrapped ifTrue:[
- MethodMemoryUsage removeKey:originalMethod ifAbsent:nil.
- ].
- MethodMemoryUsage removeKey:aMethod ifAbsent:nil.
- MethodMemoryUsage := MethodMemoryUsage asNilIfEmpty.
+ originalMethod notNil ifTrue:[
+ MethodMemoryUsage removeKey:originalMethod ifAbsent:nil.
+ ].
+ MethodMemoryUsage removeKey:aMethod ifAbsent:nil.
+ MethodMemoryUsage := MethodMemoryUsage asNilIfEmpty.
].
MethodTiming notNil ifTrue:[
- aMethod isWrapped ifTrue:[
- MethodTiming removeKey:originalMethod ifAbsent:nil.
- ].
- MethodTiming removeKey:aMethod ifAbsent:nil.
- MethodTiming := MethodTiming asNilIfEmpty.
+ originalMethod notNil ifTrue:[
+ MethodTiming removeKey:originalMethod ifAbsent:nil.
+ ].
+ MethodTiming removeKey:aMethod ifAbsent:nil.
+ MethodTiming := MethodTiming asNilIfEmpty.
].
CallingLevel := 0.
- (aMethod isNil or:[aMethod isWrapped not]) ifTrue:[
- ^ aMethod
+ wasWrapped ifFalse:[
+ ^ aMethod
].
"
@@ -2132,33 +2136,33 @@
"
class := aMethod containingClass.
class isNil ifTrue:[
- 'MessageTracer [info]: no containing class for method found' infoPrintCR.
- ^ aMethod
+ 'MessageTracer [info]: no containing class for method found' infoPrintCR.
+ ^ aMethod
].
selector := class selectorAtMethod:aMethod.
originalMethod isNil ifTrue:[
- self error:'oops, could not find original method' mayProceed:true.
- ^ aMethod
+ self error:'oops, could not find original method' mayProceed:true.
+ ^ aMethod
].
dict := class methodDictionary.
mthd := dict at:selector ifAbsent:nil.
mthd notNil ifTrue:[
- dict at:selector put:originalMethod.
- class methodDictionary:dict.
+ dict at:selector put:originalMethod.
+ class methodDictionary:dict.
] ifFalse:[
- 'MessageTracer [info]: no containing class for method found' infoPrintCR.
+ 'MessageTracer [info]: no containing class for method found' infoPrintCR.
"/ self halt:'oops, unexpected error - cannot remove wrap'.
- aMethod becomeSameAs:originalMethod.
- ^ aMethod
+ aMethod becomeSameAs:originalMethod.
+ ^ aMethod
].
ObjectMemory flushCaches.
class changed:#methodTrap with:selector. "/ tell browsers
MethodTrapChangeNotificationParameter notNil ifTrue:[
- Smalltalk changed:#methodTrap with:(MethodTrapChangeNotificationParameter changeClass:class changeSelector:selector).
+ Smalltalk changed:#methodTrap with:(MethodTrapChangeNotificationParameter changeClass:class changeSelector:selector).
].
^ originalMethod