mirror of
https://github.com/github/codeql.git
synced 2025-12-20 10:46:30 +01:00
Merge branch 'main' into post-release-prep/codeql-cli-2.10.0
This commit is contained in:
@@ -20,13 +20,21 @@ predicate setterFor(Method m, Field f) {
|
||||
predicate shadows(LocalVariableDecl d, Class c, Field f, Callable method) {
|
||||
d.getCallable() = method and
|
||||
method.getDeclaringType() = c and
|
||||
c.getAField() = f and
|
||||
f.getName() = d.getName() and
|
||||
f.getType() = d.getType() and
|
||||
not d.getCallable().isStatic() and
|
||||
f = getField(c, d.getName(), d.getType()) and
|
||||
not method.isStatic() and
|
||||
not f.isStatic()
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the field with the given name and type from the given class, if any.
|
||||
*/
|
||||
pragma[nomagic]
|
||||
private Field getField(Class c, string name, Type t) {
|
||||
result.getDeclaringType() = c and
|
||||
result.getName() = name and
|
||||
result.getType() = t
|
||||
}
|
||||
|
||||
predicate thisAccess(LocalVariableDecl d, Field f) {
|
||||
shadows(d, _, f, _) and
|
||||
exists(VarAccess va | va.getVariable().(Field).getSourceDeclaration() = f |
|
||||
|
||||
Reference in New Issue
Block a user