Fix source element for JsSwitch generated from 'when'
Before this change we set JsSwitch source to subject's JsExpression. We ignore these types of source elements during: 1. js ast serialization (see 'JsAstSerializer.extractLocation'); 2. source map generation (see 'SourceMapBuilderConsumer.addMapping'). However we might add indent during source generation (see 'JsToStringGenerationVisitor.pushSourceInfo'). That seemingly broken 'testEnumEntryRemoved' in 'IncrementalJsCompilerRunnerTestGenerated.ClassHierarchyAffected', because deserialized ast during incremental build would not have source element at all (JsExpression was ignored), but ast during rebuild would have JsExpression source element.
This commit is contained in:
@@ -163,7 +163,7 @@ private constructor(private val whenExpression: KtWhenExpression, context: Trans
|
|||||||
lastEntry.statements += JsBreak().apply { source = entry }
|
lastEntry.statements += JsBreak().apply { source = entry }
|
||||||
members
|
members
|
||||||
}
|
}
|
||||||
Pair(JsSwitch(subjectSupplier(), switchEntries).apply { source = expression }, nextIndex)
|
Pair(JsSwitch(subjectSupplier(), switchEntries).apply { source = whenExpression }, nextIndex)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
null
|
null
|
||||||
|
|||||||
@@ -18,4 +18,4 @@ fun box(x: Int) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// LINES: 19 4 4 3 4 6 9 9 6 11 13 13 11 16 16 3 2
|
// LINES: 19 4 4 3 3 4 6 9 9 6 11 13 13 11 16 16 3 2
|
||||||
Reference in New Issue
Block a user