[JS IR] don't inline property accessors across files

This commit is contained in:
Anton Bannykh
2021-10-21 12:37:30 +03:00
committed by TeamCityServer
parent bdf31b8e52
commit 1f55dc73d2
@@ -19,22 +19,28 @@ class JsPropertyAccessorInlineLowering(
if (!isSafeToInlineInClosedWorld())
return false
if (isConst)
return true
// TODO: teach the deserializer to load constant property initializers
val accessFile = accessContainer.fileOrNull ?: return false
val file = fileOrNull ?: return false
return when (context.granularity) {
JsGenerationGranularity.WHOLE_PROGRAM ->
true
JsGenerationGranularity.PER_MODULE -> {
val accessModule = accessContainer.fileOrNull?.module ?: return false
val module = fileOrNull?.module ?: return false
accessModule == module
}
JsGenerationGranularity.PER_FILE ->
// Not inlining because
// 1. we need a way to distinguish per-file generation units
// 2. per-file mode intended for debug builds only at the moment
false
}
return accessFile == file
// if (isConst)
// return true
//
// return when (context.granularity) {
// JsGenerationGranularity.WHOLE_PROGRAM ->
// true
// JsGenerationGranularity.PER_MODULE -> {
// val accessModule = accessContainer.fileOrNull?.module ?: return false
// val module = fileOrNull?.module ?: return false
// accessModule == module
// }
// JsGenerationGranularity.PER_FILE ->
// // Not inlining because
// // 1. we need a way to distinguish per-file generation units
// // 2. per-file mode intended for debug builds only at the moment
// false
// }
}
}