[squeak-dev] The Inbox: System-ct.1246.mcz
commits at source.squeak.org
commits at source.squeak.org
Mon Nov 1 21:02:56 UTC 2021
A new version of System was added to project The Inbox:
http://source.squeak.org/inbox/System-ct.1246.mcz
==================== Summary ====================
Name: System-ct.1246
Author: ct
Time: 1 November 2021, 10:02:52.192754 pm
UUID: 1a72b404-61d8-d04c-8323-6a94bceb2230
Ancestors: System-eem.1244
Avoids dangling preferences when removing the preference pragma from a method.
The disadvantage of this approach is that the lifecycle of the preference is reset whenever it is recompiled. However, I am not aware of any disadvantage of this change.
=============== Diff against System-eem.1244 ===============
Item was changed:
----- Method: Preferences class>>prefEvent: (in category 'updating') -----
prefEvent: anEvent
"Check if this system event defines or removes a preference."
| class selector method |
self flag: #performance. "mt: Maybe defer preference dictionary update?"
anEvent itemKind = SystemChangeNotifier classKind ifTrue: [
anEvent isRemoved ifTrue: [
self removeAllPreferencesSuchThat: [:pref |
pref provider == anEvent item]].
anEvent isRenamed ifTrue: [
self atomicUpdatePreferences: [ :prefs |
self allPreferences
select: [:pref | pref provider == anEvent item]
thenDo: [:pref | prefs at: pref id put: pref].
prefs keys
select: [:id | id beginsWith: anEvent oldName]
thenDo: [:id | prefs removeKey: id] ] ] ].
anEvent itemKind = SystemChangeNotifier methodKind ifTrue: [
"ignore instance methods"
anEvent itemClass isMeta
ifFalse: [^ self].
+
-
class := anEvent itemClass theNonMetaClass.
selector := anEvent itemSelector.
method := anEvent item.
+
+ self atomicUpdatePreferences: [ :prefs |
+ "See PragmaPreference >> #id."
+ prefs removeKey: (class name,'>>', selector) asSymbol ifAbsent: []] .
+
-
- anEvent isRemoved ifTrue: [
- self atomicUpdatePreferences: [ :prefs |
- "See PragmaPreference >> #id."
- prefs removeKey: (class name,'>>', selector) asSymbol ifAbsent: []]].
-
(anEvent isAdded or: [anEvent isModified]) ifTrue: [
method pragmas do: [:pragma | self addPragmaPreference: pragma] ] ].!
More information about the Squeak-dev
mailing list
|