[squeak-dev] The Inbox: Tools-ct.933.mcz
commits at source.squeak.org
commits at source.squeak.org
Sun Jan 19 22:30:12 UTC 2020
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!
More information about the Squeak-dev
mailing list
|