Thanks, it works.

And I understand the process now

On Thu, Sep 24, 2015 at 2:47 PM, Marcus Denker <[email protected]>
wrote:

>
> > On 24 Sep 2015, at 14:40, Gustavo Santos <[email protected]> wrote:
> >
> > Hello,
> >
> > I'm working on code manipulation on Pharo using the AST.
> > Recently, I ported my code to Pharo 5 and some of my tests are not
> running anymore.
> > Specifically, if I have a method as follows:
> >
> > method
> >       | variable |
> >       variable := 'String'.
> >
> > In Pharo 4, when I get the tree, I have a RBTemporaryNode representing
> the declaration of the variable, and a RBVariableNode for the assignment at
> the third line.
> >
> > In Pharo 5, I have two RBVariableNode's for both cases. And when I call
> #isTemp I get a MNU because the return of #binding is nil.
> >
> > How can I now differentiate these two nodes in the example? Is this a
> bug or a feature? :-P
>
> You need to do semantic analysis first. The idea that the parser does that
> is just wrong, it was a mistake to add that.
> So in Pharo5 I removed the hack in the parser.
>
> -> Parser parses, it knows nothing about semantics
> -> Semantic analysis looks at variables and decides what they mean.
>
> The #binding is set by the semantic analysis.
> (and, as it was nice, actually specialises the classes of variables)
>
> Right now you have to call #doSemanticAnalysis on the MethodNode. I am
> planning to add some lazy init so this is done automaticaly
> when accessing #binding of a variable…
>
>         Marcus
>
>
>
-- 
Gustavo Santos

Reply via email to