Skip to content

Commit adacaf5

Browse files
committed
JS: Fix getRawEnclosingStmt call
1 parent 120dcd3 commit adacaf5

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
@@ -240,21 +240,15 @@ class Expr extends @expr, ExprOrStmt, ExprOrType, AST::ValueNode {
240240
)
241241
}
242242

243-
pragma[inline]
244-
private Stmt getRawEnclosingStmt(Expr e) {
245-
// For performance reasons, we need the enclosing statement without overrides
246-
enclosing_stmt(e, result)
247-
}
248-
249243
/**
250244
* Gets the data-flow node where exceptions thrown by this expression will
251245
* propagate if this expression causes an exception to be thrown.
252246
*/
253247
pragma[inline]
254248
DataFlow::Node getExceptionTarget() {
255-
result = getCatchParameterFromStmt(this.getRawEnclosingStmt(this))
249+
result = getCatchParameterFromStmt(getRawEnclosingStmt(this))
256250
or
257-
not exists(getCatchParameterFromStmt(this.getRawEnclosingStmt(this))) and
251+
not exists(getCatchParameterFromStmt(getRawEnclosingStmt(this))) and
258252
result =
259253
any(DataFlow::FunctionNode f | f.getFunction() = this.getContainer()).getExceptionalReturn()
260254
}
@@ -267,6 +261,13 @@ private DataFlow::Node getCatchParameterFromStmt(Stmt stmt) {
267261
DataFlow::parameterNode(stmt.getEnclosingTryCatchStmt().getACatchClause().getAParameter())
268262
}
269263

264+
overlay[caller]
265+
pragma[inline]
266+
private Stmt getRawEnclosingStmt(Expr e) {
267+
// For performance reasons, we need the enclosing statement without overrides
268+
enclosing_stmt(e, result)
269+
}
270+
270271
/**
271272
* An identifier.
272273
*

0 commit comments

Comments
 (0)