File tree Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -866,15 +866,19 @@ module ExprNodes {
866
866
final override RelationalOperation getExpr ( ) { result = super .getExpr ( ) }
867
867
}
868
868
869
+ private class SplatExprChildMapping extends ExprChildMapping , SplatExpr {
870
+ override predicate relevantChild ( AstNode n ) { n = this .getOperand ( ) }
871
+ }
872
+
869
873
/** A control-flow node that wraps a `SplatExpr` AST expression. */
870
874
class SplatExprCfgNode extends ExprCfgNode {
871
875
override string getAPrimaryQlClass ( ) { result = "SplatExprCfgNode" }
872
876
873
- SplatExprCfgNode ( ) { e instanceof SplatExpr }
877
+ override SplatExprChildMapping e ;
874
878
875
879
final override SplatExpr getExpr ( ) { result = super .getExpr ( ) }
876
880
877
- final ExprCfgNode getOperand ( ) { result . getExpr ( ) = e . ( SplatExpr ) . getOperand ( ) }
881
+ final ExprCfgNode getOperand ( ) { e . hasCfgChild ( e . getOperand ( ) , this , result ) }
878
882
}
879
883
880
884
/** A control-flow node that wraps an `ElementReference` AST expression. */
Original file line number Diff line number Diff line change @@ -168,13 +168,12 @@ private predicate stringConstCaseCompare(
168
168
// when "foo", "bar"
169
169
pattern instanceof ExprNodes:: StringLiteralCfgNode
170
170
or
171
- // array literals behave weirdly in the CFG so we need to drop down to the AST level for this bit
172
- // specifically: `SplatExprCfgNode.getOperand()` does not return results for array literals
173
171
exists ( CfgNodes:: ExprNodes:: SplatExprCfgNode splat | splat = pattern |
174
172
// when *["foo", "bar"]
175
- exists ( ArrayLiteral arr |
176
- splat .getExpr ( ) .getOperand ( ) = arr and
177
- forall ( Expr elem | elem = arr .getAnElement ( ) | elem instanceof StringLiteral )
173
+ forex ( ExprCfgNode elem |
174
+ elem = splat .getOperand ( ) .( ExprNodes:: ArrayLiteralCfgNode ) .getAnArgument ( )
175
+ |
176
+ elem instanceof ExprNodes:: StringLiteralCfgNode
178
177
)
179
178
or
180
179
// when *some_var
You can’t perform that action at this time.
0 commit comments