[JS IR] Detect broken cross-module references
The patch adds an error if the module can not find the cross-module reference. The patch removes the DCE optimization which eliminates implement() intrinsic, because it leads to a broken cross-module reference and broken JS code with implement() call, albeit in an unreachable block.
This commit is contained in:
committed by
Space Team
parent
e6efde76dc
commit
155777e3fa
+9
@@ -5,8 +5,17 @@
|
||||
|
||||
package org.jetbrains.kotlin.backend.common.serialization
|
||||
|
||||
import org.jetbrains.kotlin.ir.util.IdSignature
|
||||
import java.util.regex.Pattern
|
||||
|
||||
internal val functionPattern = Pattern.compile("^K?(Suspend)?Function\\d+$")
|
||||
|
||||
internal val functionalPackages = listOf("kotlin", "kotlin.coroutines", "kotlin.reflect")
|
||||
|
||||
fun checkIsFunctionInterface(idSig: IdSignature?): Boolean {
|
||||
val publicSig = idSig?.asPublic()
|
||||
return publicSig != null &&
|
||||
publicSig.packageFqName in functionalPackages &&
|
||||
publicSig.declarationFqName.isNotEmpty() &&
|
||||
functionPattern.matcher(publicSig.firstNameSegment).find()
|
||||
}
|
||||
|
||||
-8
@@ -124,14 +124,6 @@ class IrModuleDeserializerWithBuiltIns(
|
||||
symbol.signature to symbol
|
||||
}.toMap()
|
||||
|
||||
private fun checkIsFunctionInterface(idSig: IdSignature): Boolean {
|
||||
val publicSig = idSig.asPublic()
|
||||
return publicSig != null &&
|
||||
publicSig.packageFqName in functionalPackages &&
|
||||
publicSig.declarationFqName.isNotEmpty() &&
|
||||
functionPattern.matcher(publicSig.firstNameSegment).find()
|
||||
}
|
||||
|
||||
override operator fun contains(idSig: IdSignature): Boolean {
|
||||
val topLevel = idSig.topLevelSignature()
|
||||
if (topLevel in irBuiltInsMap) return true
|
||||
|
||||
Reference in New Issue
Block a user