aboutsummaryrefslogtreecommitdiff
path: root/kotlin-plugin/src
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-11-09 16:47:31 +0100
committerLinnea Gräf <nea@nea.moe>2024-11-09 16:47:31 +0100
commit32ae3f959d35563396579a24d3989c2496b326b9 (patch)
tree012c84eff3cc38832793bafe5a92cc95d0de92bc /kotlin-plugin/src
parentcb06ffa17537297ea1e8cca1d6fd01d8925d372d (diff)
downloadmcautotranslations-32ae3f959d35563396579a24d3989c2496b326b9.tar.gz
mcautotranslations-32ae3f959d35563396579a24d3989c2496b326b9.tar.bz2
mcautotranslations-32ae3f959d35563396579a24d3989c2496b326b9.zip
fix: Missing translations for standalone classes
Diffstat (limited to 'kotlin-plugin/src')
-rw-r--r--kotlin-plugin/src/main/kotlin/moe/nea/mcautotranslations/kotlin/MCAutoTranslationsCallTransformerAndCollector.kt4
1 files changed, 3 insertions, 1 deletions
diff --git a/kotlin-plugin/src/main/kotlin/moe/nea/mcautotranslations/kotlin/MCAutoTranslationsCallTransformerAndCollector.kt b/kotlin-plugin/src/main/kotlin/moe/nea/mcautotranslations/kotlin/MCAutoTranslationsCallTransformerAndCollector.kt
index fc1acc1..d87648d 100644
--- a/kotlin-plugin/src/main/kotlin/moe/nea/mcautotranslations/kotlin/MCAutoTranslationsCallTransformerAndCollector.kt
+++ b/kotlin-plugin/src/main/kotlin/moe/nea/mcautotranslations/kotlin/MCAutoTranslationsCallTransformerAndCollector.kt
@@ -10,6 +10,7 @@ import org.jetbrains.kotlin.cli.common.messages.MessageCollector
import org.jetbrains.kotlin.ir.builders.irCall
import org.jetbrains.kotlin.ir.builders.irCallConstructor
import org.jetbrains.kotlin.ir.builders.irVararg
+import org.jetbrains.kotlin.ir.declarations.IrClass
import org.jetbrains.kotlin.ir.declarations.IrFile
import org.jetbrains.kotlin.ir.expressions.IrCall
import org.jetbrains.kotlin.ir.expressions.IrConst
@@ -128,7 +129,8 @@ class MCAutoTranslationsCallTransformerAndCollector(
putValueArgument(1, constString(it.value))
}
}
- file.annotations = annotations + file.annotations
+ val annotationContainer = file.declarations.singleOrNull()?.takeIf { it is IrClass } ?: file
+ annotationContainer.annotations = annotations + annotationContainer.annotations
}