Skip to content

Commit 66e6c7b

Browse files
committed
Swift: make GenericTypeParamDecls children
1 parent 3ce76e6 commit 66e6c7b

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

swift/codegen/schema.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1109,7 +1109,8 @@ AbstractTypeParamDecl:
11091109
_extends: TypeDecl
11101110

11111111
GenericContext:
1112-
generic_type_params: GenericTypeParamDecl*
1112+
_children:
1113+
generic_type_params: GenericTypeParamDecl*
11131114

11141115
GenericTypeDecl:
11151116
_extends:

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,19 @@ private module Impl {
4545
private Element getImmediateChildOfGenericContext(
4646
GenericContext e, int index, string partialPredicateCall
4747
) {
48-
exists(int b, int bElement, int n |
48+
exists(int b, int bElement, int n, int nGenericTypeParam |
4949
b = 0 and
5050
bElement = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfElement(e, i, _)) | i) and
5151
n = bElement and
52+
nGenericTypeParam =
53+
n + 1 + max(int i | i = -1 or exists(e.getImmediateGenericTypeParam(i)) | i) and
5254
(
5355
none()
5456
or
5557
result = getImmediateChildOfElement(e, index - b, partialPredicateCall)
58+
or
59+
result = e.getImmediateGenericTypeParam(index - n) and
60+
partialPredicateCall = "GenericTypeParam(" + (index - n).toString() + ")"
5661
)
5762
)
5863
}

0 commit comments

Comments
 (0)