Dart Ast Visitor, how to know if end of method is reached?

Viewed 7

I am currently using the analyzer package with a recursive visitor to implement an AST visitor for code generation. For this I need a way to distinguish between separate traces through a methods control flow.

On the first method declaration I start building a trace. When a specific method invocation is hit, the trace is added to the stack and shortened a bit. This way I can find all traces through one single method declaration.

Problems start arising when there is more than one method declaration. As there is no way of knowing for me when a method ends. I know when I find a new one, but not when the last declaration ends.

Does anybody have any idea? Google has not been insightful.

0 Answers
Related