Skip to content

Text Location of AstNode #2625

Answered by dgrunwald
e82eric asked this question in Help
Feb 8, 2022 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

ILSpy initially generates an AST without locations set.
But you can use TokenWriter.CreateWriterThatSetsLocationsInAST to create a special token writer that remembers the location of the output it wrote and stores the locations back to the AST.
Use syntaxTree.AcceptVisitor(new CSharpOutputVisitor(tokenWriter, ...)) to write a syntax tree into the token writer.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@e82eric
Comment options

Answer selected by e82eric
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants