[IR] Add doc comments for KotlinMangleComputer and its inheritors
This commit is contained in:
committed by
Space Team
parent
c447b91101
commit
1651199ed8
+3
@@ -25,6 +25,9 @@ import org.jetbrains.kotlin.fir.symbols.impl.FirTypeParameterSymbol
|
|||||||
import org.jetbrains.kotlin.fir.types.*
|
import org.jetbrains.kotlin.fir.types.*
|
||||||
import org.jetbrains.kotlin.fir.visitors.FirVisitorVoid
|
import org.jetbrains.kotlin.fir.visitors.FirVisitorVoid
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A mangle computer that generates a mangled name for a Kotlin declaration represented by [FirDeclaration].
|
||||||
|
*/
|
||||||
class FirJvmMangleComputer(
|
class FirJvmMangleComputer(
|
||||||
builder: StringBuilder,
|
builder: StringBuilder,
|
||||||
mode: MangleMode,
|
mode: MangleMode,
|
||||||
|
|||||||
+23
-4
@@ -5,9 +5,28 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.backend.common.serialization.mangle
|
package org.jetbrains.kotlin.backend.common.serialization.mangle
|
||||||
|
|
||||||
interface KotlinMangleComputer<D : Any> {
|
/**
|
||||||
|
* Something capable of producing a mangled name for a Kotlin declaration.
|
||||||
|
*
|
||||||
|
* @param Declaration A class representing a Kotlin declaration.
|
||||||
|
*/
|
||||||
|
interface KotlinMangleComputer<Declaration : Any> {
|
||||||
|
|
||||||
fun computeMangle(declaration: D): String
|
/**
|
||||||
|
* Computes the mangled name of [declaration].
|
||||||
|
*
|
||||||
|
* @param declaration The Kotlin declaration to compute a mangle name for.
|
||||||
|
* @return The mangled name of [declaration].
|
||||||
|
*/
|
||||||
|
fun computeMangle(declaration: Declaration): String
|
||||||
|
|
||||||
fun copy(newMode: MangleMode): KotlinMangleComputer<D>
|
/**
|
||||||
}
|
* Creates a copy of this mangle computer with a different mangle mode but otherwise the same state.
|
||||||
|
*
|
||||||
|
* Useful for temporarily switching the mangle mode.
|
||||||
|
*
|
||||||
|
* @param newMode The mangle mode to use in the new mangle computer.
|
||||||
|
* @return A copy of this mangle computer.
|
||||||
|
*/
|
||||||
|
fun copy(newMode: MangleMode): KotlinMangleComputer<Declaration>
|
||||||
|
}
|
||||||
|
|||||||
+3
@@ -15,6 +15,9 @@ import org.jetbrains.kotlin.types.checker.SimpleClassicTypeSystemContext
|
|||||||
import org.jetbrains.kotlin.types.model.TypeSystemContext
|
import org.jetbrains.kotlin.types.model.TypeSystemContext
|
||||||
import org.jetbrains.kotlin.types.typeUtil.isUnit
|
import org.jetbrains.kotlin.types.typeUtil.isUnit
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The descriptor-based mangle computer. Used to compute a mangled name for a declaration given its [DeclarationDescriptor].
|
||||||
|
*/
|
||||||
abstract class DescriptorMangleComputer(builder: StringBuilder, mode: MangleMode) :
|
abstract class DescriptorMangleComputer(builder: StringBuilder, mode: MangleMode) :
|
||||||
BaseKotlinMangleComputer<
|
BaseKotlinMangleComputer<
|
||||||
/*Declaration=*/DeclarationDescriptor,
|
/*Declaration=*/DeclarationDescriptor,
|
||||||
|
|||||||
+3
@@ -16,6 +16,9 @@ import org.jetbrains.kotlin.ir.util.*
|
|||||||
import org.jetbrains.kotlin.ir.visitors.IrElementVisitorVoid
|
import org.jetbrains.kotlin.ir.visitors.IrElementVisitorVoid
|
||||||
import org.jetbrains.kotlin.ir.visitors.acceptVoid
|
import org.jetbrains.kotlin.ir.visitors.acceptVoid
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A mangle computer that generates a mangled name for a Kotlin declaration represented by [IrDeclaration].
|
||||||
|
*/
|
||||||
abstract class IrMangleComputer(
|
abstract class IrMangleComputer(
|
||||||
builder: StringBuilder,
|
builder: StringBuilder,
|
||||||
mode: MangleMode,
|
mode: MangleMode,
|
||||||
|
|||||||
Reference in New Issue
Block a user