Skip to content

Commit 194c99c

Browse files
committed
Swift: fix getNumberOf predicate
1 parent 23626f2 commit 194c99c

39 files changed

+85
-77
lines changed

swift/codegen/templates/ql_class.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ module Generated {
126126
* Gets the number of {{doc_plural}}.
127127
*/
128128
final int getNumberOf{{plural}}() {
129-
result = count({{indefinite_getter}}())
129+
result = count(int i | exists({{getter}}(i)))
130130
}
131131
{{/is_optional}}
132132
{{/is_repeated}}

swift/ql/.generated.list

Lines changed: 37 additions & 37 deletions
Large diffs are not rendered by default.

swift/ql/lib/codeql/swift/generated/Callable.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ module Generated {
5656
/**
5757
* Gets the number of parameters of this callable.
5858
*/
59-
final int getNumberOfParams() { result = count(getAParam()) }
59+
final int getNumberOfParams() { result = count(int i | exists(getParam(i))) }
6060

6161
/**
6262
* Gets the body of this callable, if it exists.

swift/ql/lib/codeql/swift/generated/decl/AbstractStorageDecl.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@ module Generated {
3434
/**
3535
* Gets the number of accessor declarations of this abstract storage declaration.
3636
*/
37-
final int getNumberOfAccessorDecls() { result = count(getAnAccessorDecl()) }
37+
final int getNumberOfAccessorDecls() { result = count(int i | exists(getAccessorDecl(i))) }
3838
}
3939
}

swift/ql/lib/codeql/swift/generated/decl/EnumCaseDecl.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@ module Generated {
3434
/**
3535
* Gets the number of elements of this enum case declaration.
3636
*/
37-
final int getNumberOfElements() { result = count(getAnElement()) }
37+
final int getNumberOfElements() { result = count(int i | exists(getElement(i))) }
3838
}
3939
}

swift/ql/lib/codeql/swift/generated/decl/EnumElementDecl.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,6 @@ module Generated {
4141
/**
4242
* Gets the number of parameters of this enum element declaration.
4343
*/
44-
final int getNumberOfParams() { result = count(getAParam()) }
44+
final int getNumberOfParams() { result = count(int i | exists(getParam(i))) }
4545
}
4646
}

swift/ql/lib/codeql/swift/generated/decl/GenericContext.qll

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ module Generated {
3434
/**
3535
* Gets the number of generic type parameters of this generic context.
3636
*/
37-
final int getNumberOfGenericTypeParams() { result = count(getAGenericTypeParam()) }
37+
final int getNumberOfGenericTypeParams() {
38+
result = count(int i | exists(getGenericTypeParam(i)))
39+
}
3840
}
3941
}

swift/ql/lib/codeql/swift/generated/decl/IfConfigDecl.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,6 @@ module Generated {
3636
/**
3737
* Gets the number of active elements of this if config declaration.
3838
*/
39-
final int getNumberOfActiveElements() { result = count(getAnActiveElement()) }
39+
final int getNumberOfActiveElements() { result = count(int i | exists(getActiveElement(i))) }
4040
}
4141
}

swift/ql/lib/codeql/swift/generated/decl/ImportDecl.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,6 @@ module Generated {
6363
/**
6464
* Gets the number of declarations of this import declaration.
6565
*/
66-
final int getNumberOfDeclarations() { result = count(getADeclaration()) }
66+
final int getNumberOfDeclarations() { result = count(int i | exists(getDeclaration(i))) }
6767
}
6868
}

swift/ql/lib/codeql/swift/generated/decl/IterableDeclContext.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@ module Generated {
3232
/**
3333
* Gets the number of members of this iterable declaration context.
3434
*/
35-
final int getNumberOfMembers() { result = count(getAMember()) }
35+
final int getNumberOfMembers() { result = count(int i | exists(getMember(i))) }
3636
}
3737
}

0 commit comments

Comments
 (0)