Skip to content

Commit 711c3ee

Browse files
committed
C#: Bugfix in enclosing callable.
1 parent 569aae6 commit 711c3ee

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

csharp/ql/lib/semmle/code/csharp/ExprOrStmtParent.qll

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -129,13 +129,6 @@ private module Cached {
129129
result = parent.getAChildStmt()
130130
}
131131

132-
pragma[inline]
133-
private ControlFlowElement enclosingStart(ControlFlowElement cfe) {
134-
result = cfe
135-
or
136-
getAChild(result).(AnonymousFunctionExpr) = cfe
137-
}
138-
139132
private predicate parent(ControlFlowElement child, ExprOrStmtParent parent) {
140133
child = getAChild(parent) and
141134
not child = getBody(_)
@@ -145,15 +138,15 @@ private module Cached {
145138
cached
146139
predicate enclosingBody(ControlFlowElement cfe, ControlFlowElement body) {
147140
body = getBody(_) and
148-
parent*(enclosingStart(cfe), body)
141+
parent*(cfe, body)
149142
}
150143

151144
/** Holds if the enclosing callable of `cfe` is `c`. */
152145
cached
153146
predicate enclosingCallable(ControlFlowElement cfe, Callable c) {
154147
enclosingBody(cfe, getBody(c))
155148
or
156-
parent*(enclosingStart(cfe), c.(Constructor).getInitializer())
149+
parent*(cfe, c.(Constructor).getInitializer())
157150
or
158151
parent*(cfe, c.(Constructor).getObjectInitializerCall())
159152
or

0 commit comments

Comments
 (0)