Fudge
06/26/2020, 12:21 PMKtElement
using the kotlin compiler api? When I try to access `getReference()`/`getReferences()` all I get is null / empty list. I'm assuming there's some extra configuration I need to do, because calls to resolve references go through this call:
ServiceManager.getService(KotlinReferenceProvidersService::class.java) ?: NO_REFERENCES_SERVICE
And the left hand side is always null.shikasd
06/26/2020, 12:23 PMFudge
06/26/2020, 12:38 PMfun main() {
val x = Foo()
x.bar() <----
}
I want to see where bar
is defined and what class owns it.shikasd
06/26/2020, 2:43 PMcall
or resolvedCall
, which can point you to descriptor of the function and class, so you can use them
iirc, compiler has getResolvedCall()
extension for expressionsshikasd
06/26/2020, 2:44 PMFudge
06/29/2020, 2:09 PMBindingContext
for call
and resolvedCall
?Fudge
06/29/2020, 2:19 PMTopDownAnalysisContext
, is there some way to go from there to a BindingContext
?shikasd
06/29/2020, 2:30 PMFudge
06/29/2020, 5:03 PMshikasd
06/29/2020, 5:06 PMBindingTrace
type
It contains BindingContext
and also allows you to modify it 🙂shikasd
06/29/2020, 5:07 PMBindingContext
, as otherwise it will be emptyFudge
06/29/2020, 5:13 PMshikasd
07/01/2020, 9:19 PMKotlinType
you can use KotlinType to get class descriptor out of itFudge
07/01/2020, 9:24 PMKotlinType
from a KtTypeReference
and a property descriptor from `KtProperty`(I think that's the right type for properties)?Fudge
07/01/2020, 9:27 PMKtElement
is, i'm not sure which it isFudge
07/01/2020, 9:28 PMgetAbbreviatedTypeOrType
Fudge
07/01/2020, 9:39 PMUnresolvedType
errors when using types defined in the classpath... Solving that probably won't be funshikasd
07/01/2020, 10:10 PMFudge
07/02/2020, 8:54 AMconfiguration.addJvmClasspathRoots(classPath.map { it.toFile() })
The full code is here https://hasteb.in/eqahijib.kotlin, is there anything I'm missing for including types?Fudge
07/02/2020, 8:55 AMclasspath
includes a jar which defines the typesshikasd
07/02/2020, 11:29 AM