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
+5-9Lines changed: 5 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -64,32 +64,28 @@ none()
64
64
{{/final}}
65
65
{{/classes}}
66
66
}
67
-
68
-
Element resolve(Element e) {
69
-
{{#classes}}{{#hideable_root}}if e instanceof {{name}} then result = e.({{name}}).resolve() else {{/hideable_root}}{{/classes}}result = e
70
-
}
71
67
}
72
68
73
69
/**
74
70
* Gets the "immediate" parent of `e`. "Immediate" means not taking into account node resolution: for example
75
71
* if `e` has conversions, `getImmediateParent(e)` will give the innermost conversion in the hidden AST.
76
72
*/
77
73
Element getImmediateParent(Element e) {
78
-
// `unique` is used here to tell the optimizer that there is in fact only one result
79
-
// this is tested by the `library-tests/parent/no_double_parents.ql` test
80
-
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)
81
77
}
82
78
83
79
/**
84
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.
85
81
*/
86
82
Element getImmediateChildAndAccessor(Element e, int index, string accessor) {
87
-
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)
88
84
}
89
85
90
86
/**
91
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.
92
88
*/
93
89
Element getChildAndAccessor(Element e, int index, string accessor) {
94
-
exists(string partialAccessor | result = Impl::resolve(Impl::getImmediateChild(e, index, partialAccessor)) and accessor = "get" + partialAccessor)
90
+
exists(string partialAccessor | result = Impl::getImmediateChild(e, index, partialAccessor).resolve() and accessor = "get" + partialAccessor)
0 commit comments