https://kotlinlang.org logo
#detekt
Title
# detekt
e

enighma

01/24/2020, 11:08 PM
Hello, I'm using https://github.com/JetBrains/intellij-community/tree/master/uast to parse some kotlin files. From what I understand detekt relies on this library as well? If not feel free to ignore my question. My problem is trying to figure out how I can resolve the value of a reference. In my case it's a `KtNameReferenceExpression`which simply points to a string declared in the same file.
BindingContextUtils
seems to provide the functionality I'm after, but I can't figure out how to get a
BindingContext.
s

schalkms

01/25/2020, 7:36 PM
detekt uses the PSI not the UAST.
However, detekt uses the
BindingContext
for type and symbol solving. There are several rules in the repo that use this type. For instance: https://github.com/arturbosch/detekt/blob/master/detekt-rules/src/main/kotlin/io/gitlab/arturbosch/detekt/rules/bugs/UnsafeCast.kt
👍 2
e

enighma

01/27/2020, 5:54 PM
@schalkms Thanks for clarifying that! @Artur Bosch That was exactly what I was looking for! Thanks a lot
3 Views