[K/JS] Add previousOffset to InteropCallableReferenceLowering + include SYNTHETIC_OFFSET branch into previousOffset calculation
This commit is contained in:
+3
-3
@@ -408,12 +408,12 @@ class InteropCallableReferenceLowering(val context: JsIrBackendContext) : BodyLo
|
||||
|
||||
if (invokeFun.returnType.isUnit()) {
|
||||
val unitValue = JsIrBuilder.buildGetObjectValue(context.irBuiltIns.unitType, context.irBuiltIns.unitClass)
|
||||
// Set both offsets of the IrReturn to body.endOffset - 1 so that a breakpoint set at the closing brace of a lambda expression
|
||||
// Set both offsets of the IrReturn to body.previousOffset so that a breakpoint set at the closing brace of a lambda expression
|
||||
// could be hit.
|
||||
body.statements.add(
|
||||
IrReturnImpl(
|
||||
body.endOffset - 1,
|
||||
body.endOffset - 1,
|
||||
body.endOffset.previousOffset,
|
||||
body.endOffset.previousOffset,
|
||||
context.irBuiltIns.nothingType,
|
||||
lambdaDeclaration.symbol,
|
||||
unitValue
|
||||
|
||||
@@ -1394,14 +1394,15 @@ val IrFunction.isValueClassTypedEquals: Boolean
|
||||
|
||||
/**
|
||||
* The method is used to calculate the previous offset from the current one to prevent situations when it can calculate
|
||||
* [UNDEFINED_OFFSET] from 0 offset and -2 offset from the [UNDEFINED OFFSET]
|
||||
* [UNDEFINED_OFFSET] from 0 offset and [SYNTHETIC_OFFSET] offset from the [UNDEFINED OFFSET]
|
||||
*/
|
||||
val Int.previousOffset
|
||||
get(): Int =
|
||||
when (compareTo(0)) {
|
||||
when (this) {
|
||||
0 -> 0
|
||||
-1 -> UNDEFINED_OFFSET
|
||||
else -> minus(1)
|
||||
UNDEFINED_OFFSET -> UNDEFINED_OFFSET
|
||||
SYNTHETIC_OFFSET -> SYNTHETIC_OFFSET
|
||||
else -> if (this > 0) minus(1) else error("Invalid offset appear")
|
||||
}
|
||||
|
||||
fun IrAttributeContainer.extractRelatedDeclaration(): IrDeclaration? {
|
||||
@@ -1411,4 +1412,4 @@ fun IrAttributeContainer.extractRelatedDeclaration(): IrDeclaration? {
|
||||
is IrFunctionReference -> symbol.owner
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user