Finding the package from the method category

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

Finding the package from the method category

Stéphane Ducasse-3
I would like to know the package from a method category.
Especially since it does not seem possible to uniquely identify that :(

I tested and if I have two packages

        Foo
        Foo-Test

        and methods
        in Zork
                *Foo
                *Foo-testing
                *Foo-Test

Foo will contain all the methods and Foo-Test on the Foo-Test ones.

So there is no one one mapping between method categories and  
packages. :(

packageName
        "to be moved in packageInfo"
       
        ^ self category first = $*
                ifTrue: [ (PackageInfo named: (self category allButFirst)) name  
asSymbol]
                ifFalse: [self methodClass instanceSide category asSymbol ]

testCompiledMethodPackage
        "self debug: #testCompiledMethodPackage"

        self assert: (CompiledMethod>>#packageName) packageName = #'MSE-
Exporter'.
        self assert: (CompiledMethod>>#hasLiteral:) packageName = #'Kernel-
Methods'.
        self assert: (Point>>#x) packageName =  #'Graphics-Primitives'.
        self assert: (Point class>>#x:y:) packageName =  #'Graphics-
Primitives'.

but fails for my example.
does anybody have an idea.

Stef