0

I need to check how can I navigate over the Kotlin AST of a given file. I do not know how can I pass this file to get a generated AST nor how can I navigate over its nodes using the Visitor pattern. My goal is to check the usage of some Kotlin operators in a given Kotlin file. Can anyone help me with this?

Thank you in advance!

I already tried to use Kastree (https://github.com/cretz/kastree) but it does not work if I change any part of its sample code. I could not find how can I do this with detekt (https://github.com/arturbosch/detekt).

albert
  • 182
  • 1
  • 4

1 Answers1

0

I recommend you to check the of Mohit Sarveiya about Detekt, he explains AST, PSI and how detekt utilizes visitor pattern.

Video Slides

Oleg Osipenko
  • 2,409
  • 1
  • 20
  • 28