Mark linenumber on statement end
This commit is contained in:
@@ -20,6 +20,7 @@ import com.google.common.collect.Lists;
|
|||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import com.intellij.openapi.editor.Document;
|
import com.intellij.openapi.editor.Document;
|
||||||
import com.intellij.openapi.progress.ProcessCanceledException;
|
import com.intellij.openapi.progress.ProcessCanceledException;
|
||||||
|
import com.intellij.openapi.util.TextRange;
|
||||||
import com.intellij.psi.PsiElement;
|
import com.intellij.psi.PsiElement;
|
||||||
import com.intellij.psi.tree.IElementType;
|
import com.intellij.psi.tree.IElementType;
|
||||||
import com.intellij.util.ArrayUtil;
|
import com.intellij.util.ArrayUtil;
|
||||||
@@ -228,7 +229,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
|||||||
throw new IllegalStateException("Inconsistent state: expression saved to a temporary variable is a selector");
|
throw new IllegalStateException("Inconsistent state: expression saved to a temporary variable is a selector");
|
||||||
}
|
}
|
||||||
if (!(selector instanceof JetBlockExpression)) {
|
if (!(selector instanceof JetBlockExpression)) {
|
||||||
markLineNumber(selector);
|
markStartLineNumber(selector);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
if (selector instanceof JetExpression) {
|
if (selector instanceof JetExpression) {
|
||||||
@@ -403,7 +404,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
|||||||
|
|
||||||
gen(elseExpression, asmType);
|
gen(elseExpression, asmType);
|
||||||
|
|
||||||
markExpressionLineNumber(expression, isStatement);
|
markLineNumber(expression, isStatement);
|
||||||
|
|
||||||
v.mark(end);
|
v.mark(end);
|
||||||
|
|
||||||
@@ -662,7 +663,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void afterBody(@NotNull Label loopExit) {
|
public void afterBody(@NotNull Label loopExit) {
|
||||||
markLineNumber(forExpression);
|
markStartLineNumber(forExpression);
|
||||||
|
|
||||||
increment(loopExit);
|
increment(loopExit);
|
||||||
|
|
||||||
@@ -1220,7 +1221,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
|||||||
v.mark(elseLabel);
|
v.mark(elseLabel);
|
||||||
StackValue.putUnitInstance(v);
|
StackValue.putUnitInstance(v);
|
||||||
|
|
||||||
markLineNumber(ifExpression);
|
markStartLineNumber(ifExpression);
|
||||||
v.mark(end);
|
v.mark(end);
|
||||||
return StackValue.onStack(targetType);
|
return StackValue.onStack(targetType);
|
||||||
}
|
}
|
||||||
@@ -1547,16 +1548,15 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void markExpressionLineNumber(@NotNull JetElement element, boolean isStatement) {
|
public void markStartLineNumber(@NotNull JetElement element) {
|
||||||
if (!isStatement) {
|
markLineNumber(element, false);
|
||||||
markLineNumber(element);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void markLineNumber(@NotNull JetElement statement) {
|
public void markLineNumber(@NotNull JetElement statement, boolean markEndOffset) {
|
||||||
Document document = statement.getContainingFile().getViewProvider().getDocument();
|
Document document = statement.getContainingFile().getViewProvider().getDocument();
|
||||||
if (document != null) {
|
if (document != null) {
|
||||||
int lineNumber = document.getLineNumber(statement.getTextRange().getStartOffset()); // 0-based
|
TextRange textRange = statement.getTextRange();
|
||||||
|
int lineNumber = document.getLineNumber(markEndOffset ? textRange.getEndOffset() : textRange.getStartOffset()); // 0-based
|
||||||
if (lineNumber == myLastLineNumber) {
|
if (lineNumber == myLastLineNumber) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -3616,7 +3616,7 @@ The "returned" value of try expression with no finally is either the last expres
|
|||||||
generateExceptionTable(defaultCatchStart, defaultCatchRegions, null);
|
generateExceptionTable(defaultCatchStart, defaultCatchRegions, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
markExpressionLineNumber(expression, isStatement);
|
markLineNumber(expression, isStatement);
|
||||||
v.mark(end);
|
v.mark(end);
|
||||||
|
|
||||||
if (!isStatement) {
|
if (!isStatement) {
|
||||||
@@ -3829,7 +3829,7 @@ The "returned" value of try expression with no finally is either the last expres
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
markExpressionLineNumber(expression, isStatement);
|
markLineNumber(expression, isStatement);
|
||||||
v.mark(end);
|
v.mark(end);
|
||||||
|
|
||||||
myFrameMap.leaveTemp(subjectType);
|
myFrameMap.leaveTemp(subjectType);
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ abstract public class SwitchCodegen {
|
|||||||
codegen.putUnitInstanceOntoStackForNonExhaustiveWhen(expression);
|
codegen.putUnitInstanceOntoStackForNonExhaustiveWhen(expression);
|
||||||
}
|
}
|
||||||
|
|
||||||
codegen.markExpressionLineNumber(expression, isStatement);
|
codegen.markLineNumber(expression, isStatement);
|
||||||
v.mark(endLabel);
|
v.mark(endLabel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ LineBreakpoint created at skipClassloader.kt:7
|
|||||||
!JDK_HOME!\bin\java -agentlib:jdwp=transport=dt_socket,address=!HOST_NAME!:!HOST_PORT!,suspend=y,server=n -Dfile.encoding=!FILE_ENCODING! -classpath !APP_PATH!\classes;!KOTLIN_RUNTIME!;!CUSTOM_LIBRARY!;!RT_JAR! skipClassloader.SkipClassloaderPackage
|
!JDK_HOME!\bin\java -agentlib:jdwp=transport=dt_socket,address=!HOST_NAME!:!HOST_PORT!,suspend=y,server=n -Dfile.encoding=!FILE_ENCODING! -classpath !APP_PATH!\classes;!KOTLIN_RUNTIME!;!CUSTOM_LIBRARY!;!RT_JAR! skipClassloader.SkipClassloaderPackage
|
||||||
Connected to the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
|
Connected to the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
|
||||||
skipClassloader.kt:7
|
skipClassloader.kt:7
|
||||||
skipClassloader.kt:5
|
skipClassloader.kt:11
|
||||||
Disconnected from the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
|
Disconnected from the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
|
||||||
|
|
||||||
Process finished with exit code 0
|
Process finished with exit code 0
|
||||||
|
|||||||
Reference in New Issue
Block a user