<div dir="ltr"><div><div>It sounds like I'm repeating myself...<br></div>It sounds like code is repeating itself...<br></div>I always wonder if copy/paste is the best thing we ever invented...<br></div><div class="gmail_extra">
<br><br><div class="gmail_quote">2013/9/20 <span dir="ltr"><<a href="mailto:commits@source.squeak.org" target="_blank">commits@source.squeak.org</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Nicolas Cellier uploaded a new version of Kernel to project The Trunk:<br>
<a href="http://source.squeak.org/trunk/Kernel-nice.807.mcz" target="_blank">http://source.squeak.org/trunk/Kernel-nice.807.mcz</a><br>
<br>
==================== Summary ====================<br>
<br>
Name: Kernel-nice.807<br>
Author: nice<br>
Time: 20 September 2013, 1:10:29.327 am<br>
UUID: 7e2508f3-57f2-4f2f-b1f2-e2d2ac123091<br>
Ancestors: Kernel-cmm.806<br>
<br>
If you just need the parameter names, then just ask for the parameter names.<br>
Asking for parameter and temp names, then throwing the temps away sounds like not using the right API in the right place...<br>
<br>
=============== Diff against Kernel-cmm.806 ===============<br>
<br>
Item was changed:<br>
----- Method: CompiledMethod>>replace:with:in: (in category 'private') -----<br>
replace: oldSelector with: newSelector in: aText<br>
| oldKeywords newKeywords args newSelectorWithArgs startOfSource lastSelectorToken |<br>
oldKeywords := oldSelector keywords.<br>
newKeywords := (newSelector ifNil: [self defaultSelector]) keywords.<br>
self assert: oldKeywords size = newKeywords size.<br>
+ args := self methodClass newParser parseParameterNames: aText string.<br>
- args := (self methodClass newParser<br>
- parseArgsAndTemps: aText string notifying: nil) copyFrom: 1 to: self numArgs.<br>
newSelectorWithArgs := String streamContents: [:stream |<br>
newKeywords withIndexDo: [:keyword :index |<br>
stream nextPutAll: keyword.<br>
stream space.<br>
args size >= index ifTrue: [<br>
stream nextPutAll: (args at: index); space]]].<br>
lastSelectorToken := args isEmpty<br>
ifFalse: [args last]<br>
ifTrue: [oldKeywords last].<br>
startOfSource := (aText string<br>
indexOfSubCollection: lastSelectorToken startingAt: 1) + lastSelectorToken size.<br>
^newSelectorWithArgs withBlanksTrimmed asText , (aText copyFrom: startOfSource to: aText size)!<br>
<br>
<br>
</blockquote></div><br></div>