[K/JS] Remove the possibility to have negative lines and columns in Source Maps

This commit is contained in:
Artem Kobzar
2023-03-06 16:55:26 +00:00
committed by Space Team
parent f2c1145462
commit 26f6661d1e
4 changed files with 29 additions and 12 deletions
@@ -1395,4 +1395,16 @@ fun IrFunction.getAdapteeFromAdaptedForReferenceFunction() : IrFunction? {
if (call is IrReturnableBlock) return (call.inlineFunctionSymbol ?: unknownStructure()).owner
if (call !is IrFunctionAccessExpression) { unknownStructure() }
return call.symbol.owner
}
}
/**
* 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]
*/
val Int.previousOffset
get(): Int =
when (compareTo(0)) {
0 -> 0
-1 -> UNDEFINED_OFFSET
else -> minus(1)
}