compiler exercise :)

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

compiler exercise :)

stepharo
Hi

I would like to do the following: recompile the method category into a
method name group without removing for now the method category. I have
to do that 125 times :)

so I did

      RBLintRule
         addSelector: #group
         withMethod: ((RBLintRule methodDictionary at: #category) ast
selector: #group; generate)

and it worked :)
At least I believe.

Great system


Reply | Threaded
Open this post in threaded view
|

Re: compiler exercise :)

Matthieu
Nice :)

That is funny because I am currently doing something similar. I need to recompile all the methods of all classes of a package to change a word in the methods.
I have 237 classes and a hell lot of methods in each :p

So I did :

(RPackageOrganizer default packageNamed: 'MyPackage') definedClasses do: [ :each1 |
    each1 methods do: [ :each2 |
        each1 compile: (each2 sourceCode copyReplaceAll: 'OldWord' with: 'NewWord' asTokens: true).
    ].
].

Apparently it worked too !

But now my problem is I have about 200 words to replace every time so I need a third iteration.

2015-06-03 8:34 GMT+02:00 stepharo <[hidden email]>:
Hi

I would like to do the following: recompile the method category into a method name group without removing for now the method category. I have to do that 125 times :)

so I did

     RBLintRule
        addSelector: #group
        withMethod: ((RBLintRule methodDictionary at: #category) ast selector: #group; generate)

and it worked :)
At least I believe.

Great system