Do not preprocess apiVersionIsAtLeast calls inlined into kotlin package

If such call were to be inlined into an inline function in kotlin
package, it would be expanded there preventing the further expansion in
client code.
This commit is contained in:
Ilya Gorbunov
2019-10-11 07:30:53 +03:00
parent 352a10a0ed
commit d91453fb7a
@@ -355,7 +355,10 @@ abstract class InlineCodegen<out T : BaseExpressionCodegen>(
val caller = codegen.context.functionDescriptor
if (!caller.isInline) return false
val callerPackage = DescriptorUtils.getParentOfType(caller, PackageFragmentDescriptor::class.java) ?: return false
return callerPackage.fqName.asString().startsWith("kotlin.")
return callerPackage.fqName.asString().let {
// package either equals to 'kotlin' or starts with 'kotlin.'
it.startsWith("kotlin") && (it.length <= 6 || it[6] == '.')
}
}
private fun generateClosuresBodies() {