Skip to content

Commit ee4fae7

Browse files
committed
JS: Fix getRawEnclosingStmt call
1 parent d3da642 commit ee4fae7

File tree

1 file changed

+9
-8
lines changed
  • javascript/ql/lib/semmle/javascript

1 file changed

+9
-8
lines changed

javascript/ql/lib/semmle/javascript/Expr.qll

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -249,22 +249,16 @@ class Expr extends @expr, ExprOrStmt, ExprOrType, AST::ValueNode {
249249
)
250250
}
251251

252-
pragma[inline]
253-
private Stmt getRawEnclosingStmt(Expr e) {
254-
// For performance reasons, we need the enclosing statement without overrides
255-
enclosing_stmt(e, result)
256-
}
257-
258252
/**
259253
* Gets the data-flow node where exceptions thrown by this expression will
260254
* propagate if this expression causes an exception to be thrown.
261255
*/
262256
overlay[caller]
263257
pragma[inline]
264258
DataFlow::Node getExceptionTarget() {
265-
result = getCatchParameterFromStmt(this.getRawEnclosingStmt(this))
259+
result = getCatchParameterFromStmt(getRawEnclosingStmt(this))
266260
or
267-
not exists(getCatchParameterFromStmt(this.getRawEnclosingStmt(this))) and
261+
not exists(getCatchParameterFromStmt(getRawEnclosingStmt(this))) and
268262
result =
269263
any(DataFlow::FunctionNode f | f.getFunction() = this.getContainer()).getExceptionalReturn()
270264
}
@@ -277,6 +271,13 @@ private DataFlow::Node getCatchParameterFromStmt(Stmt stmt) {
277271
DataFlow::parameterNode(stmt.getEnclosingTryCatchStmt().getACatchClause().getAParameter())
278272
}
279273

274+
overlay[caller]
275+
pragma[inline]
276+
private Stmt getRawEnclosingStmt(Expr e) {
277+
// For performance reasons, we need the enclosing statement without overrides
278+
enclosing_stmt(e, result)
279+
}
280+
280281
/**
281282
* An identifier.
282283
*

0 commit comments

Comments
 (0)