Artem Romanko
2017-06-15 22:45:36 UTC
I need to find, replace and insert *Tokens* and *AstNode* in the
*CompilationUnit/AstNode* tree, that I've got from calling
parseDartFile("path/to/file.dart")
I found a way to search for certain classes/methods e.t.c and replace them
- https://stackoverflow.com/a/35577287/3768314
But I still can't find a way to create and insert custom *AstNode* before
or after some other node.
We get *CompilationUnit* from parsing. It has *childEntities* property,
which is *Iterable* and it can't be changed.
So only idea right now is to somehow recursively copy each node from one
*CompilationUnit* to the empty one and insert additional nodes when needed.
But I still need help with it.
*CompilationUnit/AstNode* tree, that I've got from calling
parseDartFile("path/to/file.dart")
I found a way to search for certain classes/methods e.t.c and replace them
- https://stackoverflow.com/a/35577287/3768314
But I still can't find a way to create and insert custom *AstNode* before
or after some other node.
We get *CompilationUnit* from parsing. It has *childEntities* property,
which is *Iterable* and it can't be changed.
So only idea right now is to somehow recursively copy each node from one
*CompilationUnit* to the empty one and insert additional nodes when needed.
But I still need help with it.
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.