-
Hi, When decompiling a method is it possible to find the location (line/column) of the AstNode? I think I read in other discussions that it may not be possible but I wanted to double check. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
ILSpy initially generates an AST without locations set. |
Beta Was this translation helpful? Give feedback.
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.