Login  Register

Re: AST source interval isn't changed

Posted by Marcus Denker-4 on Aug 14, 2014; 2:23pm
URL: https://forum.world.st/AST-source-interval-isn-t-changed-tp4772779p4773284.html


On 11 Aug 2014, at 10:09, Mark Rizun <[hidden email]> wrote:

> Hello,
>
> I have MyTextModel class - a subclass of TextModel, it holds an ast of it's
> text.
> When I replace node of the ast using replaceWith: ast is changed, then I say
> text: ast formattedCode, so the text is changed too.
> But! when I inspect new ast(after replacing some node), I see that source
> interval isn't changed. Why?
> If I say bestNodeFor: someInterval, it doesn't give me the right node,
> because sourceInterval of ast wasn't changed, and I don't know why.
> Hope you will help me out:)
>
I guess the AST is never used like that (it is re-created from source after
a change normally).

But I think we should fix it.. it should be possible to do multiple things with it
and it should stay consistent.

        Marcus