Add hack to make JS coercion compatible with older versions of stdlib

This commit is contained in:
Alexey Andreev
2017-09-06 17:25:41 +03:00
parent 0acc96c4f3
commit c90c3e4bf5
@@ -191,8 +191,17 @@ class FunctionReader(
private fun readFunctionFromSource(descriptor: CallableDescriptor, info: ModuleInfo): FunctionWithWrapper? {
val source = info.fileContent
val tag = Namer.getFunctionTag(descriptor, config)
val index = source.indexOf(tag)
var tag = Namer.getFunctionTag(descriptor, config)
val tagForModule = tag
var index = source.indexOf(tag)
// Hack for compatibility with old versions of stdlib
// TODO: remove in 1.2
if (index < 0 && tag == "kotlin.untypedCharArrayF") {
tag = "kotlin.charArrayF"
index = source.indexOf(tag)
}
if (index < 0) return null
// + 1 for closing quote
@@ -218,7 +227,7 @@ class FunctionReader(
else {
FunctionWithWrapper(functionExpr, null)
}
val moduleReference = moduleNameMap[tag]?.deepCopy() ?: currentModuleName.makeRef()
val moduleReference = moduleNameMap[tagForModule]?.deepCopy() ?: currentModuleName.makeRef()
val wrapperStatements = wrapper?.statements?.filter { it !is JsReturn }
val sourceMap = info.sourceMap