I just created a small changeset

http://bugs.squeak.org/view.php?id=7432

which gives me a long awaited feature:
to see in a browser, where the heck a given method comes from.

If method comes from trait, a method's source tells me , from which one exactly!

Open a browser on Behavior clas and select an #addExclusionOf:to: method.
Usually you'll see:

addExclusionOf: aSymbol to: aTrait
        self setTraitComposition: (
                self traitComposition copyWithExclusionOf: aSymbol to: aTrait)

But with my changes you'll see:

" From: TAccessingTraitCompositionBehavior "
addExclusionOf: aSymbol to: aTrait
        self setTraitComposition: (
                self traitComposition copyWithExclusionOf: aSymbol to: aTrait)

in code pane.

Same applies to traits themselves for instance, browse
TPureBehavior>>isAliasSelector:

" From: TAccessingTraitCompositionBehavior "
isAliasSelector: aSymbol
        "Return true if the selector aSymbol is an alias defined
        in my or in another composition somewhere deeper in
        the tree of traits compositions."

        ^(self includesLocalSelector: aSymbol) not
                and: [self hasTraitComposition]
                and: [self traitComposition isAliasSelector: aSymbol]


There is one problem , which requires better expertise than mine and i
need a help from Traits experts: an aliased methods.
I tried to find out, how to dig out the aliased method from
composition, and get its source to display in code pane .. but no
luck.
Please give me an advice, how a  #getSourceCodeBySelector:
method should be implemented for proper handling of aliases.
Currently, all aliased methods sources shown using decompiler:

Behavior>>methodDictAddSelectorSilently: t1 withMethod: t2
        self basicAddSelector: t1 withMethod: t2

Aliased methods, obviously, will require an additional info in source
header, like:

" From: SomeTrait , originalSelector:  #blablba "

-- 
Best regards,
Igor Stasenko AKA sig.

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

Reply via email to