[JS FIR] Do not verify typealias JS name
Since typealiases are not present in the generated JS code, there is no need to verify their JS names. ^KT-64463 Fixed
This commit is contained in:
committed by
Space Team
parent
a97518a903
commit
871f04e08c
+5
@@ -8,6 +8,7 @@ package org.jetbrains.kotlin.fir.analysis.js.checkers
|
|||||||
import org.jetbrains.kotlin.descriptors.Visibilities
|
import org.jetbrains.kotlin.descriptors.Visibilities
|
||||||
import org.jetbrains.kotlin.fir.FirSession
|
import org.jetbrains.kotlin.fir.FirSession
|
||||||
import org.jetbrains.kotlin.fir.analysis.checkers.getContainingClassSymbol
|
import org.jetbrains.kotlin.fir.analysis.checkers.getContainingClassSymbol
|
||||||
|
import org.jetbrains.kotlin.fir.declarations.FirTypeAlias
|
||||||
import org.jetbrains.kotlin.fir.declarations.utils.*
|
import org.jetbrains.kotlin.fir.declarations.utils.*
|
||||||
import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol
|
import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol
|
||||||
import org.jetbrains.kotlin.fir.symbols.impl.*
|
import org.jetbrains.kotlin.fir.symbols.impl.*
|
||||||
@@ -47,6 +48,10 @@ internal data class FirJsStableName(
|
|||||||
when (symbol) {
|
when (symbol) {
|
||||||
is FirConstructorSymbol -> return null
|
is FirConstructorSymbol -> return null
|
||||||
is FirPropertyAccessorSymbol -> return null
|
is FirPropertyAccessorSymbol -> return null
|
||||||
|
// Skip type aliases since they cannot be external, cannot be exported to JavaScript, and cannot be marked with @JsName.
|
||||||
|
// Furthermore, in the generated JavaScript code, all type alias declarations are removed,
|
||||||
|
// and their usages are replaced with the aliased types.
|
||||||
|
is FirTypeAliasSymbol -> return null
|
||||||
}
|
}
|
||||||
|
|
||||||
val hasStableNameInJavaScript = when {
|
val hasStableNameInJavaScript = when {
|
||||||
|
|||||||
-6
@@ -34,12 +34,6 @@ object FirJsNameClashFileTopLevelDeclarationsChecker : FirFileChecker() {
|
|||||||
override fun check(declaration: FirFile, context: CheckerContext, reporter: DiagnosticReporter) {
|
override fun check(declaration: FirFile, context: CheckerContext, reporter: DiagnosticReporter) {
|
||||||
val topLevelDeclarationsWithStableName = mutableMapOf<String, MutableList<FirJsStableName>>()
|
val topLevelDeclarationsWithStableName = mutableMapOf<String, MutableList<FirJsStableName>>()
|
||||||
for (topLevelDeclaration in declaration.declarations) {
|
for (topLevelDeclaration in declaration.declarations) {
|
||||||
if (topLevelDeclaration is FirTypeAlias) {
|
|
||||||
// Skip type aliases since they cannot be external, cannot be exported to JavaScript, and cannot be marked with @JsName.
|
|
||||||
// Furthermore, in the generated JavaScript code, all type alias declarations are removed,
|
|
||||||
// and their usages are replaced with the aliased types.
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
topLevelDeclarationsWithStableName.addStableName(topLevelDeclaration.symbol, context)
|
topLevelDeclarationsWithStableName.addStableName(topLevelDeclaration.symbol, context)
|
||||||
if (topLevelDeclaration is FirClass) {
|
if (topLevelDeclaration is FirClass) {
|
||||||
for (classConstructor in topLevelDeclaration.constructors(context.session)) {
|
for (classConstructor in topLevelDeclaration.constructors(context.session)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user