Levente Uzonyi uploaded a new version of Tools to project The Trunk:
http://source.squeak.org/trunk/Tools-ul.742.mcz
==================== Summary ====================
Name: Tools-ul.742
Author: ul
Time: 25 December 2016, 11:06:07.791123 pm
UUID: 5824e7da-a2e2-49e6-b445-bbf97bdaff56
Ancestors: Tools-nice.741
Simplified and removed the duplicate selector from the results of StringHolder >> #withSelectorAndMessagesIn:evaluate:.
=============== Diff against Tools-nice.741 ===============
Item was changed:
----- Method: StringHolder>>withSelectorAndMessagesIn:evaluate: (in category '*Tools') -----
withSelectorAndMessagesIn: aCompiledMethod evaluate: aBlock
"Allow the user to choose one selector, chosen from the currently selected message's selector, as well as those of all messages sent by it, and evaluate aBlock on behalf of chosen selector. If there is only one possible choice, simply make it; if there are multiple choices, put up a menu, and evaluate aBlock on behalf of the the chosen selector, doing nothing if the user declines to choose any"
+ | selectorOrNil messages |
+ selectorOrNil := aCompiledMethod selector.
+ messages := SystemNavigation thoroughSenders
+ ifTrue: [
+ | litGetter |
+ litGetter := [:set :l|
+ (l isSymbol and: [l size > 0 and: [l first isLowercase]]) ifTrue:
+ [set add: l].
+ l isArray ifTrue:
+ [l inject: set into: litGetter].
+ set].
+ aCompiledMethod allLiterals,
+ (aCompiledMethod pragmas collect: [:pragma| pragma keyword])
+ inject: aCompiledMethod messages into: litGetter]
+ ifFalse: [aCompiledMethod messages].
+ messages remove: selectorOrNil ifAbsent: [ "do nothing" ].
+ messages ifEmpty: [ "If only one item, there is no choice"
+ ^selectorOrNil ifNotNil: [ aBlock value: selectorOrNil ] ].
- | selectorOrNil litGetter messages |
- selectorOrNil := aCompiledMethod selector.
- messages := SystemNavigation thoroughSenders
- ifTrue:
- [litGetter := [:set :l|
- (l isSymbol and: [l size > 0 and: [l first isLowercase]]) ifTrue:
- [set add: l].
- l isArray ifTrue:
- [l inject: set into: litGetter copy].
- set].
- aCompiledMethod allLiterals
- , (aCompiledMethod pragmas collect: [:pragma| pragma keyword])
- inject: aCompiledMethod messages into: litGetter copy]
- ifFalse: [aCompiledMethod messages].
- (messages isEmpty "if no messages, use only selector"
- or: [messages size = 1 and: [messages includes: selectorOrNil]]) ifTrue:
- [^selectorOrNil ifNotNil: [aBlock value: selectorOrNil]]. "If only one item, there is no choice"
-
self systemNavigation
showMenuOf: messages
withFirstItem: selectorOrNil
ifChosenDo: aBlock!
Levente Uzonyi uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-ul.730.mcz
==================== Summary ====================
Name: Collections-ul.730
Author: ul
Time: 25 December 2016, 4:19:28.820055 pm
UUID: 960b46c2-39af-42c0-8855-92413ba0dbda
Ancestors: Collections-ul.729, Collections-cmm.729
- merge
=============== Diff against Collections-ul.729 ===============
Item was added:
+ ----- Method: Symbol>>selector (in category 'accessing') -----
+ selector
+ ^ self!
Levente Uzonyi uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-ul.729.mcz
==================== Summary ====================
Name: Collections-ul.729
Author: ul
Time: 25 December 2016, 4:16:33.349302 pm
UUID: dedb0ac7-ea11-42b9-8a91-2839a52866c7
Ancestors: Collections-nice.728
- minor OrderedCollection optimizations
=============== Diff against Collections-nice.728 ===============
Item was changed:
----- Method: OrderedCollection>>asArray (in category 'converting') -----
asArray
"Overriden for speed"
+ | result size |
+ result := Array new: (size := self size).
- | result |
- result := Array new: self size.
result
replaceFrom: 1
+ to: size
- to: result size
with: array
startingAt: firstIndex.
^result!
Item was changed:
----- Method: OrderedCollection>>makeRoomAtFirst (in category 'private') -----
makeRoomAtFirst
"Make some empty slots at the front of the array. If we have more than 50% free space, then just move the elements, so that the first 50% of the slots are free, otherwise add new free slots to the front by growing. Precondition: firstIndex = 1"
+ | tally newFirstIndex newLastIndex capacity |
- | tally newFirstIndex newLastIndex |
tally := self size.
+ capacity := array size.
+ tally * 2 >= capacity ifTrue: [ ^self growAtFirst ].
+ tally = 0 ifTrue: [ ^self resetTo: capacity + 1 ].
+ newFirstIndex := capacity // 2 + 1.
- tally * 2 >= array size ifTrue: [ ^self growAtFirst ].
- tally = 0 ifTrue: [ ^self resetTo: array size + 1 ].
- newFirstIndex := array size // 2 + 1.
newLastIndex := newFirstIndex - firstIndex + lastIndex.
0 to: tally - 1 do: [ :offset |
array at: newLastIndex - offset put: (array at: lastIndex - offset) ].
array from: firstIndex to: newFirstIndex - 1 put: nil.
firstIndex := newFirstIndex.
lastIndex := newLastIndex!
Item was added:
+ ----- Method: OrderedCollection>>replace: (in category 'enumerating') -----
+ replace: aBlock
+ "Evaluate aBlock with each of my elements as the argument. Collect the resulting values into myself.
+ Override superclass in order to work on the internal array directly."
+
+ firstIndex to: lastIndex do: [ :index |
+ array at: index put: (aBlock value: (array at: index)) ]!
Item was changed:
----- Method: OrderedCollection>>with:collect: (in category 'enumerating') -----
with: otherCollection collect: twoArgBlock
"Collect and return the result of evaluating twoArgBlock with
corresponding elements from this collection and otherCollection."
+
+ | result offset size |
+ (size := self size) = otherCollection size ifFalse: [ self error: 'otherCollection must be the same size' ].
+ result := self species new: size.
+ offset := 1 - firstIndex.
+ firstIndex to: lastIndex do: [ :index |
+ result addLast: (
+ twoArgBlock
+ value: (array at: index)
+ value: (otherCollection at: index + offset)) ].
+ ^result!
- | result |
- otherCollection size = self size ifFalse: [self error: 'otherCollection must be the same size'].
- result := self species new: self size.
- 1 to: self size do:
- [:index | result addLast: (twoArgBlock value: (self at: index)
- value: (otherCollection at: index))].
- ^ result!
Item was changed:
----- Method: OrderedCollection>>withIndexCollect: (in category 'enumerating') -----
withIndexCollect: elementAndIndexBlock
"Just like with:collect: except that the iteration index supplies the second argument to the block. Override superclass in order to use addLast:, not at:put:."
+ | newCollection offset |
- | newCollection |
newCollection := self species new: self size.
+ offset := 1 - firstIndex.
firstIndex to: lastIndex do:
[:index |
newCollection addLast: (elementAndIndexBlock
value: (array at: index)
+ value: index + offset) ].
- value: index - firstIndex + 1)].
^ newCollection!
Nicolas Cellier uploaded a new version of Tools to project The Trunk:
http://source.squeak.org/trunk/Tools-nice.741.mcz
==================== Summary ====================
Name: Tools-nice.741
Author: nice
Time: 25 December 2016, 3:13:35.841637 pm
UUID: 7c93c98f-3f12-44f0-bb60-f9b19d91a3c9
Ancestors: Tools-bf.740
Salvage MessageTrace by using asString rather than stringVersion, because stringVersion might be uninitialized
=============== Diff against Tools-bf.740 ===============
Item was changed:
----- Method: MessageTrace>>filterFrom: (in category 'filtering') -----
filterFrom: aBlock
"Filter the receiver's list down to only those items that satisfy aBlock, which takes a class an a selector as its arguments."
| newList newAutoSelectStrings newMessageSelections oldList |
oldList := Dictionary new.
messageList do: [ : each | oldList at: each put: each ].
newList := messageList class new.
newAutoSelectStrings := autoSelectStrings class new.
newMessageSelections := messageSelections class new.
messageList withIndexDo:
[ : each : index | (self class
parse: each
toClassAndSelector: aBlock) ifTrue:
[ newList add: each.
newAutoSelectStrings add: (autoSelectStrings at: index).
newMessageSelections add: (messageSelections at: index) ] ].
(self setFilteredList: newList) ifTrue:
[ autoSelectStrings := newAutoSelectStrings.
messageList do:
+ [ : each | each stringVersion: (oldList at: each) asString ] ]!
- [ : each | each stringVersion: (oldList at: each) stringVersion ] ]!
Item was changed:
----- Method: MessageTrace>>indentEverything (in category 'indenting') -----
indentEverything
+ messageList do: [ :each | each stringVersion: (self indentionPrefixOfSize: 1), each asString ]
- messageList do: [ :each | each stringVersion: (self indentionPrefixOfSize: 1), each stringVersion ]
!
Item was changed:
----- Method: MessageTrace>>indentionLevelAt: (in category 'private accessing') -----
indentionLevelAt: msgListIndex
+ ^ self indentionsIn: (messageList at: msgListIndex) asString!
- ^ self indentionsIn: (messageList at: msgListIndex) stringVersion!
Chris Muller uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-cmm.729.mcz
==================== Summary ====================
Name: Collections-cmm.729
Author: cmm
Time: 22 December 2016, 11:41:23.542114 pm
UUID: 7055f774-a3b6-4f1f-a8e6-94265108c10f
Ancestors: Collections-nice.728
Symbol>>#selector affords flexibility with input arguments that normally only accept Symbol selectors, to also accept MessageSends or CompiledMethods, too, as when drag and dropping a method out of a browser window.
=============== Diff against Collections-nice.728 ===============
Item was added:
+ ----- Method: Symbol>>selector (in category 'accessing') -----
+ selector
+ ^ self!
Patrick Rein uploaded a new version of CollectionsTests to project The Trunk:
http://source.squeak.org/trunk/CollectionsTests-pre.272.mcz
==================== Summary ====================
Name: CollectionsTests-pre.272
Author: pre
Time: 21 December 2016, 2:44:36.561014 pm
UUID: 228aa803-a8b5-304c-b759-28f424a0191c
Ancestors: CollectionsTests-topa.271
Moves the failing test for WriteStreams to the expected failures as it does not test any previous implementation but is a feature request.
Also fixes a typo in the selector.
=============== Diff against CollectionsTests-topa.271 ===============
Item was added:
+ ----- Method: WriteStreamTest>>expectedFailures (in category 'tests - character writing') -----
+ expectedFailures
+
+ ^ #( testStreamAlwaysUseGivenCollection )!
Item was removed:
- ----- Method: WriteStreamTest>>testStreamAlwasyUseGivenCollection (in category 'tests - instance creation') -----
- testStreamAlwasyUseGivenCollection
- "self debug: #testStreamUseGivenCollection"
-
- "When a stream is created on a collection, it tries to keep using that collection instead of copying,
- even in the case of mutation of the original collection."
-
- |string stream|
-
- string := String withAll: 'xy'.
- stream := WriteStream on: string.
-
- stream nextPut: $a.
- stream nextPut: (Character codePoint: 269). "wide."
- self assert: string = (String with: $a with: (Character codePoint: 269)).!
Item was added:
+ ----- Method: WriteStreamTest>>testStreamAlwaysUseGivenCollection (in category 'tests - instance creation') -----
+ testStreamAlwaysUseGivenCollection
+ "self debug: #testStreamUseGivenCollection"
+
+ "When a stream is created on a collection, it tries to keep using that collection instead of copying,
+ even in the case of mutation of the original collection."
+
+ "To implement this WriteStream>>#nextPut: might want to use becomeForward for replacing the original
+ string with the new widestring object. Another option might be to throw an exception --pre"
+
+ |string stream|
+
+ string := String withAll: 'xy'.
+ stream := WriteStream on: string.
+
+ stream nextPut: $a.
+ stream nextPut: (Character codePoint: 269). "wide."
+ self assert: string = (String with: $a with: (Character codePoint: 269)).!