[K2, JS] Don't fail on missing JS module kind service in IDE
There's no module kind check for IDE at the moment: IDE modules don't have access to compiler arguments or configuration. K1 currently doesn't report the diagnostic either. See KTIJ-27279 for more details. This commit repeats K1 behaviour: K2 IDE won't fail because of the missing service, but the diagnostic won't be reported in IDE, only during compilation. KT-61615
This commit is contained in:
committed by
Space Team
parent
da385210d8
commit
80832ddae1
+4
-5
@@ -22,11 +22,10 @@ import org.jetbrains.kotlin.serialization.js.ModuleKind
|
|||||||
@NoMutableState
|
@NoMutableState
|
||||||
class FirJsModuleKind(val moduleKind: ModuleKind) : FirSessionComponent
|
class FirJsModuleKind(val moduleKind: ModuleKind) : FirSessionComponent
|
||||||
|
|
||||||
private val FirSession.jsModuleKindComponent: FirJsModuleKind by FirSession.sessionComponentAccessor()
|
private val FirSession.jsModuleKindComponent: FirJsModuleKind? by FirSession.nullableSessionComponentAccessor()
|
||||||
|
|
||||||
private val FirSession.jsModuleKind: ModuleKind
|
|
||||||
get() = jsModuleKindComponent.moduleKind
|
|
||||||
|
|
||||||
|
private val FirSession.jsModuleKind: ModuleKind?
|
||||||
|
get() = jsModuleKindComponent?.moduleKind
|
||||||
|
|
||||||
internal fun checkJsModuleUsage(
|
internal fun checkJsModuleUsage(
|
||||||
callee: FirBasedSymbol<*>,
|
callee: FirBasedSymbol<*>,
|
||||||
@@ -34,7 +33,7 @@ internal fun checkJsModuleUsage(
|
|||||||
reporter: DiagnosticReporter,
|
reporter: DiagnosticReporter,
|
||||||
source: AbstractKtSourceElement?
|
source: AbstractKtSourceElement?
|
||||||
) {
|
) {
|
||||||
val moduleKind = context.session.jsModuleKind
|
val moduleKind = context.session.jsModuleKind ?: return
|
||||||
|
|
||||||
val calleeSession = callee.moduleData.session
|
val calleeSession = callee.moduleData.session
|
||||||
val calleeRoot = getRootClassLikeSymbolOrSelf(callee, calleeSession)
|
val calleeRoot = getRootClassLikeSymbolOrSelf(callee, calleeSession)
|
||||||
|
|||||||
Reference in New Issue
Block a user