IR: IrFunctionReference.fromSymbolDescriptor
This commit is contained in:
+1
-1
@@ -69,7 +69,7 @@ private class AddContinuationLowering(context: JvmBackendContext) : SuspendLower
|
|||||||
// The only references not yet transformed into objects are inline lambdas; the continuation
|
// The only references not yet transformed into objects are inline lambdas; the continuation
|
||||||
// for those will be taken from the inline functions they are passed to, not the enclosing scope.
|
// for those will be taken from the inline functions they are passed to, not the enclosing scope.
|
||||||
return transformed.retargetToSuspendView(context, null) {
|
return transformed.retargetToSuspendView(context, null) {
|
||||||
IrFunctionReferenceImpl(startOffset, endOffset, type, it, typeArgumentsCount, reflectionTarget, origin)
|
IrFunctionReferenceImpl.fromSymbolOwner(startOffset, endOffset, type, it, typeArgumentsCount, reflectionTarget, origin)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -110,7 +110,7 @@ private class InlineCallableReferenceToLambdaTransformer(
|
|||||||
}
|
}
|
||||||
|
|
||||||
+function
|
+function
|
||||||
+IrFunctionReferenceImpl(
|
+IrFunctionReferenceImpl.fromSymbolOwner(
|
||||||
expression.startOffset,
|
expression.startOffset,
|
||||||
expression.endOffset,
|
expression.endOffset,
|
||||||
field.type,
|
field.type,
|
||||||
@@ -190,7 +190,7 @@ private class InlineCallableReferenceToLambdaTransformer(
|
|||||||
}
|
}
|
||||||
|
|
||||||
+function
|
+function
|
||||||
+IrFunctionReferenceImpl(
|
+IrFunctionReferenceImpl.fromSymbolOwner(
|
||||||
expression.startOffset,
|
expression.startOffset,
|
||||||
expression.endOffset,
|
expression.endOffset,
|
||||||
function.returnType,
|
function.returnType,
|
||||||
|
|||||||
+2
-1
@@ -113,7 +113,8 @@ private class PropertyReferenceLowering(val context: JvmBackendContext) : IrElem
|
|||||||
// Internal underlying vals of inline classes have no getter method
|
// Internal underlying vals of inline classes have no getter method
|
||||||
getter.owner.isInlineClassFieldGetter && getter.owner.visibility == DescriptorVisibilities.INTERNAL
|
getter.owner.isInlineClassFieldGetter && getter.owner.visibility == DescriptorVisibilities.INTERNAL
|
||||||
val origin = if (needsDummySignature) InlineClassAbi.UNMANGLED_FUNCTION_REFERENCE else null
|
val origin = if (needsDummySignature) InlineClassAbi.UNMANGLED_FUNCTION_REFERENCE else null
|
||||||
val reference = IrFunctionReferenceImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, expression.type, getter, 0, getter, origin)
|
val reference =
|
||||||
|
IrFunctionReferenceImpl.fromSymbolOwner(UNDEFINED_OFFSET, UNDEFINED_OFFSET, expression.type, getter, 0, getter, origin)
|
||||||
return irCall(signatureStringIntrinsic).apply { putValueArgument(0, reference) }
|
return irCall(signatureStringIntrinsic).apply { putValueArgument(0, reference) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -492,7 +492,7 @@ class ReflectionReferencesGenerator(statementGenerator: StatementGenerator) : St
|
|||||||
typeArguments: Map<TypeParameterDescriptor, KotlinType>?,
|
typeArguments: Map<TypeParameterDescriptor, KotlinType>?,
|
||||||
origin: IrStatementOrigin?
|
origin: IrStatementOrigin?
|
||||||
): IrFunctionReference =
|
): IrFunctionReference =
|
||||||
IrFunctionReferenceImpl(
|
IrFunctionReferenceImpl.fromSymbolDescriptor(
|
||||||
startOffset, endOffset, type.toIrType(),
|
startOffset, endOffset, type.toIrType(),
|
||||||
symbol,
|
symbol,
|
||||||
typeArgumentsCount = descriptor.typeParametersCount,
|
typeArgumentsCount = descriptor.typeParametersCount,
|
||||||
|
|||||||
+39
-19
@@ -36,25 +36,6 @@ class IrFunctionReferenceImpl(
|
|||||||
override val reflectionTarget: IrFunctionSymbol? = symbol,
|
override val reflectionTarget: IrFunctionSymbol? = symbol,
|
||||||
override val origin: IrStatementOrigin? = null,
|
override val origin: IrStatementOrigin? = null,
|
||||||
) : IrFunctionReference(typeArgumentsCount) {
|
) : IrFunctionReference(typeArgumentsCount) {
|
||||||
@ObsoleteDescriptorBasedAPI
|
|
||||||
constructor(
|
|
||||||
startOffset: Int,
|
|
||||||
endOffset: Int,
|
|
||||||
type: IrType,
|
|
||||||
symbol: IrFunctionSymbol,
|
|
||||||
typeArgumentsCount: Int,
|
|
||||||
reflectionTarget: IrFunctionSymbol?,
|
|
||||||
origin: IrStatementOrigin? = null
|
|
||||||
) : this(
|
|
||||||
startOffset, endOffset,
|
|
||||||
type,
|
|
||||||
symbol,
|
|
||||||
typeArgumentsCount,
|
|
||||||
symbol.descriptor.valueParameters.size,
|
|
||||||
reflectionTarget,
|
|
||||||
origin
|
|
||||||
)
|
|
||||||
|
|
||||||
override val referencedName: Name
|
override val referencedName: Name
|
||||||
get() = symbol.owner.name
|
get() = symbol.owner.name
|
||||||
|
|
||||||
@@ -92,4 +73,43 @@ class IrFunctionReferenceImpl(
|
|||||||
argumentsByParameterIndex[i] = irExpression?.transform(transformer, data)
|
argumentsByParameterIndex[i] = irExpression?.transform(transformer, data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
@ObsoleteDescriptorBasedAPI
|
||||||
|
fun fromSymbolDescriptor(
|
||||||
|
startOffset: Int,
|
||||||
|
endOffset: Int,
|
||||||
|
type: IrType,
|
||||||
|
symbol: IrFunctionSymbol,
|
||||||
|
typeArgumentsCount: Int,
|
||||||
|
reflectionTarget: IrFunctionSymbol?,
|
||||||
|
origin: IrStatementOrigin? = null
|
||||||
|
) = IrFunctionReferenceImpl(
|
||||||
|
startOffset, endOffset,
|
||||||
|
type,
|
||||||
|
symbol,
|
||||||
|
typeArgumentsCount,
|
||||||
|
symbol.descriptor.valueParameters.size,
|
||||||
|
reflectionTarget,
|
||||||
|
origin
|
||||||
|
)
|
||||||
|
|
||||||
|
fun fromSymbolOwner(
|
||||||
|
startOffset: Int,
|
||||||
|
endOffset: Int,
|
||||||
|
type: IrType,
|
||||||
|
symbol: IrFunctionSymbol,
|
||||||
|
typeArgumentsCount: Int,
|
||||||
|
reflectionTarget: IrFunctionSymbol?,
|
||||||
|
origin: IrStatementOrigin? = null
|
||||||
|
) = IrFunctionReferenceImpl(
|
||||||
|
startOffset, endOffset,
|
||||||
|
type,
|
||||||
|
symbol,
|
||||||
|
typeArgumentsCount,
|
||||||
|
symbol.owner.valueParameters.size,
|
||||||
|
reflectionTarget,
|
||||||
|
origin
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user