Tim Abil
03/10/2022, 7:19 PMKtExpressionraulraja
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 KtVisitorTim Abil
03/10/2022, 8:17 PMKtExpression 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.Tim Abil
03/10/2022, 8:28 PMvalidateFunction 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#callCheckerraulraja
03/10/2022, 8:34 PMraulraja
03/10/2022, 8:34 PMfun callChecker(
check:
CompilerContext.(
resolvedCall: ResolvedCall<*>,
reportOn: org.jetbrains.kotlin.com.intellij.psi.PsiElement,
context: CallCheckerContext) -> Unit
): arrow.meta.phases.config.StorageComponentContainerraulraja
03/10/2022, 8:35 PMfun declarationChecker(
check:
CompilerContext.(
declaration: KtDeclaration,
descriptor: DeclarationDescriptor,
context: DeclarationCheckerContext) -> Unit
): arrow.meta.phases.config.StorageComponentContainerraulraja
03/10/2022, 8:36 PMraulraja
03/10/2022, 8:36 PMinterface CheckerContext {
val trace: BindingTrace
val languageVersionSettings: LanguageVersionSettings
val deprecationResolver: DeprecationResolver
val moduleDescriptor: ModuleDescriptor
}raulraja
03/10/2022, 8:36 PMnamedFunctionraulraja
03/10/2022, 8:37 PMdescriptor: DesclarationDescriptor is what you are probably trying to get out of the binding context.Tim Abil
03/10/2022, 8:38 PMCompilerContext.(..) check extensionTim Abil
03/10/2022, 8:44 PMTim Abil
03/10/2022, 9:05 PMraulraja
03/10/2022, 9:32 PMraulraja
03/10/2022, 9:33 PMTim Abil
03/10/2022, 9:44 PMKtVisitor at all right?raulraja
03/10/2022, 9:45 PMraulraja
03/10/2022, 9:45 PMresolvedCallraulraja
03/10/2022, 9:46 PMTim Abil
03/10/2022, 9:46 PMraulraja
03/10/2022, 9:48 PMraulraja
03/10/2022, 9:49 PMraulraja
03/10/2022, 9:52 PMraulraja
03/10/2022, 9:53 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)raulraja
03/10/2022, 11:02 PMKtElement and over CallTim 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 PMraulraja
03/10/2022, 11:11 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.Tim Abil
03/10/2022, 11:15 PMTim Abil
03/10/2022, 11:16 PMTim Abil
03/10/2022, 11:17 PMTim Abil
03/10/2022, 11:52 PMBindingContextUtils.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