Copying methods

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

Copying methods

Steve Alan Waring
Hi,

I am not sure if this is by design, but copying or moving a method (via drag
and drop) from ClassA to ClassB in a second package results in the new
method being a loose method in the source package.

Is this a side effect of issue 743?

Looking at the comment in ClassSelector>>dropMethod:into: suggests it may be
a bug. In ClassSelector>>dropMethod:into: the "newMethod" would already have
its owning packaging set (in
ClassDescription>>copy:from:categories: etc) to the source package.

If the comment of ClassSelector>>dropMethod:into: is the intended behavior,
should the method read:

...
"If the method did not previously exist and the source method was loose, the
new method is assigned to source methods package."

(newMethod isNil or: [preExisting not and: [ method isLoose ]])
     ifFalse: [newMethod owningPackage: targetClass owningPackage].

Alternatively, should ClassDescription>>copy:from:categories: compile into
the targetClass owningPackage?


Thanks,
Steve Waring