Generate linenumber for inline call site in case of implicit iterator/hasNext/next calls in for loop

Otherwise -1 is generated in smap
This commit is contained in:
Mikhael Bogdanov
2021-01-20 16:53:57 +01:00
parent dfacccf84f
commit de00f72fa3
12 changed files with 115 additions and 0 deletions
@@ -742,7 +742,11 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
// Some forms of for-loop can be optimized as post-condition loops.
PseudoInsnsKt.fakeAlwaysFalseIfeq(v, continueLabel);
// Renew line number cause it could be reset by inline (resetLastLineNumber) in generator.checkPreCondition(loopExit).
markStartLineNumber(generator.getForExpression());
v.nop();
generator.beforeBody();
blockStackElements.push(new LoopBlockStackElement(loopExit, continueLabel, targetLabel(generator.getForExpression())));
generator.body();
blockStackElements.pop();