Don't merge locations in JS source map test cases
Don't merge locations of containing if/while/do..while/for statements with locations of conditions
This commit is contained in:
@@ -71,6 +71,7 @@ class LineCollector : RecursiveJsVisitor() {
|
||||
override fun visitIf(x: JsIf) {
|
||||
withStatement(x) {
|
||||
handleNodeLocation(x)
|
||||
lineNumbersByStatement[x]?.add(-1)
|
||||
x.ifExpression.accept(this)
|
||||
}
|
||||
x.thenStatement.accept(this)
|
||||
@@ -80,6 +81,7 @@ class LineCollector : RecursiveJsVisitor() {
|
||||
override fun visitWhile(x: JsWhile) {
|
||||
withStatement(x) {
|
||||
handleNodeLocation(x)
|
||||
lineNumbersByStatement[x]?.add(-1)
|
||||
x.condition.accept(this)
|
||||
}
|
||||
x.body.accept(this)
|
||||
@@ -94,6 +96,8 @@ class LineCollector : RecursiveJsVisitor() {
|
||||
|
||||
override fun visitFor(x: JsFor) {
|
||||
withStatement(x) {
|
||||
handleNodeLocation(x)
|
||||
lineNumbersByStatement[x]?.add(-1)
|
||||
x.initExpression?.accept(this)
|
||||
x.initVars?.accept(this)
|
||||
x.condition?.accept(this)
|
||||
|
||||
@@ -89,7 +89,7 @@ class LineOutputToStringVisitor(output: TextOutput, val lineCollector: LineColle
|
||||
}
|
||||
else if (statement in lineCollector.lineNumbersByStatement) {
|
||||
p.print("/* ")
|
||||
p.print(lineCollector.lineNumbersByStatement[statement]!!.joinToString(" ") { (it + 1).toString() })
|
||||
p.print(lineCollector.lineNumbersByStatement[statement]!!.filter { it >= 0 }.joinToString(" ") { (it + 1).toString() })
|
||||
p.print(" */ ")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user