Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
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:) Best, Mark |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
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:) > 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 |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
That's what I do (reparse it if something has been changed). But it seems to me wrong, and also it causes problems. |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
On 14 Aug 2014, at 16:42, Mark Rizun <[hidden email]> wrote:
Yes, we should fix this… Marcus
|
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
In reply to this post by Mark Rizun
Le 11/08/2014 10:09, Mark Rizun a écrit :
> 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:) not what an ast user may want in some cases). In practice, when playing with asts this way, you even specifically want to keep the positions of the original ast nodes (and another numbering for the insertions : replacements) so that, if needed, you can make the distinction between the original nodes and the added nodes. In short, I would suggest a reparse, especially if you have produced the output. It will also ensure that bindings and all are properly rebuilt. Thierry > > Best, > Mark > > > > -- > View this message in context: http://forum.world.st/AST-source-interval-isn-t-changed-tp4772779.html > Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com. > > > |
Free forum by Nabble | Edit this page |