[squeak-dev] The Trunk: Tools-eem.626.mcz

Eliot Miranda eliot.miranda at gmail.com
Thu Jul 2 00:38:15 UTC 2015


Hi Levente,

You're right.  The asString sends here are, I think, to guard against being
given a text and Text not being protocol-compatible with String.  That
they're not protocol-compatible is a bug, but the system should still
work.  I'll take a look.


On Wed, Jul 1, 2015 at 1:48 PM, Levente Uzonyi <leves at elte.hu> wrote:

> 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]!
>>
>>
>>
>>
>


-- 
best,
Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20150701/8d7e48b8/attachment.htm


More information about the Squeak-dev mailing list