Created
July 9, 2015 08:50
-
-
Save rogeralsing/2744ce7b83a822080a3a to your computer and use it in GitHub Desktop.
update all nodes with roslyn?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//other junk | |
.... | |
.... | |
Dictionary<StatementSyntax,StatementSyntax> lookup = new Dictionary<StatementSyntax,StatementSyntax>(); | |
if (returnActions.Count > 0) | |
{ | |
foreach(var ifStatement in returnActions) | |
{ | |
var mainCall = ifStatement.GetPrevious() as ExpressionStatementSyntax; | |
var newIfStatement = ifStatement.WithCondition(mainCall.Expression.WithoutTrivia()); | |
lookup[mainCall] = null; | |
lookup[ifStatement] = newIfStatement; | |
} | |
root = root.ReplaceNodes(lookup.Keys, (s, d) => lookup[s]); | |
} | |
} | |
return root.ToFullString(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment