parent does not update after using InsertChildAfter #497

Open
opened 2015-06-22 23:55:47 -05:00 by joodies · 0 comments
joodies commented 2015-06-22 23:55:47 -05:00 (Migrated from github.com)

Hello,

I tried some code in the NRefractor demo project,
I modify the syntax tree, add 2 nodes

vc.InsertChildBefore(vc.Children.Last(), AstType.Create("int b = 78;"), new Role<AstType>("Variable", AstType.Null));

vc.InsertChildBefore(vc.Children.Last(), AstType.Create(Environment.NewLine), new Role<AstType>("NewLine", AstType.Null));             

And can see the new nodes in watch window as follow,
As you can see , the new node is not there when i try syntaxtree.ToString()
nr

source code

using System;
using System.Linq;
class Test
{
    public void Main(string[] args)
    {
         int a = 80;
    }
}

what i want as result

using System;
using System.Linq;
class Test
{
    public void Main(string[] args)
    {
         int a = 80;
         int b = 78;
    }
}
Hello, I tried some code in the NRefractor demo project, I modify the syntax tree, add 2 nodes ``` c# vc.InsertChildBefore(vc.Children.Last(), AstType.Create("int b = 78;"), new Role<AstType>("Variable", AstType.Null)); vc.InsertChildBefore(vc.Children.Last(), AstType.Create(Environment.NewLine), new Role<AstType>("NewLine", AstType.Null)); ``` And can see the new nodes in watch window as follow, As you can see , the new node is not there when i try syntaxtree.ToString() ![nr](https://cloud.githubusercontent.com/assets/5227351/8299145/d8059ee6-19a6-11e5-98f8-f924a6f2d935.png) source code ``` c# using System; using System.Linq; class Test { public void Main(string[] args) { int a = 80; } } ``` what i want as result ``` c# using System; using System.Linq; class Test { public void Main(string[] args) { int a = 80; int b = 78; } } ```
This discussion has been locked. Commenting is limited to contributors.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-icsharpcode/NRefactory#497
No description provided.