Add comments for generators about data/inline class (in psi2ir and fir2ir) and annotations (fir2ir).

This commit is contained in:
Jinseong Jeon
2020-05-13 11:26:01 -07:00
committed by Mikhail Glukhikh
parent e844c59e7e
commit bcf277d885
5 changed files with 28 additions and 6 deletions
@@ -30,6 +30,12 @@ import org.jetbrains.kotlin.psi.psiUtil.startOffset
import org.jetbrains.kotlin.resolve.BindingContext
import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils
/**
* A generator that generates synthetic members of data class as well as part of inline class.
*
* This one uses [DataClassMethodGenerator] to determine which members are needed to generate; uses [DataClassMembersGenerator] to generate
* function bodies; and provides ways to declare functions or parameters based on descriptors and binding context.
*/
class DataClassMembersGenerator(
declarationGenerator: DeclarationGenerator
) : DeclarationGeneratorExtension(declarationGenerator) {
@@ -27,6 +27,12 @@ import org.jetbrains.kotlin.types.checker.KotlinTypeChecker
import org.jetbrains.kotlin.types.isNullable
import org.jetbrains.kotlin.types.typeUtil.representativeUpperBound
/**
* A platform-, frontend-independent logic for generating synthetic members of data class: equals, hashCode, toString, componentN, and copy.
* Different front-ends may need to define how to declare functions, parameters, etc., or simply provide predefined ones.
*
* Generating synthetic members of inline class can use this as well, in particular, members from Any: equals, hashCode, and toString.
*/
abstract class DataClassMembersGenerator(
val context: IrGeneratorContext,
val symbolTable: SymbolTable,