[squeak-dev] The Inbox: Tools-ct.933.mcz
Thiede, Christoph
Christoph.Thiede at student.hpi.uni-potsdam.de
Sun Jan 19 22:37:52 UTC 2020
> - In case of multiple-keyword messages, don't leave a space at the end of the header line
For illustration: This (though absolutely minor) bug has already affected more than 15 % of all methods in a pure Trunk image.* It is great that so many people use this exciting workflow! :D
*Vivide users can convince themselves of this statistic by running (takes a few seconds):
allMethods := self systemNavigation allMethods.
methods := methods select: [:m | m selector isKeyword].
badMethods := methods select: [:m | m getSource asString lines first last isSeparator].
badMethods size. "4006"
(badMethods size / methods size) roundTo: 0.01. "0.15"
:-)
Best,
Christoph
________________________________
Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von commits at source.squeak.org <commits at source.squeak.org>
Gesendet: Sonntag, 19. Januar 2020 23:30 Uhr
An: squeak-dev at lists.squeakfoundation.org
Betreff: [squeak-dev] The Inbox: Tools-ct.933.mcz
Christoph Thiede uploaded a new version of Tools to project The Inbox:
http://source.squeak.org/inbox/Tools-ct.933.mcz
==================== Summary ====================
Name: Tools-ct.933
Author: ct
Time: 19 January 2020, 11:30:07.448545 pm
UUID: 07b49992-f5e3-f14a-af86-82ed4b35cee6
Ancestors: Tools-mt.929
Slightly revise stub method generation.
- In case of multiple-keyword messages, don't leave a space at the end of the header line
- In case of exactly two keywords of the same class, name them 'anObject' and 'anotherObject' rather than numbering them
- Eliminate unwanted 'anUndefinedObject' arguments and replace them with 'anObject' instead
- Refactoring/decomposition
=============== Diff against Tools-mt.929 ===============
Item was added:
+ ----- Method: Message>>createStubArguments (in category '*Tools-Debugger') -----
+ createStubArguments
+
+ | argNames canonicalNames canonicalQuantities |
+ argNames := OrderedCollection new: self arguments size.
+ canonicalNames := self arguments collect: #canonicalArgumentName.
+ canonicalQuantities := canonicalNames asBag valuesAndCounts.
+ canonicalNames withIndexDo: [:canonicalName :index |
+ | argName |
+ argName := canonicalName in: [:name |
+ (name first isVowel ifTrue: ['an'] ifFalse: ['a']), name].
+ (argNames includes: argName) ifTrue: [
+ (canonicalQuantities at: canonicalName) = 2
+ ifTrue: [
+ argName := 'another' , canonicalName]
+ ifFalse: [
+ [argNames includes: argName]
+ whileTrue: [argName := argName , index]]].
+ argNames add: argName].
+ ^ argNames!
Item was changed:
----- Method: Message>>createStubMethod (in category '*Tools-Debugger') -----
createStubMethod
+
| argNames |
argNames := Set new.
+ ^ String streamContents: [ :stream |
+ self printStubPatternOn: stream.
+ stream
+ crtab;
+ nextPutAll: '^ self shouldBeImplemented' ]!
- ^ String streamContents: [ :s |
- self selector keywords doWithIndex: [ :key :i |
- | aOrAn argName arg argClassName |
- s nextPutAll: key.
- ((key last = $:) or: [self selector isInfix]) ifTrue: [
- arg := self arguments at: i.
- argClassName := arg canonicalArgumentName.
- aOrAn := argClassName first isVowel ifTrue: ['an'] ifFalse: ['a'].
- argName := aOrAn, argClassName.
- [argNames includes: argName] whileTrue: [argName := argName, i asString].
- argNames add: argName.
- s nextPutAll: ' '; nextPutAll: argName; space
- ].
- ].
- s cr; tab.
- s nextPutAll: 'self shouldBeImplemented'
- ].!
Item was added:
+ ----- Method: Message>>printStubPatternOn: (in category '*Tools-Debugger') -----
+ printStubPatternOn: aStream
+
+ | arguments |
+ self selector isUnary
+ ifTrue: [^ aStream nextPutAll: self selector].
+ arguments := self createStubArguments.
+ self selector keywords with: arguments do: [:key :argName |
+ aStream
+ nextPutAll: key;
+ space;
+ nextPutAll: argName;
+ space].
+ aStream skip: -1.!
Item was added:
+ ----- Method: UndefinedObject>>canonicalArgumentName (in category '*Tools-Debugger') -----
+ canonicalArgumentName
+ "It is never useful to expect nil as an argument"
+ ^ self class superclass name!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200119/655a20e7/attachment-0001.html>
More information about the Squeak-dev
mailing list
|