Rename companion object QL class

This commit is contained in:
Tamas Vajk
2022-02-02 10:10:30 +01:00
committed by Ian Lynagh
parent 535610452f
commit d495badc1e
3 changed files with 10 additions and 13 deletions

View File

@@ -711,15 +711,11 @@ class ClassObject extends Class {
}
/** A Kotlin `companion object`. */
class ClassCompanionObject extends Class {
ClassCompanionObject() {
type_companion_object(_, _, this)
}
class CompanionObject extends Class {
CompanionObject() { type_companion_object(_, _, this) }
/** Gets the instance variable that implements this `companion object`. */
Field getInstance() {
type_companion_object(_, result, this)
}
Field getInstance() { type_companion_object(_, result, this) }
}
/**
@@ -961,7 +957,7 @@ class ClassOrInterface extends RefType, @classorinterface {
predicate isSealed() { exists(this.getAPermittedSubtype()) }
/** Get the companion object of this class or interface, if any. */
ClassCompanionObject getCompanionObject() { type_companion_object(this, _, result) }
CompanionObject getCompanionObject() { type_companion_object(this, _, result) }
}
private string getAPublicObjectMethodSignature() {

View File

@@ -1,5 +1,5 @@
import java
from VarAccess va, ClassCompanionObject cco
from VarAccess va, CompanionObject cco
where va.getVariable() = cco.getInstance()
select cco, va

View File

@@ -1,7 +1,8 @@
import java
from ClassOrInterface c, ClassCompanionObject cco, Field f
where c.fromSource()
and cco = c.getCompanionObject()
and f = cco.getInstance()
from ClassOrInterface c, CompanionObject cco, Field f
where
c.fromSource() and
cco = c.getCompanionObject() and
f = cco.getInstance()
select c, f, cco, concat(f.getAModifier().toString(), ",")