The Inbox: Collections-ul.939.mcz

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

The Inbox: Collections-ul.939.mcz

commits-2
Levente Uzonyi uploaded a new version of Collections to project The Inbox:
http://source.squeak.org/inbox/Collections-ul.939.mcz

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

Name: Collections-ul.939
Author: ul
Time: 14 April 2021, 12:06:29.592182 pm
UUID: 3b540268-794a-4f47-81e1-74816f0ca4d7
Ancestors: Collections-mt.937

- replace custom symbol creation methods, #string and #pvtAt:put: with #copyFrom: in Symbol class >> #intern:
- remove the now unused private methods

=============== Diff against Collections-mt.937 ===============

Item was removed:
- ----- Method: ByteSymbol>>pvtAt:put: (in category 'private') -----
- pvtAt: index put: aCharacter
- "Primitive. Store the Character in the field of the receiver indicated by the index.
- Fail if the index is not an Integer or is out of bounds, or if the argument is not a
- Character, or the Character's code is outside the 0-255 range, or if the receiver
- is read-only. Essential. See Object documentation whatIsAPrimitive."
-
- <primitive: 64 error: ec>
- aCharacter isCharacter ifFalse:
- [^self errorImproperStore].
- index isInteger
- ifTrue:
- [ec == #'no modification' ifTrue:
- [^thisContext modificationForbiddenFor: self at: index putCharacter: aCharacter].
- self errorSubscriptBounds: index]
- ifFalse: [self errorNonIntegerIndex]!

Item was removed:
- ----- Method: ByteSymbol>>string: (in category 'private') -----
- string: aString
- 1 to: aString size do: [:j | self pvtAt: j put: (aString at: j)].
- ^self!

Item was changed:
  ----- Method: Symbol class>>intern: (in category 'instance creation') -----
  intern: aStringOrSymbol
  "Answer the unique Symbol formed with given String.
  If it does not exist yet, create it and intern it in the NewSymbols.
  Interning a Symbol should return the Symbol itself, no Symbol should be duplicated"
 
  | originalNewSymbols |
  originalNewSymbols := NewSymbols.
  ^(self lookup: aStringOrSymbol) ifNil:[
  | aSymbol newNewSymbols |
  aStringOrSymbol isSymbol ifTrue:[
  aSymbol := aStringOrSymbol.
  ] ifFalse:[
  aSymbol := (aStringOrSymbol isOctetString ifTrue:[ByteSymbol] ifFalse:[WideSymbol])
  new: aStringOrSymbol size.
+ aSymbol
+ copyFrom: aStringOrSymbol;
+ beReadOnlyObject.
- aSymbol string: aStringOrSymbol.
- aSymbol beReadOnlyObject.
  ].
  newNewSymbols := originalNewSymbols copyWith: aSymbol.
  originalNewSymbols == NewSymbols
  ifTrue: [
  NewSymbols := newNewSymbols.
  newNewSymbols size > 1000 ifTrue: [ self condenseNewSymbols ].
  aSymbol ]
  ifFalse: [
  "Some other process has modified the symbols. Try again."
  self intern: aStringOrSymbol ] ]!

Item was removed:
- ----- Method: Symbol>>string: (in category 'private') -----
- string: aString
-
- 1 to: aString size do: [:j | super at: j put: (aString at: j)].
- ^self  !

Item was removed:
- ----- Method: WideSymbol>>pvtAt:put: (in category 'private') -----
- pvtAt: index put: aCharacter
- "Primitive. Store the Character in the field of the receiver indicated by
- the index. Fail if the index is not an Integer or is out of bounds, or if
- the argument is not a Character, or if the receiver is read-only.
- Essential. See Object documentation whatIsAPrimitive."
-
- <primitive: 61 error: ec>
- aCharacter isCharacter ifFalse:
- [^self errorImproperStore].
- index isInteger
- ifTrue:
- [ec == #'no modification' ifTrue:
- [^thisContext modificationForbiddenFor: self at: index putCharacter: aCharacter].
- self errorSubscriptBounds: index]
- ifFalse: [self errorNonIntegerIndex]!

Item was removed:
- ----- Method: WideSymbol>>string: (in category 'private') -----
- string: aString
- 1 to: aString size do: [:j | self pvtAt: j put: (aString at: j) asInteger].
- ^self!