Skip to content

Commit

Permalink
[Wasm] Streamline a visitor method
Browse files Browse the repository at this point in the history
Visitors are not supposed to override two similar methods
at the same time.
  • Loading branch information
broadwaylamb authored and Space Team committed Dec 20, 2024
1 parent 15fbaac commit 9df698e
Showing 1 changed file with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -951,21 +951,17 @@ class BodyGenerator(
}

override fun visitInlinedFunctionBlock(inlinedBlock: IrInlinedFunctionBlock) {
body.buildNop(inlinedBlock.getSourceLocation())

functionContext.stepIntoInlinedFunction(inlinedBlock.inlineFunctionSymbol, inlinedBlock.fileEntry)
super.visitInlinedFunctionBlock(inlinedBlock)
functionContext.stepOutLastInlinedFunction()
}

override fun visitInlinedFunctionBlock(inlinedBlock: IrInlinedFunctionBlock, data: Nothing?) {
val inlineFunction = inlinedBlock.inlineFunctionSymbol?.owner
val correspondingProperty = (inlineFunction as? IrSimpleFunction)?.correspondingPropertySymbol
val owner = correspondingProperty?.owner ?: inlineFunction
val name = owner?.fqNameWhenAvailable?.asString() ?: owner?.name?.asString() ?: "UNKNOWN"

body.commentGroupStart { "Inlined call of `$name`" }
super.visitInlinedFunctionBlock(inlinedBlock, data)
body.buildNop(inlinedBlock.getSourceLocation())

functionContext.stepIntoInlinedFunction(inlinedBlock.inlineFunctionSymbol, inlinedBlock.fileEntry)
super.visitInlinedFunctionBlock(inlinedBlock)
functionContext.stepOutLastInlinedFunction()
}

override fun visitReturnableBlock(expression: IrReturnableBlock) {
Expand Down

0 comments on commit 9df698e

Please # to comment.