[JS IR] Emit original names for local vars to sourcemaps
#KT-35655 Fixed
This commit is contained in:
committed by
Space Team
parent
8efa72ca36
commit
7b7c517dbb
@@ -19,7 +19,7 @@ package org.jetbrains.kotlin.js.resolve.diagnostics
|
||||
import com.google.gwt.dev.js.parserExceptions.AbortParsingException
|
||||
import com.google.gwt.dev.js.rhino.CodePosition
|
||||
import com.google.gwt.dev.js.rhino.ErrorReporter
|
||||
import com.google.gwt.dev.js.rhino.Utils.isEndOfLine
|
||||
import com.google.gwt.dev.js.rhino.offsetOf
|
||||
import com.intellij.openapi.util.TextRange
|
||||
import com.intellij.psi.PsiElement
|
||||
import org.jetbrains.kotlin.descriptors.CallableDescriptor
|
||||
@@ -148,35 +148,6 @@ class JsCodeErrorReporter(
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates an offset from the start of a text for a position,
|
||||
* defined by line and offset in that line.
|
||||
*/
|
||||
private fun String.offsetOf(position: CodePosition): Int {
|
||||
var i = 0
|
||||
var lineCount = 0
|
||||
var offsetInLine = 0
|
||||
|
||||
while (i < length) {
|
||||
val c = this[i]
|
||||
|
||||
if (lineCount == position.line && offsetInLine == position.offset) {
|
||||
return i
|
||||
}
|
||||
|
||||
i++
|
||||
offsetInLine++
|
||||
|
||||
if (isEndOfLine(c.code)) {
|
||||
offsetInLine = 0
|
||||
lineCount++
|
||||
assert(lineCount <= position.line)
|
||||
}
|
||||
}
|
||||
|
||||
return length
|
||||
}
|
||||
|
||||
private val KtExpression.isConstantStringLiteral: Boolean
|
||||
get() = this is KtStringTemplateExpression && entries.all { it is KtLiteralStringTemplateEntry }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user