mirror of
https://github.com/github/codeql.git
synced 2026-05-04 05:05:12 +02:00
Fix CallExprCfgNode.getKeywordArgument
This predicate now produces results.
This commit is contained in:
committed by
Harry Maclean
parent
0caea17118
commit
8fd8c9b04d
@@ -320,7 +320,11 @@ module ExprNodes {
|
||||
|
||||
/** Gets the the keyword argument whose key is `keyword` of this call. */
|
||||
final ExprCfgNode getKeywordArgument(string keyword) {
|
||||
e.hasCfgChild(e.getKeywordArgument(keyword), this, result)
|
||||
exists(PairCfgNode n |
|
||||
e.hasCfgChild(e.getAnArgument(), this, n) and
|
||||
n.getKey().getExpr().(SymbolLiteral).getValueText() = keyword and
|
||||
result = n.getValue()
|
||||
)
|
||||
}
|
||||
|
||||
/** Gets the number of arguments of this call. */
|
||||
@@ -426,6 +430,21 @@ module ExprNodes {
|
||||
ParenthesizedExprCfgNode() { this.getExpr() instanceof ParenthesizedExpr }
|
||||
}
|
||||
|
||||
private class PairChildMapping extends ExprChildMapping, Pair {
|
||||
override predicate relevantChild(Expr e) { e = this.getKey() or e = this.getValue() }
|
||||
}
|
||||
|
||||
/** A control-flow node that wraps a `Pair` AST expression. */
|
||||
class PairCfgNode extends ExprCfgNode {
|
||||
override PairChildMapping e;
|
||||
|
||||
final override Pair getExpr() { result = ExprCfgNode.super.getExpr() }
|
||||
|
||||
final ExprCfgNode getKey() { e.hasCfgChild(e.getKey(), this, result) }
|
||||
|
||||
final ExprCfgNode getValue() { e.hasCfgChild(e.getValue(), this, result) }
|
||||
}
|
||||
|
||||
/** A control-flow node that wraps a `VariableReadAccess` AST expression. */
|
||||
class VariableReadAccessCfgNode extends ExprCfgNode {
|
||||
override VariableReadAccess e;
|
||||
|
||||
@@ -319,3 +319,5 @@ positionalArguments
|
||||
| raise.rb:161:7:161:14 | call to raise | raise.rb:161:13:161:14 | "" |
|
||||
| raise.rb:168:5:168:12 | call to raise | raise.rb:168:11:168:12 | "" |
|
||||
keywordArguments
|
||||
| cfg.html.erb:6:9:6:58 | call to stylesheet_link_tag | media | cfg.html.erb:6:54:6:58 | "all" |
|
||||
| cfg.html.erb:12:11:12:33 | call to link_to | id | cfg.html.erb:12:31:12:33 | "a" |
|
||||
|
||||
Reference in New Issue
Block a user