Skip to content

Commit b4f16dc

Browse files
committed
Small tweaks.
1 parent 0921501 commit b4f16dc

2 files changed

Lines changed: 6 additions & 15 deletions

File tree

shared/controlflow/codeql/controlflow/AstConsistency.qll

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -129,17 +129,16 @@ module MakeAstConsistency<LocationSig Location, AstSig<Location> Ast> {
129129
query = "multipleParents" and
130130
results = strictcount(AstNode child | multipleParents(child, _, _))
131131
or
132-
query = "nonAncestorEnclosingCallable" and
133-
results = strictcount(AstNode node | nonAncestorEnclosingCallable(node, _))
134-
or
135132
query = "childAtMultipleIndices" and
136133
results = strictcount(AstNode child | childAtMultipleIndices(_, child, _, _))
137134
or
138135
query = "siblingsWithIdenticalIndex" and
139-
results = strictcount(AstNode parent, int index | siblingsWithIdenticalIndex(parent, index, _, _))
136+
results =
137+
strictcount(AstNode parent, int index | siblingsWithIdenticalIndex(parent, index, _, _))
140138
or
141139
query = "memberChildMissingFromGetChild" and
142-
results = strictcount(AstNode parent, AstNode child | memberChildMissingFromGetChild(parent, child, _))
140+
results =
141+
strictcount(AstNode parent, AstNode child | memberChildMissingFromGetChild(parent, child, _))
143142
or
144143
query = "getChildMissingFromMember" and
145144
results = strictcount(AstNode parent, int index | getChildMissingFromMember(parent, index, _))
@@ -152,15 +151,6 @@ module MakeAstConsistency<LocationSig Location, AstSig<Location> Ast> {
152151
parent1 != parent2
153152
}
154153

155-
/**
156-
* Holds if `node` has an enclosing callable that is not reachable through
157-
* parent steps.
158-
*/
159-
query predicate nonAncestorEnclosingCallable(AstNode node, Callable callable) {
160-
callable = getEnclosingCallable(node) and
161-
not getParent*(node) = callable
162-
}
163-
164154
/** Holds if `child` is assigned multiple child indices under `parent`. */
165155
query predicate childAtMultipleIndices(AstNode parent, AstNode child, int index1, int index2) {
166156
getChild(parent, index1) = child and
@@ -179,6 +169,7 @@ module MakeAstConsistency<LocationSig Location, AstSig<Location> Ast> {
179169

180170
/** Holds if a member child relation is not reflected by `getChild`. */
181171
query predicate memberChildMissingFromGetChild(AstNode parent, AstNode child, string member) {
172+
exists(getEnclosingCallable(parent)) and
182173
astMemberChild(parent, child, member) and
183174
not getChild(parent, _) = child
184175
}

shared/controlflow/codeql/controlflow/ControlFlowGraph.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2063,7 +2063,7 @@ module Make0<LocationSig Location, AstSig<Location> Ast> {
20632063
*/
20642064

20652065
private import PrintGraph as Pp
2066-
private import AstConsistency
2066+
private import codeql.controlflow.AstConsistency
20672067

20682068
private class ControlFlowNodeAlias = ControlFlowNode;
20692069

0 commit comments

Comments
 (0)