mirror of
https://github.com/github/codeql.git
synced 2025-12-22 19:56:32 +01:00
Kotlin: Record that generated data class members are compiler-generated
This commit is contained in:
@@ -783,6 +783,9 @@ open class KotlinFileExtractor(
|
|||||||
val methodId = id.cast<DbMethod>()
|
val methodId = id.cast<DbMethod>()
|
||||||
tw.writeMethods(methodId, shortName.nameInDB, "${shortName.nameInDB}$paramsSignature", returnType.javaResult.id, parentId, sourceDeclaration.cast<DbMethod>())
|
tw.writeMethods(methodId, shortName.nameInDB, "${shortName.nameInDB}$paramsSignature", returnType.javaResult.id, parentId, sourceDeclaration.cast<DbMethod>())
|
||||||
tw.writeMethodsKotlinType(methodId, returnType.kotlinResult.id)
|
tw.writeMethodsKotlinType(methodId, returnType.kotlinResult.id)
|
||||||
|
if (f.origin == IrDeclarationOrigin.GENERATED_DATA_CLASS_MEMBER) {
|
||||||
|
tw.writeCompiler_generated(methodId, 2)
|
||||||
|
}
|
||||||
|
|
||||||
if (extractMethodAndParameterTypeAccesses) {
|
if (extractMethodAndParameterTypeAccesses) {
|
||||||
extractTypeAccessRecursive(substReturnType, locId, id, -1)
|
extractTypeAccessRecursive(substReturnType, locId, id, -1)
|
||||||
|
|||||||
@@ -1211,10 +1211,15 @@ ktPropertyDelegates(
|
|||||||
unique int variableId: @variable ref
|
unique int variableId: @variable ref
|
||||||
)
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If `id` is a compiler generated element, then the kind indicates the
|
||||||
|
* reason that the compiler generated it.
|
||||||
|
* See `Element.compilerGeneratedReason()` for an explanation of what
|
||||||
|
* each `kind` means.
|
||||||
|
*/
|
||||||
compiler_generated(
|
compiler_generated(
|
||||||
unique int id: @element ref,
|
unique int id: @element ref,
|
||||||
int kind: int ref
|
int kind: int ref
|
||||||
// 1: Declaring classes of adapter functions in Kotlin
|
|
||||||
)
|
)
|
||||||
|
|
||||||
ktFunctionOriginalNames(
|
ktFunctionOriginalNames(
|
||||||
|
|||||||
@@ -44,6 +44,15 @@ class Element extends @element, Top {
|
|||||||
|
|
||||||
/** Holds if this is an auxiliary program element generated by the compiler. */
|
/** Holds if this is an auxiliary program element generated by the compiler. */
|
||||||
predicate isCompilerGenerated() { compiler_generated(this, _) }
|
predicate isCompilerGenerated() { compiler_generated(this, _) }
|
||||||
|
|
||||||
|
/** Gets the reason this element was generated by the compiler, if any. */
|
||||||
|
string compilerGeneratedReason() {
|
||||||
|
exists(int i | compiler_generated(this, i) |
|
||||||
|
i = 1 and result = "Declaring classes of adapter functions in Kotlin"
|
||||||
|
or
|
||||||
|
i = 2 and result = "Generated data class members"
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user