Problem with Trait>>copy

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Problem with Trait>>copy

Germán Leiva
Hi, I see this in Pharo 1.1

When a Trait is copied the environment is not passed to the copy

Trait >> copy 
| newTrait |
newTrait := self class basicNew initialize
name: self name
traitComposition: self traitComposition copyTraitExpression 
methodDict: self methodDict copy
localSelectors: self localSelectors copy
organization: self organization copy.
newTrait classTrait initializeFrom: self classTrait.
^newTrait

A possible solution

Trait >> copy 
| newTrait |
newTrait := self class basicNew initialize
name: self name
traitComposition: self traitComposition copyTraitExpression 
methodDict: self methodDict copy
localSelectors: self localSelectors copy
organization: self organization copy.
newTrait environment: self environment.
newTrait classTrait initializeFrom: self classTrait.
^newTrait

Cheers

--
Germán Leiva
[hidden email]

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project