1+ * Babylonian - Compiler
2+ addAndClassifySelector: selector withMethod: compiledMethod inProtocol: category notifying: requestor
3+
4+ " This is an abomination of the Squeak Kernel code, ContextS2 code, and Babylonian Code"
5+ | priorMethodOrNil |
6+ (compiledMethod isCompiledMethod or : [
7+ (compiledMethod respondsTo: #isBase ) and : [compiledMethod isBase]]) ifTrue: [
8+
9+ " --- START OF COPIED CODE FROM SQUEAK KERNEL ---"
10+ priorMethodOrNil := self compiledMethodAt: selector ifAbsent: [nil ].
11+ self addSelectorSilently: selector withMethod: compiledMethod.
12+ SystemChangeNotifier uniqueInstance
13+ doSilently: [self organization classify: selector under: category].
14+ priorMethodOrNil isNil
15+ ifTrue: [SystemChangeNotifier uniqueInstance methodAdded: compiledMethod selector: selector inProtocol: category class : self requestor: requestor]
16+ ifFalse: [SystemChangeNotifier uniqueInstance methodChangedFrom: priorMethodOrNil to: compiledMethod selector: selector inClass: self requestor: requestor].
17+ " --- END OF COPIED CODE FROM SQUEAK KERNEL ---"
18+
19+ " --- Babylonian code ---"
20+ self updateAndRemoveBPMethods: selector.
21+ " --- END OF Babylonian code ---"
22+
23+ ] ifFalse: [" dealing with a partial layer method"
24+ priorMethodOrNil := self layeredMethodDict at: compiledMethod asSymbol ifAbsent: [nil ].
25+ self addSelectorSilently: selector withMethod: compiledMethod.
26+ SystemChangeNotifier uniqueInstance
27+ doSilently: [self organization classify: compiledMethod asSymbol under: category].
28+ priorMethodOrNil
29+ ifNil: [SystemChangeNotifier uniqueInstance
30+ methodAdded: compiledMethod method selector: compiledMethod asSymbol
31+ inProtocol: category class : self requestor: requestor]
32+ ifNotNil: [SystemChangeNotifier uniqueInstance
33+ methodChangedFrom: (priorMethodOrNil ifNotNil: [:pm | pm method]) to: compiledMethod method
34+ selector: compiledMethod asSymbol inClass: self requestor: requestor].
35+ ].
0 commit comments