[squeak-dev] The Inbox: Tools-ct.931.mcz
Jakob Reschke
forums.jakob at resfarm.de
Sat Jan 18 21:22:47 UTC 2020
+1 to eliminate the duplication. Didn't review for mistakes though.
Am Sa., 18. Jan. 2020 um 16:05 Uhr schrieb <commits at source.squeak.org>:
> Christoph Thiede uploaded a new version of Tools to project The Inbox:
> http://source.squeak.org/inbox/Tools-ct.931.mcz
>
> ==================== Summary ====================
>
> Name: Tools-ct.931
> Author: ct
> Time: 18 January 2020, 4:04:41.091813 pm
> UUID: f26680f1-98eb-1b46-bc36-2f6371daf249
> Ancestors: Tools-mt.929
>
> Eliminates massive duplication in
> VersionsBrowser>>#scanVersionsOf:class:meta:category:selector:. This logic
> is already defined in ChangeSet class.
>
> Better merge System-ct.1132 before, which fixes a bug regarding the
> versions' categories.
>
> =============== Diff against Tools-mt.929 ===============
>
> Item was changed:
> ----- Method:
> VersionsBrowser>>scanVersionsOf:class:meta:category:selector: (in category
> 'init & update') -----
> scanVersionsOf: method class: class meta: meta category: category
> selector: selector
> +
> - | position prevPos prevFileIndex preamble tokens sourceFilesCopy
> stamp cat |
> selectorOfMethod := selector.
> currentCompiledMethod := method.
> classOfMethod := meta ifTrue: [class class] ifFalse: [class].
> - cat := category ifNil: [''].
> changeList := OrderedCollection new.
> list := OrderedCollection new.
> self addedChangeRecord ifNotNil: [ :change |
> + self
> + addItem: change
> + text: ('{1} (in {2})' translated
> + format: { change stamp. change fileName })
> ].
> - self addItem: change text: ('{1} (in {2})' translated
> format: { change stamp. change fileName }) ].
> listIndex := 0.
> + (ChangeSet scanVersionsOf: method class: class meta: meta
> category: category selector: selector)
> + do: [ :change |
> + self
> + addItem: change
> + text: ('{1} {2} {3} \{{4}\}' translated
> format: {
> + change stamp. classOfMethod name.
> selector. change category })].
> + listSelections := Array new: list size withAll: false.!
> - position := method filePosition.
> - sourceFilesCopy := SourceFiles collect:
> - [:x | x isNil ifTrue: [ nil ]
> - ifFalse: [x readOnlyCopy]].
> - method fileIndex = 0 ifTrue: [^ nil].
> - file := sourceFilesCopy at: method fileIndex.
> -
> - [position notNil & file notNil]
> - whileTrue:
> - [preamble := method getPreambleFrom: file at: (0 max:
> position - 3).
> -
> - "Preamble is likely a linked method preamble, if we're in
> - a changes file (not the sources file). Try to
> parse it
> - for prior source position and file index"
> - prevPos := nil.
> - stamp := ''.
> - (preamble findString: 'methodsFor:' startingAt: 1) > 0
> - ifTrue: [tokens := Scanner new scanTokens:
> preamble]
> - ifFalse: [tokens := Array new "ie cant be back
> ref"].
> - ((tokens size between: 7 and: 8)
> - and: [(tokens at: tokens size - 5) = #methodsFor:])
> - ifTrue:
> - [(tokens at: tokens size - 3) = #stamp:
> - ifTrue: ["New format gives change stamp
> and unified prior pointer"
> - stamp := tokens at: tokens
> size - 2.
> - prevPos := tokens last.
> - prevFileIndex :=
> sourceFilesCopy fileIndexFromSourcePointer: prevPos.
> - prevPos := sourceFilesCopy
> filePositionFromSourcePointer: prevPos]
> - ifFalse: ["Old format gives no stamp;
> prior pointer in two parts"
> - prevPos := tokens at:
> tokens size - 2.
> - prevFileIndex := tokens
> last].
> - cat := tokens at: tokens size - 4.
> - (prevPos = 0 or: [prevFileIndex = 0])
> ifTrue: [prevPos := nil]].
> - ((tokens size between: 5 and: 6)
> - and: [(tokens at: tokens size - 3) = #methodsFor:])
> - ifTrue:
> - [(tokens at: tokens size - 1) = #stamp:
> - ifTrue: ["New format gives change stamp
> and unified prior pointer"
> - stamp := tokens at: tokens
> size].
> - cat := tokens at: tokens size - 2].
> - self addItem:
> - (ChangeRecord new file: file position:
> position type: #method
> - class: class name
> category: cat meta: meta stamp: stamp)
> - text: stamp , ' ' , class name , (meta ifTrue: ['
> class '] ifFalse: [' ']) , selector, ' {', cat, '}'.
> - position := prevPos.
> - prevPos notNil ifTrue:
> - [file := sourceFilesCopy at: prevFileIndex]].
> - sourceFilesCopy do: [:x | x notNil ifTrue: [x close]].
> - listSelections := Array new: list size withAll: false!
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200118/de62b644/attachment-0001.html>
More information about the Squeak-dev
mailing list
|