KE2: Pass the trap writer in to the file extractor

This commit is contained in:
Ian Lynagh
2024-08-29 14:49:27 +01:00
parent 30626ca7e4
commit 92a2b51be0
3 changed files with 15 additions and 7 deletions

View File

@@ -534,7 +534,10 @@ OLD: KE1
/*
OLD: KE1
logger,
*/
sftw,
/*
OLD: KE1
linesOfCode,
srcFilePath,
null,

View File

@@ -77,7 +77,10 @@ open class KotlinFileExtractor(
/*
OLD: KE1
override val logger: FileLogger,
override val tw: FileTrapWriter,
*/
/* TODO override */ val tw: FileTrapWriter,
/*
OLD: KE1
val linesOfCode: LinesOfCode?,
val filePath: String,
dependencyCollector: OdasaOutput.TrapFileManager?,
@@ -112,7 +115,6 @@ OLD: KE1
is KtNamed -> element.getNameAsName()?.asString() ?: "<missing name>"
else -> "<no name>"
}
TODO()
/*
OLD: KE1
val loc = tw.getLocationString(element)
@@ -122,9 +124,15 @@ OLD: KE1
val depth = context.size
val depthDescription = "${"-".repeat(depth)} (${depth.toString()})"
logger.trace("$depthDescription: Starting a $kind ($name) at $loc")
*/
val result = f()
/*
OLD: KE1
logger.trace("$depthDescription: Finished a $kind ($name) at $loc")
*/
return result
/*
OLD: KE1
} catch (exception: Exception) {
throw Exception("While extracting a $kind ($name) at $loc", exception)
} finally {
@@ -135,9 +143,9 @@ OLD: KE1
fun extractFileContents(file: KtFile, id: Label<DbFile>) {
with("file", file) {
val locId = tw.getWholeFileLocation()
/*
OLD: KE1
val locId = tw.getWholeFileLocation()
val pkg = file.packageFqName.asString()
val pkgId = extractPackage(pkg)
tw.writeHasLocation(id, locId)

View File

@@ -205,8 +205,6 @@ OLD: HE1
}
}
/*
OLD: HE1
/**
* If you have an ID for a file, then this gets a label for the location representing the whole
* of that file.
@@ -214,7 +212,6 @@ OLD: HE1
fun getWholeFileLocation(fileId: Label<DbFile>): Label<DbLocation> {
return getLocation(fileId, 0, 0, 0, 0)
}
*/
/**
* Write a raw string into the TRAP file.
@@ -412,11 +409,11 @@ OLD: KE1
// to be 0.
return "file://$filePath"
}
*/
/** Gets a label for the location representing the whole of this file. */
fun getWholeFileLocation(): Label<DbLocation> {
return getWholeFileLocation(fileId)
}
*/
}
/*