The Trunk: Kernel-nice.1326.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Kernel-nice.1326.mcz

commits-2
Nicolas Cellier uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-nice.1326.mcz

==================== Summary ====================

Name: Kernel-nice.1326
Author: nice
Time: 10 May 2020, 3:26:34.805028 pm
UUID: 1b10c8d1-28d3-4445-b80c-0f840ac918c7
Ancestors: Kernel-eem.1325

Fix testMoreThanOnceForEqualBlocks by using an IdentityDictionary in #once.

Note that the postscript does convert the existing caches into IdentityDictionary.
This is necessary in order to make the test pass if it was ran once previously.

Refactor caseError so that the error message can be internationalized (change from ct, to be finished by sending translated if we wish).

=============== Diff against Kernel-eem.1325 ===============

Item was changed:
  ----- Method: BlockClosure>>once (in category 'evaluating') -----
  once
  "Evaluate the receiver exactly once, so that repeated evaluations
  answer exactly the same object as the first evaluation.  This
  allows one to intern values with the idiom
  myResourceMethod
  ^[expression] once"
 
  | cache |
  cache := self method
  propertyValueAt: #onceCache
+ ifAbsent: [self method propertyValueAt: #onceCache put: IdentityDictionary new].
- ifAbsent: [self method propertyValueAt: #onceCache put: Dictionary new].
  ^cache at: startpcOrMethod ifAbsentPut: [self value]!

Item was changed:
  ----- Method: Object>>caseError (in category 'error handling') -----
  caseError
  "Report an error from an in-line or explicit case statement."
 
+ self error: ('Case not found ({1}), and no otherwise clause' format: {self printString})!
- self error: 'Case not found (', self printString, '), and no otherwise clause'!

Item was changed:
+ (PackageInfo named: 'Kernel') postscript: '"Transform the cache for #once into IdentityDictionary."
- (PackageInfo named: 'Kernel') postscript: '"Activate Sista bytecodes in the image"
 
+ self systemNavigation allSelectorsAndMethodsDo: [ :behavior :selector :method |
+ (method hasLiteral: #once)
+ ifTrue: [(method propertyValueAt: #onceCache ifAbsent: [])
+ ifNotNil:
+ [:cache |
+ method
+ propertyValueAt: #onceCache
+ put: (cache as: IdentityDictionary)]]].'!
- CompiledCode useSista: true.
- '!