File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,19 @@ import org.jetbrains.kotlin.name.Name
18
18
import org.jetbrains.kotlin.name.NameUtils.getPackagePartClassNamePrefix
19
19
import java.io.File
20
20
21
+ /* *
22
+ * This does two different things:
23
+ * 1. Copies [IrAttribute]s of element [other] into [this]. Attributes already present on [this] are not removed, attributes present
24
+ * overridden on both [this] and [other] will be overridden in [this]. The semantics is therefore the same as [MutableMap.putAll].
25
+ * 2. Assigns [IrElement.attributeOwnerId] to that of [other].
26
+ *
27
+ * Now, those two operations are not clearly connected to each other, although they have been historically.
28
+ * In particular, [IrElement.attributeOwnerId] has lost much of its meaning since, and is _not_ connected to [IrAttribute]s.
29
+ * But still, _most likely_ you want to do both at the same time, which is what we do here. It should be investigated closer in KT-74295.
30
+ *
31
+ * @param includeAll if `true`, copy all the attributes present in [other],
32
+ * if `false`, only those with [IrAttribute.copyByDefault] == `true`.
33
+ */
21
34
fun IrElement.copyAttributes (other : IrElement , includeAll : Boolean = false) {
22
35
(this as IrElementBase ).copyAttributesFrom(other as IrElementBase , includeAll)
23
36
attributeOwnerId = other.attributeOwnerId
You can’t perform that action at this time.
0 commit comments