[JS IR BE] Generate fileds for all properties
This commit is contained in:
+2
-1
@@ -30,6 +30,7 @@ class PropertiesLowering(
|
|||||||
private val context: BackendContext,
|
private val context: BackendContext,
|
||||||
private val originOfSyntheticMethodForAnnotations: IrDeclarationOrigin? = null,
|
private val originOfSyntheticMethodForAnnotations: IrDeclarationOrigin? = null,
|
||||||
private val skipExternalProperties: Boolean = false,
|
private val skipExternalProperties: Boolean = false,
|
||||||
|
private val generateAnnotationFields: Boolean = false,
|
||||||
private val computeSyntheticMethodName: ((Name) -> String)? = null
|
private val computeSyntheticMethodName: ((Name) -> String)? = null
|
||||||
) : IrElementTransformerVoid(), FileLoweringPass {
|
) : IrElementTransformerVoid(), FileLoweringPass {
|
||||||
override fun lower(irFile: IrFile) {
|
override fun lower(irFile: IrFile) {
|
||||||
@@ -53,7 +54,7 @@ class PropertiesLowering(
|
|||||||
if (skipExternalProperties && declaration.isEffectivelyExternal()) listOf(declaration) else {
|
if (skipExternalProperties && declaration.isEffectivelyExternal()) listOf(declaration) else {
|
||||||
ArrayList<IrDeclaration>(4).apply {
|
ArrayList<IrDeclaration>(4).apply {
|
||||||
// JvmFields in a companion object refer to companion's owners and should not be generated within companion.
|
// JvmFields in a companion object refer to companion's owners and should not be generated within companion.
|
||||||
if (kind != ClassKind.ANNOTATION_CLASS && declaration.backingField?.parent == declaration.parent) {
|
if (generateAnnotationFields || (kind != ClassKind.ANNOTATION_CLASS && declaration.backingField?.parent == declaration.parent)) {
|
||||||
addIfNotNull(declaration.backingField)
|
addIfNotNull(declaration.backingField)
|
||||||
}
|
}
|
||||||
addIfNotNull(declaration.getter)
|
addIfNotNull(declaration.getter)
|
||||||
|
|||||||
@@ -248,7 +248,7 @@ private val varargLoweringPhase = makeJsModulePhase(
|
|||||||
)
|
)
|
||||||
|
|
||||||
private val propertiesLoweringPhase = makeJsModulePhase(
|
private val propertiesLoweringPhase = makeJsModulePhase(
|
||||||
{ context -> PropertiesLowering(context, skipExternalProperties = true) },
|
{ context -> PropertiesLowering(context, skipExternalProperties = true, generateAnnotationFields = true) },
|
||||||
name = "PropertiesLowering",
|
name = "PropertiesLowering",
|
||||||
description = "Move fields and accessors out from its property"
|
description = "Move fields and accessors out from its property"
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user