mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
C#: The field access should be on this for it to be compatible with readonly.
This commit is contained in:
@@ -20,7 +20,10 @@ predicate defTargetsField(AssignableDefinition def, Field f) {
|
||||
predicate isReadonlyCompatibleDefinition(AssignableDefinition def, Field f) {
|
||||
defTargetsField(def, f) and
|
||||
(
|
||||
def.getEnclosingCallable().(Constructor).getDeclaringType() = f.getDeclaringType()
|
||||
def.getEnclosingCallable().(StaticConstructor).getDeclaringType() = f.getDeclaringType()
|
||||
or
|
||||
def.getEnclosingCallable().(InstanceConstructor).getDeclaringType() = f.getDeclaringType() and
|
||||
def.getTargetAccess().(QualifiableExpr).getQualifier() instanceof ThisAccess
|
||||
or
|
||||
def instanceof AssignableDefinitions::InitializerDefinition
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user