Fix for KT-6202: Redundant and wrong linenumber after if/else condition
#KT-6202 Fixed
This commit is contained in:
@@ -403,7 +403,8 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
||||
|
||||
gen(elseExpression, asmType);
|
||||
|
||||
markLineNumber(expression);
|
||||
markExpressionLineNumber(expression, isStatement);
|
||||
|
||||
v.mark(end);
|
||||
|
||||
return StackValue.onStack(asmType);
|
||||
@@ -1216,10 +1217,10 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
||||
Label end = new Label();
|
||||
v.goTo(end);
|
||||
|
||||
markLineNumber(ifExpression);
|
||||
v.mark(elseLabel);
|
||||
StackValue.putUnitInstance(v);
|
||||
|
||||
markLineNumber(ifExpression);
|
||||
v.mark(end);
|
||||
return StackValue.onStack(targetType);
|
||||
}
|
||||
@@ -1546,6 +1547,12 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
||||
});
|
||||
}
|
||||
|
||||
public void markExpressionLineNumber(@NotNull JetElement element, boolean isStatement) {
|
||||
if (!isStatement) {
|
||||
markLineNumber(element);
|
||||
}
|
||||
}
|
||||
|
||||
public void markLineNumber(@NotNull JetElement statement) {
|
||||
Document document = statement.getContainingFile().getViewProvider().getDocument();
|
||||
if (document != null) {
|
||||
@@ -3609,7 +3616,7 @@ The "returned" value of try expression with no finally is either the last expres
|
||||
generateExceptionTable(defaultCatchStart, defaultCatchRegions, null);
|
||||
}
|
||||
|
||||
markLineNumber(expression);
|
||||
markExpressionLineNumber(expression, isStatement);
|
||||
v.mark(end);
|
||||
|
||||
if (!isStatement) {
|
||||
@@ -3822,7 +3829,7 @@ The "returned" value of try expression with no finally is either the last expres
|
||||
}
|
||||
}
|
||||
|
||||
markLineNumber(expression);
|
||||
markExpressionLineNumber(expression, isStatement);
|
||||
v.mark(end);
|
||||
|
||||
myFrameMap.leaveTemp(subjectType);
|
||||
|
||||
@@ -86,7 +86,7 @@ abstract public class SwitchCodegen {
|
||||
codegen.putUnitInstanceOntoStackForNonExhaustiveWhen(expression);
|
||||
}
|
||||
|
||||
codegen.markLineNumber(expression);
|
||||
codegen.markExpressionLineNumber(expression, isStatement);
|
||||
v.mark(endLabel);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user