[squeak-dev] The Trunk: Tools-eem.626.mcz
Levente Uzonyi
leves at elte.hu
Wed Jul 1 20:48:53 UTC 2015
Hi Eliot,
I think an #asString send is missing from the line
ifTrue: [(methodRef findTokens: '>>') fold: [:a :b| (a findTokens: ' '), {b first = $# ifTrue: [b allButFirst] ifFalse: [b]}]]
It should be
ifTrue: [(methodRef asString findTokens: '>>') fold: [:a :b| (a findTokens: ' '), {b first = $# ifTrue: [b allButFirst] ifFalse: [b]}]]
It would be even better to store "methodRef asString" in a temporary
variable.
But taking a closer look at the code the #asString sends are unnecessary,
because we already know that methodRef #isString is true. And there's no
point in converting Symbols to Strings for #includesSubString:
or #findTokens:.
Levente
On Tue, 30 Jun 2015, commits at source.squeak.org wrote:
> Eliot Miranda uploaded a new version of Tools to project The Trunk:
> http://source.squeak.org/trunk/Tools-eem.626.mcz
>
> ==================== Summary ====================
>
> Name: Tools-eem.626
> Author: eem
> Time: 30 June 2015, 3:05:48.319 pm
> UUID: 0bfae54b-3e68-4252-98d8-ddb1e56fc869
> Ancestors: Tools-mt.625
>
> Upgrade MessageSet class>>parse:toClassAndSelector:
> to allow one to construct text links in modern syntax, e.g.
> BitBlt class>>#subPixelRenderColorFonts
>
> =============== Diff against Tools-mt.625 ===============
>
> Item was changed:
> ----- Method: MessageSet class>>parse:toClassAndSelector: (in category 'utilities') -----
> parse: methodRef toClassAndSelector: csBlock
> "Decode strings of the form <className> [class] <selectorName>."
>
> | tuple cl |
>
>
> self flag: #mref. "compatibility with pre-MethodReference lists"
>
> methodRef ifNil: [^ csBlock value: nil value: nil].
> methodRef isString ifFalse:
> [^methodRef setClassAndSelectorIn: csBlock].
> methodRef isEmpty ifTrue:
> [^csBlock value: nil value: nil].
> + tuple := (methodRef asString includesSubString: '>>')
> + ifTrue: [(methodRef findTokens: '>>') fold: [:a :b| (a findTokens: ' '), {b first = $# ifTrue: [b allButFirst] ifFalse: [b]}]]
> + ifFalse: [methodRef asString findTokens: ' .'].
> - tuple := methodRef asString findTokens: ' .'.
> cl := Smalltalk at: tuple first asSymbol ifAbsent: [^ csBlock value: nil value: nil].
> ^(tuple size = 2 or: [tuple size > 2 and: [(tuple at: 2) ~= 'class']])
> ifTrue: [csBlock value: cl value: (tuple at: 2) asSymbol]
> ifFalse: [csBlock value: cl class value: (tuple at: 3) asSymbol]!
>
>
>
More information about the Squeak-dev
mailing list
|