mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
JS: Fix getRawEnclosingStmt call
This commit is contained in:
@@ -249,12 +249,6 @@ class Expr extends @expr, ExprOrStmt, ExprOrType, AST::ValueNode {
|
||||
)
|
||||
}
|
||||
|
||||
pragma[inline]
|
||||
private Stmt getRawEnclosingStmt(Expr e) {
|
||||
// For performance reasons, we need the enclosing statement without overrides
|
||||
enclosing_stmt(e, result)
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the data-flow node where exceptions thrown by this expression will
|
||||
* propagate if this expression causes an exception to be thrown.
|
||||
@@ -262,9 +256,9 @@ class Expr extends @expr, ExprOrStmt, ExprOrType, AST::ValueNode {
|
||||
overlay[caller]
|
||||
pragma[inline]
|
||||
DataFlow::Node getExceptionTarget() {
|
||||
result = getCatchParameterFromStmt(this.getRawEnclosingStmt(this))
|
||||
result = getCatchParameterFromStmt(getRawEnclosingStmt(this))
|
||||
or
|
||||
not exists(getCatchParameterFromStmt(this.getRawEnclosingStmt(this))) and
|
||||
not exists(getCatchParameterFromStmt(getRawEnclosingStmt(this))) and
|
||||
result =
|
||||
any(DataFlow::FunctionNode f | f.getFunction() = this.getContainer()).getExceptionalReturn()
|
||||
}
|
||||
@@ -277,6 +271,13 @@ private DataFlow::Node getCatchParameterFromStmt(Stmt stmt) {
|
||||
DataFlow::parameterNode(stmt.getEnclosingTryCatchStmt().getACatchClause().getAParameter())
|
||||
}
|
||||
|
||||
overlay[caller]
|
||||
pragma[inline]
|
||||
private Stmt getRawEnclosingStmt(Expr e) {
|
||||
// For performance reasons, we need the enclosing statement without overrides
|
||||
enclosing_stmt(e, result)
|
||||
}
|
||||
|
||||
/**
|
||||
* An identifier.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user