[IR Test] Properly create empty dump for IR files witout source

This commit is contained in:
Dmitriy Novozhilov
2021-12-06 14:49:41 +03:00
committed by TeamCityServer
parent de783ad51f
commit 3519543831
3 changed files with 2 additions and 4 deletions
@@ -37,12 +37,13 @@ fun IrElement.dump(normalizeNames: Boolean = false, stableOrder: Boolean = false
}
fun IrFile.dumpTreesFromLineNumber(lineNumber: Int, normalizeNames: Boolean = false): String {
if (shouldSkipDump()) return ""
val sb = StringBuilder()
accept(DumpTreeFromSourceLineVisitor(fileEntry, lineNumber, sb, normalizeNames), null)
return sb.toString()
}
fun IrFile.shouldSkipDump(): Boolean {
private fun IrFile.shouldSkipDump(): Boolean {
val entry = fileEntry as? NaiveSourceBasedFileEntryImpl ?: return false
return entry.lineStartOffsetsAreEmpty
}