You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: misc/codegen/templates/ql_parent.mustache
+8-8Lines changed: 8 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -28,7 +28,7 @@ private module Impl {
28
28
{{! for single and optional properties it adds 1 (regardless of whether the optional property exists) }}
29
29
{{! for repeated it adds 1 + the maximum index (which works for repeated optional as well) }}
30
30
and
31
-
n{{singular}} = n{{prev_child}} + 1{{#is_repeated}}+ max(int i | i = -1 or exists(e.getImmediate{{singular}}(i)) | i){{/is_repeated}}
31
+
n{{singular}} = n{{prev_child}} + 1{{#is_repeated}}+ max(int i | i = -1 or exists(e.get{{#type_is_hideable}}Immediate{{/type_is_hideable}}{{singular}}(i)) | i){{/is_repeated}}
32
32
{{/is_child}}
33
33
{{/properties}} and (
34
34
none()
@@ -40,10 +40,10 @@ private module Impl {
40
40
{{#is_child}}
41
41
or
42
42
{{#is_repeated}}
43
-
result = e.getImmediate{{singular}}(index - n{{prev_child}}) and partialPredicateCall = "{{singular}}(" + (index - n{{prev_child}}).toString() + ")"
43
+
result = e.get{{#type_is_hideable}}Immediate{{/type_is_hideable}}{{singular}}(index - n{{prev_child}}) and partialPredicateCall = "{{singular}}(" + (index - n{{prev_child}}).toString() + ")"
44
44
{{/is_repeated}}
45
45
{{^is_repeated}}
46
-
index = n{{prev_child}} and result = e.getImmediate{{singular}}() and partialPredicateCall = "{{singular}}()"
46
+
index = n{{prev_child}} and result = e.get{{#type_is_hideable}}Immediate{{/type_is_hideable}}{{singular}}() and partialPredicateCall = "{{singular}}()"
47
47
{{/is_repeated}}
48
48
{{/is_child}}
49
49
{{/properties}}
@@ -71,21 +71,21 @@ none()
71
71
* if `e` has conversions, `getImmediateParent(e)` will give the innermost conversion in the hidden AST.
72
72
*/
73
73
Element getImmediateParent(Element e) {
74
-
// `unique` is used here to tell the optimizer that there is in fact only one result
75
-
// this is tested by the `library-tests/parent/no_double_parents.ql` test
76
-
result = unique(Element x | e = Impl::getImmediateChild(x, _, _) | x)
74
+
// `unique` is used here to tell the optimizer that there is in fact only one result
75
+
// this is tested by the `library-tests/parent/no_double_parents.ql` test
76
+
result = unique(Element x | e = Impl::getImmediateChild(x, _, _) | x)
77
77
}
78
78
79
79
/**
80
80
* Gets the immediate child indexed at `index`. Indexes are not guaranteed to be contiguous, but are guaranteed to be distinct. `accessor` is bound the member predicate call resulting in the given child.
81
81
*/
82
82
Element getImmediateChildAndAccessor(Element e, int index, string accessor) {
83
-
exists(string partialAccessor | result = Impl::getImmediateChild(e, index, partialAccessor) and accessor = "get" + partialAccessor)
83
+
exists(string partialAccessor | result = Impl::getImmediateChild(e, index, partialAccessor) and accessor = "get" + partialAccessor)
84
84
}
85
85
86
86
/**
87
87
* Gets the child indexed at `index`. Indexes are not guaranteed to be contiguous, but are guaranteed to be distinct. `accessor` is bound the member predicate call resulting in the given child.
88
88
*/
89
89
Element getChildAndAccessor(Element e, int index, string accessor) {
90
-
exists(string partialAccessor | result = Impl::getImmediateChild(e, index, partialAccessor).resolve() and accessor = "get" + partialAccessor)
90
+
exists(string partialAccessor | result = Impl::getImmediateChild(e, index, partialAccessor).resolve() and accessor = "get" + partialAccessor)
0 commit comments