JVM_IR: Generate fake inlining local variables for debugging.

This commit is contained in:
Mads Ager
2019-11-28 15:10:09 +01:00
committed by max-kammerer
parent fa8cb7b6e0
commit e2a1cb1077
9 changed files with 109 additions and 10 deletions
@@ -30,15 +30,25 @@ abstract class AbstractIrCheckLocalVariablesTableTest : AbstractCheckLocalVariab
private fun getActualVariablesAsList(list: List<LocalVariable>): List<String> {
return list.map { it.toString() }
.map { line -> line.replaceFirst("INDEX=\\d+".toRegex(), "INDEX=*") } // Ignore index
// Ignore local index.
.map { line -> line.replaceFirst("INDEX=\\d+".toRegex(), "INDEX=*") }
// Ignore the names of local functions which have integer names in
// the current backend and more descriptive names with the JVM_IR
// backend.
.map { line -> line.replace("\\\$\\d+".toRegex(), "\\\$*") }
.map { line -> line.replace("\\\$lambda-\\d+".toRegex(), "\\\$*") }
.sorted()
}
private fun getExpectedVariablesAsList(testFile: File): List<String> {
return testFile.readLines()
.filter { line -> line.startsWith("// VARIABLE ") }
.filter { !it.contains("NAME=\$i\$") }
.map { line -> line.replaceFirst("INDEX=\\d+".toRegex(), "INDEX=*") } // Ignore index
// Ignore local index.
.map { line -> line.replaceFirst("INDEX=\\d+".toRegex(), "INDEX=*") }
// Ignore the names of local functions which have integer names in
// the current backend and more descriptive names with the JVM_IR
// backend.
.map { line -> line.replace("\\\$\\d+".toRegex(), "\\\$*") }
.sorted()
}