[JS BE] Do not produce source mapping for fake KtElement

Fix [KT-26701], [KT-12935]
This commit is contained in:
Roman Artemev
2019-07-12 18:38:47 +03:00
committed by romanart
parent 12736edfc1
commit af45e1c5dc
7 changed files with 18 additions and 8 deletions
@@ -26,6 +26,7 @@ import org.jetbrains.kotlin.js.backend.ast.JsLocationWithSource;
import org.jetbrains.kotlin.js.sourceMap.SourceFilePathResolver;
import org.jetbrains.kotlin.js.sourceMap.SourceMapMappingConsumer;
import org.jetbrains.kotlin.js.translate.utils.PsiUtils;
import org.jetbrains.kotlin.resolve.calls.callUtil.CallUtilKt;
import java.io.*;
import java.nio.charset.Charset;
@@ -87,6 +88,7 @@ public class SourceMapBuilderConsumer implements SourceLocationConsumer {
}
if (sourceInfo instanceof PsiElement) {
PsiElement element = (PsiElement) sourceInfo;
if (CallUtilKt.isFakePsiElement(element)) return;
try {
JsLocation location = PsiUtils.extractLocationFromPsi(element, pathResolver);
PsiFile psiFile = element.getContainingFile();
+1 -1
View File
@@ -14,4 +14,4 @@ suspend fun bar(): Unit {
println(a + b)
}
// LINES: 38 4 4 4 5 5 44 44 5 89 44 5 5 6 4 4 4 15 9 9 9 * 15 10 10 11 11 11 2 11 11 * 11 12 12 13 13 13 2 13 13 13 13 14 14 * 15 9 9 9 9
// LINES: 38 4 4 4 5 5 44 44 5 89 44 5 5 6 4 4 4 15 9 9 9 * 15 10 10 11 11 11 11 11 * 11 12 12 13 13 13 13 13 13 13 14 14 * 15 9 9 9 9
@@ -8,4 +8,4 @@ suspend fun foo() {
suspend fun delay() {
}
// LINES: 6 1 1 * 6 2 2 2 2 2 * 3 3 4 4 4 2 4 4 5 5 * 6 1 1 1 1 9
// LINES: 6 1 1 * 6 2 2 2 2 2 * 3 3 4 4 4 4 4 5 5 * 6 1 1 1 1 9
+1 -1
View File
@@ -15,4 +15,4 @@ class B {
}
}
// LINES: 3 4 5 * 4 4 4 2 * 8 11 10 10 15 14 14
// LINES: 3 4 5 * 4 4 4 * 8 11 10 10 15 14 14