Debugger: Generate line numbers for class initializers with a number on the 'init' keyword (KT-16277)
Debugger tests not absent as they use the bootstrap version of kotlinc. Obviously, this change is not present in it yet.
This commit is contained in:
@@ -1473,7 +1473,7 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
||||
markLineNumber(element, false);
|
||||
}
|
||||
|
||||
public void markLineNumber(@NotNull KtElement statement, boolean markEndOffset) {
|
||||
public void markLineNumber(@NotNull PsiElement statement, boolean markEndOffset) {
|
||||
if (!shouldMarkLineNumbers) return;
|
||||
|
||||
Integer lineNumber = CodegenUtil.getLineNumberForElement(statement, markEndOffset);
|
||||
|
||||
@@ -507,9 +507,18 @@ public abstract class MemberCodegen<T extends KtPureElement/* TODO: & KtDeclarat
|
||||
if (i == declarations.size() - 1 && this instanceof ScriptCodegen) {
|
||||
bodyExpressionType = expressionCodegen.expressionType(body);
|
||||
}
|
||||
|
||||
if (declaration instanceof KtClassInitializer) {
|
||||
KtClassInitializer classInitializer = (KtClassInitializer) declaration;
|
||||
expressionCodegen.markLineNumber(classInitializer.getInitKeyword(), true);
|
||||
expressionCodegen.v.nop();
|
||||
}
|
||||
|
||||
expressionCodegen.gen(body, bodyExpressionType);
|
||||
expressionCodegen.markLineNumber(declaration, true);
|
||||
nopSeparatorNeeded = true;
|
||||
if (declaration instanceof KtClassInitializer) {
|
||||
expressionCodegen.markLineNumber(declaration, true);
|
||||
nopSeparatorNeeded = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user