[JS] Rename JsLocation.identityObject to fileIdentity
This commit is contained in:
+1
-1
@@ -516,7 +516,7 @@ private inline fun <T : JsNode> T.addSourceInfoIfNeed(node: IrElement, context:
|
||||
|
||||
private fun JsLocation.withEmbeddedSource(
|
||||
context: JsGenerationContext
|
||||
) = JsLocationWithEmbeddedSource(this, identityObject = context.currentFile) {
|
||||
) = JsLocationWithEmbeddedSource(this, fileIdentity = context.currentFile) {
|
||||
try {
|
||||
InputStreamReader(FileInputStream(file), StandardCharsets.UTF_8)
|
||||
} catch (e: IOException) {
|
||||
|
||||
@@ -23,7 +23,7 @@ data class JsLocation(
|
||||
override val startLine: Int,
|
||||
override val startChar: Int
|
||||
) : JsLocationWithSource {
|
||||
override val identityObject: Any?
|
||||
override val fileIdentity: Any?
|
||||
get() = null
|
||||
override val sourceProvider: () -> Reader?
|
||||
get() = { null }
|
||||
@@ -35,7 +35,11 @@ interface JsLocationWithSource {
|
||||
val file: String
|
||||
val startLine: Int
|
||||
val startChar: Int
|
||||
val identityObject: Any?
|
||||
|
||||
/**
|
||||
* An object to distinguish different files with the same paths
|
||||
*/
|
||||
val fileIdentity: Any?
|
||||
val sourceProvider: () -> Reader?
|
||||
|
||||
fun asSimpleLocation(): JsLocation
|
||||
@@ -43,6 +47,6 @@ interface JsLocationWithSource {
|
||||
|
||||
class JsLocationWithEmbeddedSource(
|
||||
private val location: JsLocation,
|
||||
override val identityObject: Any?,
|
||||
override val fileIdentity: Any?,
|
||||
override val sourceProvider: () -> Reader?
|
||||
) : JsLocationWithSource by location
|
||||
|
||||
@@ -122,11 +122,11 @@ public class SourceMap3Builder implements SourceMapBuilder {
|
||||
|
||||
@Override
|
||||
public void addMapping(
|
||||
@NotNull String source, @Nullable Object identityObject, @NotNull Supplier<Reader> sourceContent,
|
||||
@NotNull String source, @Nullable Object sourceFileIdentity, @NotNull Supplier<Reader> sourceContent,
|
||||
int sourceLine, int sourceColumn
|
||||
) {
|
||||
source = source.replace(File.separatorChar, '/');
|
||||
int sourceIndex = getSourceIndex(source, identityObject, sourceContent);
|
||||
int sourceIndex = getSourceIndex(source, sourceFileIdentity, sourceContent);
|
||||
|
||||
if (!currentMappingIsEmpty && previousSourceIndex == sourceIndex && previousSourceLine == sourceLine &&
|
||||
previousSourceColumn == sourceColumn) {
|
||||
|
||||
@@ -81,7 +81,7 @@ class SourceMapBuilderConsumer(
|
||||
}
|
||||
mappingConsumer.addMapping(
|
||||
path,
|
||||
sourceInfo.identityObject,
|
||||
sourceInfo.fileIdentity,
|
||||
contentSupplier,
|
||||
sourceInfo.startLine,
|
||||
sourceInfo.startChar
|
||||
|
||||
@@ -15,7 +15,7 @@ public interface SourceMapMappingConsumer {
|
||||
void newLine();
|
||||
|
||||
void addMapping(
|
||||
@NotNull String source, @Nullable Object sourceIdentity, @NotNull Supplier<Reader> sourceSupplier,
|
||||
@NotNull String source, @Nullable Object fileIdentity, @NotNull Supplier<Reader> sourceSupplier,
|
||||
int sourceLine, int sourceColumn
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user