-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
src/PharoLauncher-100Compatibility/SystemDictionary.extension.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
Extension { #name : 'SystemDictionary' } | ||
|
||
{ #category : '*PharoLauncher-100Compatibility' } | ||
SystemDictionary >> at: aKey put: anObject [ | ||
"Override from Dictionary to check Undeclared and fix up | ||
references to undeclared variables." | ||
| index assoc registeredMethods | | ||
aKey isSymbol ifFalse: [ self error: 'Only symbols are accepted as keys in SystemDictionary' ]. | ||
registeredMethods := #(). | ||
((self includesKey: aKey) not and: [ Undeclared includesKey: aKey ]) ifTrue: [ | ||
| undeclared | | ||
undeclared := Undeclared associationAt: aKey. | ||
"Undeclared variables record using methods in a property, remove. Boostrap might have used Associations" | ||
(undeclared class == UndeclaredVariable) ifTrue: [ | ||
registeredMethods := undeclared removeProperty: #registeredMethods ifAbsent: [ #() ]]. | ||
"and change class to be Global" | ||
self add: (undeclared primitiveChangeClassTo: GlobalVariable new). | ||
Undeclared removeKey: aKey]. | ||
"code of super at:put:, not using Associations but GlobalVariable" | ||
index := self findElementOrNil: aKey. | ||
assoc := array at: index. | ||
assoc | ||
ifNil: [self atNewIndex: index put: (GlobalVariable key: aKey value: anObject). self flushClassNameCache] | ||
ifNotNil: [assoc value: anObject]. | ||
registeredMethods do: [ :aMethod | aMethod isInstalled ifTrue: [aMethod recompile] ]. | ||
^ anObject | ||
] |