org.jetbrains.kotlin.ir.util.SymbolTableExtension.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kotlin-compiler-embeddable Show documentation
Show all versions of kotlin-compiler-embeddable Show documentation
the Kotlin compiler embeddable
/*
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.ir.util
import org.jetbrains.kotlin.descriptors.DescriptorVisibility
import org.jetbrains.kotlin.ir.IrLock
import org.jetbrains.kotlin.ir.declarations.*
import org.jetbrains.kotlin.ir.expressions.IrExpressionBody
import org.jetbrains.kotlin.ir.symbols.*
import org.jetbrains.kotlin.ir.symbols.impl.*
import org.jetbrains.kotlin.ir.types.IrType
import org.jetbrains.kotlin.utils.threadLocal
abstract class ReferenceSymbolTableExtension {
abstract fun referenceScript(declaration: Script): IrScriptSymbol
abstract fun referenceClass(declaration: Class): IrClassSymbol
abstract fun referenceConstructor(declaration: Constructor): IrConstructorSymbol
abstract fun referenceEnumEntry(declaration: Class): IrEnumEntrySymbol
abstract fun referenceField(declaration: Property): IrFieldSymbol
abstract fun referenceProperty(declaration: Property): IrPropertySymbol
abstract fun referenceSimpleFunction(declaration: Function): IrSimpleFunctionSymbol
abstract fun referenceDeclaredFunction(declaration: Function): IrSimpleFunctionSymbol
abstract fun referenceValueParameter(declaration: ValueParameter): IrValueParameterSymbol
abstract fun referenceTypeParameter(declaration: TypeParameter): IrTypeParameterSymbol
abstract fun referenceScopedTypeParameter(declaration: TypeParameter): IrTypeParameterSymbol
abstract fun referenceTypeAlias(declaration: TypeAlias): IrTypeAliasSymbol
}
typealias SymbolFactory = (Declaration, IdSignature?) -> Symbol
typealias OwnerFactory = (Symbol) -> SymbolOwner
@OptIn(SymbolTableInternals::class)
abstract class SymbolTableExtension<
Declaration, Class, TypeAlias, Script, Function, Constructor,
Property, ValueParameter, TypeParameter,
>(
val table: SymbolTable,
) : ReferenceSymbolTableExtension()
where Class : Declaration,
TypeAlias : Declaration,
Script : Declaration,
Function : Declaration,
Constructor : Declaration,
Property : Declaration,
ValueParameter : Declaration,
TypeParameter : Declaration {
protected val lock: IrLock
get() = table.lock
private val scriptSlice: SymbolTableSlice.Flat