[PSI2IR] Check that a given function has the right descriptor
The issue was discovered during work on IR serialization and this is just a safety check. #KT-56230
This commit is contained in:
@@ -87,6 +87,14 @@ internal class FunctionGenerator(declarationGenerator: DeclarationGenerator) : D
|
|||||||
generateBody: BodyGenerator.() -> IrBody?
|
generateBody: BodyGenerator.() -> IrBody?
|
||||||
): IrSimpleFunction =
|
): IrSimpleFunction =
|
||||||
declareSimpleFunctionInner(descriptor, ktFunction, origin).buildWithScope { irFunction ->
|
declareSimpleFunctionInner(descriptor, ktFunction, origin).buildWithScope { irFunction ->
|
||||||
|
if (descriptor != irFunction.descriptor) {
|
||||||
|
val message = """
|
||||||
|
|IrSymbolTable contains function with wrong descriptor.
|
||||||
|
|Expected: $descriptor
|
||||||
|
|Actual: ${irFunction.descriptor}
|
||||||
|
""".trimMargin()
|
||||||
|
error(message)
|
||||||
|
}
|
||||||
generateFunctionParameterDeclarationsAndReturnType(irFunction, ktFunction, ktReceiver, ktContextReceivers)
|
generateFunctionParameterDeclarationsAndReturnType(irFunction, ktFunction, ktReceiver, ktContextReceivers)
|
||||||
irFunction.body = createBodyGenerator(irFunction.symbol, parentLoopResolver).generateBody()
|
irFunction.body = createBodyGenerator(irFunction.symbol, parentLoopResolver).generateBody()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user