The Trunk: Kernel-nice.807.mcz

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

The Trunk: Kernel-nice.807.mcz

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

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

Name: Kernel-nice.807
Author: nice
Time: 20 September 2013, 1:10:29.327 am
UUID: 7e2508f3-57f2-4f2f-b1f2-e2d2ac123091
Ancestors: Kernel-cmm.806

If you just need the parameter names, then just ask for the parameter names.
Asking for parameter and temp names, then throwing the temps away sounds like not using the right API in the right place...

=============== Diff against Kernel-cmm.806 ===============

Item was changed:
  ----- Method: CompiledMethod>>replace:with:in: (in category 'private') -----
  replace: oldSelector with: newSelector in: aText
  | oldKeywords newKeywords args newSelectorWithArgs startOfSource lastSelectorToken |
  oldKeywords := oldSelector keywords.
  newKeywords := (newSelector ifNil: [self defaultSelector]) keywords.
  self assert: oldKeywords size = newKeywords size.
+ args := self methodClass newParser parseParameterNames: aText string.
- args := (self methodClass newParser
- parseArgsAndTemps: aText string notifying: nil) copyFrom: 1 to: self numArgs.
  newSelectorWithArgs := String streamContents: [:stream |
  newKeywords withIndexDo: [:keyword :index |
  stream nextPutAll: keyword.
  stream space.
  args size >= index ifTrue: [
  stream nextPutAll: (args at: index); space]]].
  lastSelectorToken := args isEmpty
  ifFalse: [args last]
  ifTrue: [oldKeywords last].
  startOfSource := (aText string
  indexOfSubCollection: lastSelectorToken startingAt: 1) + lastSelectorToken size.
  ^newSelectorWithArgs withBlanksTrimmed asText , (aText copyFrom: startOfSource to: aText size)!


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Kernel-nice.807.mcz

Nicolas Cellier
It sounds like I'm repeating myself...
It sounds like code is repeating itself...
I always wonder if copy/paste is the best thing we ever invented...


2013/9/20 <[hidden email]>
Nicolas Cellier uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-nice.807.mcz

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

Name: Kernel-nice.807
Author: nice
Time: 20 September 2013, 1:10:29.327 am
UUID: 7e2508f3-57f2-4f2f-b1f2-e2d2ac123091
Ancestors: Kernel-cmm.806

If you just need the parameter names, then just ask for the parameter names.
Asking for parameter and temp names, then throwing the temps away sounds like not using the right API in the right place...

=============== Diff against Kernel-cmm.806 ===============

Item was changed:
  ----- Method: CompiledMethod>>replace:with:in: (in category 'private') -----
  replace: oldSelector with: newSelector in: aText
        | oldKeywords newKeywords args newSelectorWithArgs startOfSource lastSelectorToken |
        oldKeywords := oldSelector keywords.
        newKeywords := (newSelector ifNil: [self defaultSelector]) keywords.
        self assert: oldKeywords size = newKeywords size.
+       args := self methodClass newParser parseParameterNames: aText string.
-       args := (self methodClass newParser
-               parseArgsAndTemps: aText string notifying: nil) copyFrom: 1 to: self numArgs.
        newSelectorWithArgs := String streamContents: [:stream |
                newKeywords withIndexDo: [:keyword :index |
                        stream nextPutAll: keyword.
                        stream space.
                        args size >= index ifTrue: [
                                stream nextPutAll: (args at: index); space]]].
        lastSelectorToken := args isEmpty
                ifFalse: [args last]
                ifTrue: [oldKeywords last].
        startOfSource := (aText string
                indexOfSubCollection: lastSelectorToken startingAt: 1) + lastSelectorToken size.
        ^newSelectorWithArgs withBlanksTrimmed asText , (aText copyFrom: startOfSource to: aText size)!