[squeak-dev] The Trunk: Traits-nice.300.mcz

Frank Shearar frank.shearar at gmail.com
Sat Nov 2 09:47:17 UTC 2013


On 1 November 2013 23:31,  <commits at source.squeak.org> wrote:
> Nicolas Cellier uploaded a new version of Traits to project The Trunk:
> http://source.squeak.org/trunk/Traits-nice.300.mcz
>
> ==================== Summary ====================
>
> Name: Traits-nice.300
> Author: nice
> Time: 2 November 2013, 12:30:54.426 am
> UUID: fced9294-e4ef-4fb3-b2db-6e8da24a6e82
> Ancestors: Traits-nice.299
>
> Avoid spurious warnings in Trait>>rename: when an Undeclared isn't really referenced.
>
> This may help some SUnit tests to pass.
>
> =============== Diff against Traits-nice.299 ===============
>
> Item was changed:
>   ----- Method: Trait>>rename: (in category 'initialize') -----
>   rename: aString
>         "The new name of the receiver is the argument, aString."
>
>         | newName |
>         (newName := aString asSymbol) ~= self name
>                 ifFalse: [^ self].
>         (self environment includesKey: newName)
>                 ifTrue: [^ self error: newName , ' already exists'].
> +       ((self environment undeclared includesKey: newName)
> +               and: [(self environment undeclared unreferencedKeys includes: newName) not])
> -       (self environment undeclared includesKey: newName)
>                 ifTrue: [self inform: 'There are references to, ' , aString printString , '
>   from Undeclared. Check them after this change.'].
>         self environment renameClass: self as: newName.
>         name := newName!

There's a lot of text in this method. I think it would read more
easily if we added an "undeclared := self environment undeclared" var.
The + lines above would then be something like

((undeclared includesKey: newName)
    and: [(undeclared unreferencedKeys includes: newName) not])
        ifTrue: []

frank


More information about the Squeak-dev mailing list