mirror of
https://github.com/github/codeql.git
synced 2025-12-24 04:36:35 +01:00
Identify data classes during extraction
This commit is contained in:
committed by
Chris Smowton
parent
1e78f2893c
commit
25fce5f6bb
@@ -386,6 +386,10 @@ open class KotlinFileExtractor(
|
||||
} else if (kind != ClassKind.CLASS && kind != ClassKind.OBJECT) {
|
||||
logger.warnElement("Unrecognised class kind $kind", c)
|
||||
}
|
||||
|
||||
if (c.isData) {
|
||||
tw.writeKtDataClasses(classId)
|
||||
}
|
||||
}
|
||||
|
||||
val locId = tw.getLocation(c)
|
||||
|
||||
@@ -1232,3 +1232,7 @@ ktFunctionOriginalNames(
|
||||
unique int id: @method ref,
|
||||
string name: string ref
|
||||
)
|
||||
|
||||
ktDataClasses(
|
||||
unique int id: @class ref
|
||||
)
|
||||
|
||||
@@ -714,6 +714,13 @@ class CompanionObject extends Class {
|
||||
Field getInstance() { type_companion_object(_, result, this) }
|
||||
}
|
||||
|
||||
/**
|
||||
* A Kotlin data class declaration.
|
||||
*/
|
||||
class DataClass extends Class {
|
||||
DataClass() { ktDataClasses(this) }
|
||||
}
|
||||
|
||||
/**
|
||||
* A record declaration.
|
||||
*/
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
| dc.kt:1:1:1:71 | ProtoMapValue |
|
||||
@@ -0,0 +1,5 @@
|
||||
import java
|
||||
|
||||
from DataClass c
|
||||
where c.fromSource()
|
||||
select c
|
||||
Reference in New Issue
Block a user