mirror of
https://github.com/github/codeql.git
synced 2026-05-21 22:57:11 +02:00
KE2: Pass the trap writer in to the file extractor
This commit is contained in:
@@ -534,7 +534,10 @@ OLD: KE1
|
||||
/*
|
||||
OLD: KE1
|
||||
logger,
|
||||
*/
|
||||
sftw,
|
||||
/*
|
||||
OLD: KE1
|
||||
linesOfCode,
|
||||
srcFilePath,
|
||||
null,
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user