mirror of
https://github.com/github/codeql.git
synced 2025-12-21 19:26:31 +01:00
Extract external types with members, so that tests don't produce DB constraint violations
The constructor of `Any` was missing. Also, previously members of external types were not extracted to not end up with DB constraint violations, but these I can't reproduce currently in tests.
This commit is contained in:
@@ -318,15 +318,13 @@ class KotlinFileExtractor(val logger: FileLogger, val tw: FileTrapWriter, val fi
|
||||
if (c.origin == IrDeclarationOrigin.IR_EXTERNAL_DECLARATION_STUB ||
|
||||
c.origin == IrDeclarationOrigin.IR_EXTERNAL_JAVA_DECLARATION_STUB) {
|
||||
if(tw.getExistingLabelFor<DbClass>(getClassLabel(c)) == null) {
|
||||
return extractExternalClass(c)
|
||||
return extractClass(c)
|
||||
}
|
||||
}
|
||||
return addClassLabel(c)
|
||||
}
|
||||
|
||||
fun extractExternalClass(c: IrClass): Label<out DbClassorinterface> {
|
||||
// todo: fix this.
|
||||
// temporarily only extract the class or interface without any members.
|
||||
fun extractClass(c: IrClass): Label<out DbClassorinterface> {
|
||||
val id = addClassLabel(c)
|
||||
val pkg = c.packageFqName?.asString() ?: ""
|
||||
val cls = c.name.asString()
|
||||
@@ -344,11 +342,6 @@ class KotlinFileExtractor(val logger: FileLogger, val tw: FileTrapWriter, val fi
|
||||
tw.writeIsEnumType(classId)
|
||||
}
|
||||
}
|
||||
return id
|
||||
}
|
||||
|
||||
fun extractClass(c: IrClass): Label<out DbClassorinterface> {
|
||||
val id = extractExternalClass(c)
|
||||
val locId = tw.getLocation(c)
|
||||
tw.writeHasLocation(id, locId)
|
||||
for(t in c.superTypes) {
|
||||
|
||||
Reference in New Issue
Block a user