Tim Abil
03/10/2022, 7:19 PMKtExpression
raulraja
03/10/2022, 8:09 PMdoAnalysis
analysisCompleted
. It’s also available in the declaration and expression checker context and you can find it inside the BindingTrace. If you have some code i may be able to point you as to how to get it in the place you are on now.Tim Abil
03/10/2022, 8:17 PMCompilerContext
from here and passing it down to my KtVisitor
KtExpression
i assume i need to do something like thisraulraja
03/10/2022, 8:23 PMcontext.trace.bindingContext
. What does you plugin try to perform?Tim Abil
03/10/2022, 8:27 PMcall.receive<T>()
to determine the endpoint's request body type.validateFunction
basically looks for a fun with a specific annotation so i could .accept
a visitor on itraulraja
03/10/2022, 8:33 PMarrow.meta.dsl.config.ConfigSyntax#callChecker
fun callChecker(
check:
CompilerContext.(
resolvedCall: ResolvedCall<*>,
reportOn: org.jetbrains.kotlin.com.intellij.psi.PsiElement,
context: CallCheckerContext) -> Unit
): arrow.meta.phases.config.StorageComponentContainer
fun declarationChecker(
check:
CompilerContext.(
declaration: KtDeclaration,
descriptor: DeclarationDescriptor,
context: DeclarationCheckerContext) -> Unit
): arrow.meta.phases.config.StorageComponentContainer
interface CheckerContext {
val trace: BindingTrace
val languageVersionSettings: LanguageVersionSettings
val deprecationResolver: DeprecationResolver
val moduleDescriptor: ModuleDescriptor
}
namedFunction
descriptor: DesclarationDescriptor
is what you are probably trying to get out of the binding context.Tim Abil
03/10/2022, 8:38 PMCompilerContext.(..)
check extensionraulraja
03/10/2022, 9:32 PMTim Abil
03/10/2022, 9:44 PMKtVisitor
at all right?raulraja
03/10/2022, 9:45 PMresolvedCall
Tim Abil
03/10/2022, 9:46 PMraulraja
03/10/2022, 9:48 PMTim Abil
03/10/2022, 10:01 PMraulraja
03/10/2022, 11:02 PMcall
you can get its resolvedCall
with org.jetbrains.kotlin.resolve.calls.util.CallUtilKt#getResolvedCall(org.jetbrains.kotlin.psi.KtElement, org.jetbrains.kotlin.resolve.BindingContext)
KtElement
and over Call
Tim Abil
03/10/2022, 11:09 PMexpression.getResolvedCall(context)
is giving me null back perhaps my context reference is wrongraulraja
03/10/2022, 11:10 PMContextChecker
argument in the declaration checker instead of the one in the compiler contextTim Abil
03/10/2022, 11:15 PMdeclarationCheckerContext
but that context is for the top level annotated function that i accept my Visitor to. Then the visitor visits the block of the annotated fun, iterates through the statements and visits another expression that im trying to resolve a type for.BindingContextUtils.getTypeNotNull(context, expression)
seems to be working. I figured the test code i was feeding couldnt actually compile because it was referencing external types that were missing imports in the test's input string