xref: /aosp_15_r20/external/ksp/api/src/main/kotlin/com/google/devtools/ksp/symbol/KSFunction.kt (revision af87fb4bb8e3042070d2a054e912924f599b22b7)
1 /*
2  * Copyright 2020 Google LLC
3  * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 package com.google.devtools.ksp.symbol
18 import com.google.devtools.ksp.processing.Resolver
19 /**
20  * Holds the information for a [KSFunctionDeclaration] where type arguments are resolved as member
21  * of a specific [KSType].
22  *
23  * @see Resolver.asMemberOf
24  */
25 interface KSFunction {
26     /**
27      * The return type of the function. Note that this might be `null` if an error happened when
28      * the type is resolved.
29      *
30      * @see KSFunctionDeclaration.returnType
31      */
32     val returnType: KSType?
33 
34     /**
35      * The types of the value parameters of the function. Note that this list might have `null`
36      * values in it if the type of a parameter could not be resolved.
37      *
38      * @see KSFunctionDeclaration.parameters
39      */
40     val parameterTypes: List<KSType?>
41 
42     /**
43      * The type parameters of the function.
44      *
45      * @see KSFunctionDeclaration.typeParameters
46      */
47     val typeParameters: List<KSTypeParameter>
48 
49     /**
50      * The receiver type of the function.
51      *
52      * @see KSFunctionDeclaration.extensionReceiver
53      */
54     val extensionReceiverType: KSType?
55 
56     /**
57      * True if the compiler couldn't resolve the function.
58      */
59     val isError: Boolean
60 }
61