Native: remove harmful assertions from NaiveSourceBasedFileEntryImpl
These assertions checked that nobody requests line and column number for the UNDEFINED_OFFSET. But diagnostic and crash reporting tools might request line and column, and crashing during crash reporting is not great. So handle UNDEFINED_OFFSET gracefully instead, in a conventional manner.
This commit is contained in:
committed by
Space
parent
ab7615adaf
commit
3fd4d90cca
@@ -206,14 +206,14 @@ class NaiveSourceBasedFileEntryImpl(
|
||||
}
|
||||
|
||||
override fun getLineNumber(offset: Int): Int {
|
||||
assert(offset != UNDEFINED_OFFSET)
|
||||
if (offset == SYNTHETIC_OFFSET) return 0
|
||||
if (offset < 0) return -1
|
||||
return calculatedBeforeLineNumbers.get(offset)
|
||||
}
|
||||
|
||||
override fun getColumnNumber(offset: Int): Int {
|
||||
assert(offset != UNDEFINED_OFFSET)
|
||||
if (offset == SYNTHETIC_OFFSET) return 0
|
||||
if (offset < 0) return -1
|
||||
val lineNumber = getLineNumber(offset)
|
||||
return offset - lineStartOffsets[lineNumber]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user