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