fbsamples / fbsamples/kotlin_ast_tools

Is it possible to resolve types from other files using Kotlin Compiler APIs?

Offen
#3 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Kotlin
Sterne
212
Forks
10
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

By just using Kotlin Compiler APIs to parse the AST, we can only resolve AST for one particular file. But is it possible to resolve types from other files?

To resolve types and other class information of the class that is in some other file, we would need bindingContext. I assume when we are developing a compiler plugin we would get the binding context. But if we are solely relying on Kotlin compiler APIs and parsing on one file at a time, is it possible to resolve the types of classes in other files?

Relevant questions:
https://discuss.kotlinlang.org/t/how-to-get-declaring-ktfile-ktclass-using-ktcallexpression/26271/1
https://stackoverflow.com/questions/44986763/psitreevisitor-how-to-find-out-type-of-ktcallexpression-receiver

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.