|
6 | 6 | package org.jetbrains.kotlin.backend.konan.descriptors
|
7 | 7 |
|
8 | 8 | import org.jetbrains.kotlin.backend.common.atMostOne
|
9 |
| -import org.jetbrains.kotlin.backend.konan.* |
10 |
| -import org.jetbrains.kotlin.backend.konan.ir.* |
11 |
| -import org.jetbrains.kotlin.backend.konan.isObjCClass |
| 9 | +import org.jetbrains.kotlin.backend.konan.KonanFqNames |
| 10 | +import org.jetbrains.kotlin.backend.konan.RuntimeNames |
| 11 | +import org.jetbrains.kotlin.backend.konan.binaryTypeIsReference |
| 12 | +import org.jetbrains.kotlin.backend.konan.ir.getSuperClassNotAny |
| 13 | +import org.jetbrains.kotlin.backend.konan.ir.getSuperInterfaces |
| 14 | +import org.jetbrains.kotlin.backend.konan.isInlinedNative |
12 | 15 | import org.jetbrains.kotlin.backend.konan.llvm.longName
|
13 |
| -import org.jetbrains.kotlin.descriptors.* |
| 16 | +import org.jetbrains.kotlin.descriptors.Modality |
14 | 17 | import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor
|
15 | 18 | import org.jetbrains.kotlin.ir.declarations.*
|
16 | 19 | import org.jetbrains.kotlin.ir.descriptors.IrBuiltIns
|
@@ -39,50 +42,6 @@ internal val IrClass.implementedInterfaces: List<IrClass>
|
39 | 42 | superInterfaces).distinct()
|
40 | 43 | }
|
41 | 44 |
|
42 |
| - |
43 |
| -/** |
44 |
| - * Implementation of given method. |
45 |
| - * |
46 |
| - * TODO: this method is actually a part of resolve and probably duplicates another one |
47 |
| - */ |
48 |
| -internal fun IrSimpleFunction.resolveFakeOverride(allowAbstract: Boolean = false): IrSimpleFunction { |
49 |
| - if (this.isReal) { |
50 |
| - return this |
51 |
| - } |
52 |
| - |
53 |
| - val visited = mutableSetOf<IrSimpleFunction>() |
54 |
| - val realSupers = mutableSetOf<IrSimpleFunction>() |
55 |
| - |
56 |
| - fun findRealSupers(function: IrSimpleFunction) { |
57 |
| - if (function in visited) return |
58 |
| - visited += function |
59 |
| - if (function.isReal) { |
60 |
| - realSupers += function |
61 |
| - } else { |
62 |
| - function.overriddenSymbols.forEach { findRealSupers(it.owner) } |
63 |
| - } |
64 |
| - } |
65 |
| - |
66 |
| - findRealSupers(this) |
67 |
| - |
68 |
| - if (realSupers.size > 1) { |
69 |
| - visited.clear() |
70 |
| - |
71 |
| - fun excludeOverridden(function: IrSimpleFunction) { |
72 |
| - if (function in visited) return |
73 |
| - visited += function |
74 |
| - function.overriddenSymbols.forEach { |
75 |
| - realSupers.remove(it.owner) |
76 |
| - excludeOverridden(it.owner) |
77 |
| - } |
78 |
| - } |
79 |
| - |
80 |
| - realSupers.toList().forEach { excludeOverridden(it) } |
81 |
| - } |
82 |
| - |
83 |
| - return realSupers.first { allowAbstract || it.modality != Modality.ABSTRACT } |
84 |
| -} |
85 |
| - |
86 | 45 | internal val IrFunction.isTypedIntrinsic: Boolean
|
87 | 46 | get() = annotations.hasAnnotation(KonanFqNames.typedIntrinsic)
|
88 | 47 |
|
@@ -143,16 +102,6 @@ private fun IrFunction.needBridgeToAt(target: IrFunction, index: Int)
|
143 | 102 | internal fun IrFunction.needBridgeTo(target: IrFunction)
|
144 | 103 | = (0..this.valueParameters.size + 2).any { needBridgeToAt(target, it) }
|
145 | 104 |
|
146 |
| -internal val IrSimpleFunction.target: IrSimpleFunction |
147 |
| - get() = (if (modality == Modality.ABSTRACT) this else resolveFakeOverride()) |
148 |
| - |
149 |
| -internal val IrFunction.target: IrFunction |
150 |
| - get() = when (this) { |
151 |
| - is IrSimpleFunction -> this.target |
152 |
| - is IrConstructor -> this |
153 |
| - else -> error(this) |
154 |
| -} |
155 |
| - |
156 | 105 | internal enum class BridgeDirection {
|
157 | 106 | NOT_NEEDED,
|
158 | 107 | FROM_VALUE_TYPE,
|
|
0 commit comments