File tree Expand file tree Collapse file tree 1 file changed +25
-1
lines changed
swift/ql/lib/codeql/swift/elements/decl Expand file tree Collapse file tree 1 file changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -9,8 +9,32 @@ class VarDecl extends Generated::VarDecl {
99}
1010
1111/**
12- * A field declaration.
12+ * A field declaration. That is, a variable declaration that is a member of a
13+ * class, struct, enum or protocol.
1314 */
1415class FieldDecl extends VarDecl {
1516 FieldDecl ( ) { this = any ( Decl ctx ) .getAMember ( ) }
17+
18+ /**
19+ * Holds if this field is called `fieldName` and is a member of a
20+ * class, struct, extension, enum or protocol called `typeName`.
21+ */
22+ cached
23+ predicate hasQualifiedName ( string typeName , string fieldName ) {
24+ this .getName ( ) = fieldName and
25+ exists ( Decl d |
26+ d .asNominalTypeDecl ( ) .getFullName ( ) = typeName and
27+ d .getAMember ( ) = this
28+ )
29+ }
30+
31+ /**
32+ * Holds if this field is called `fieldName` and is a member of a
33+ * class, struct, extension, enum or protocol called `typeName` in a module
34+ * called `moduleName`.
35+ */
36+ predicate hasQualifiedName ( string moduleName , string typeName , string fieldName ) {
37+ this .hasQualifiedName ( typeName , fieldName ) and
38+ this .getModule ( ) .getFullName ( ) = moduleName
39+ }
1640}
You can’t perform that action at this time.
0 commit comments