Parcelable: Add CREATOR field (and other generated declarations) in light classes (KT-19300, KT-19853)

This commit is contained in:
Yan Zhulanow
2017-12-16 01:45:54 +09:00
parent 90dff281ba
commit 145ddf3b1f
29 changed files with 129 additions and 66 deletions
@@ -392,10 +392,12 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
if (context.closure != null)
genClosureFields(context.closure, v, typeMapper);
if (state.getClassBuilderMode() == ClassBuilderMode.LIGHT_CLASSES) return;
for (ExpressionCodegenExtension extension : ExpressionCodegenExtension.Companion.getInstances(state.getProject())) {
extension.generateClassSyntheticParts(this);
if (state.getClassBuilderMode() != ClassBuilderMode.LIGHT_CLASSES
|| extension.getShouldGenerateClassSyntheticPartsInLightClassesMode()
) {
extension.generateClassSyntheticParts(this);
}
}
}
@@ -47,4 +47,7 @@ interface ExpressionCodegenExtension {
fun applyFunction(receiver: StackValue, resolvedCall: ResolvedCall<*>, c: Context): StackValue? = null
fun generateClassSyntheticParts(codegen: ImplementationBodyCodegen) {}
val shouldGenerateClassSyntheticPartsInLightClassesMode: Boolean
get() = false
}