Migrate descriptor-related util from IR to FE1.0
so that FE1.0 UAST can avoid depending on backend IR ^KTIJ-23602
This commit is contained in:
@@ -27,4 +27,24 @@ fun PropertyAccessorDescriptor.hasBody(): Boolean {
|
||||
|
||||
fun isBackingFieldReference(descriptor: DeclarationDescriptor?): Boolean {
|
||||
return descriptor is SyntheticFieldDescriptor
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return naturally-ordered list of the parameters that can have values specified at call site.
|
||||
*/
|
||||
val CallableDescriptor.explicitParameters: List<ParameterDescriptor>
|
||||
get() {
|
||||
val result = ArrayList<ParameterDescriptor>(valueParameters.size + 2)
|
||||
|
||||
this.dispatchReceiverParameter?.let {
|
||||
result.add(it)
|
||||
}
|
||||
|
||||
this.extensionReceiverParameter?.let {
|
||||
result.add(it)
|
||||
}
|
||||
|
||||
result.addAll(valueParameters)
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
+1
-24
@@ -16,10 +16,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.backend.common.descriptors
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.CallableDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.ConstructorDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.ParameterDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
|
||||
val String.synthesizedName: Name get() = Name.identifier(this.synthesizedString)
|
||||
@@ -40,23 +37,3 @@ val CallableDescriptor.allParameters: List<ParameterDescriptor>
|
||||
} else {
|
||||
explicitParameters
|
||||
}
|
||||
|
||||
/**
|
||||
* @return naturally-ordered list of the parameters that can have values specified at call site.
|
||||
*/
|
||||
val CallableDescriptor.explicitParameters: List<ParameterDescriptor>
|
||||
get() {
|
||||
val result = ArrayList<ParameterDescriptor>(valueParameters.size + 2)
|
||||
|
||||
this.dispatchReceiverParameter?.let {
|
||||
result.add(it)
|
||||
}
|
||||
|
||||
this.extensionReceiverParameter?.let {
|
||||
result.add(it)
|
||||
}
|
||||
|
||||
result.addAll(valueParameters)
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
-1
@@ -9,7 +9,6 @@ import kotlinx.cinterop.cValuesOf
|
||||
import java.io.PrintWriter
|
||||
import llvm.*
|
||||
import org.jetbrains.kotlin.backend.common.descriptors.allParameters
|
||||
import org.jetbrains.kotlin.backend.common.descriptors.explicitParameters
|
||||
import org.jetbrains.kotlin.backend.common.pop
|
||||
import org.jetbrains.kotlin.backend.common.push
|
||||
import org.jetbrains.kotlin.backend.konan.llvm.*
|
||||
|
||||
+1
-1
@@ -6,7 +6,6 @@
|
||||
package org.jetbrains.kotlin.backend.konan.optimizations
|
||||
|
||||
import org.jetbrains.kotlin.backend.common.IrElementTransformerVoidWithContext
|
||||
import org.jetbrains.kotlin.backend.common.descriptors.explicitParameters
|
||||
import org.jetbrains.kotlin.backend.common.pop
|
||||
import org.jetbrains.kotlin.backend.common.push
|
||||
import org.jetbrains.kotlin.backend.common.lower.createIrBuilder
|
||||
@@ -17,6 +16,7 @@ import org.jetbrains.kotlin.backend.konan.util.IntArrayList
|
||||
import org.jetbrains.kotlin.backend.konan.util.LongArrayList
|
||||
import org.jetbrains.kotlin.backend.konan.lower.getObjectClassInstanceFunction
|
||||
import org.jetbrains.kotlin.descriptors.ClassKind
|
||||
import org.jetbrains.kotlin.descriptors.explicitParameters
|
||||
import org.jetbrains.kotlin.ir.IrElement
|
||||
import org.jetbrains.kotlin.ir.builders.*
|
||||
import org.jetbrains.kotlin.ir.declarations.*
|
||||
|
||||
Reference in New Issue
Block a user