@@ -195,7 +195,9 @@ private class Argument extends CfgNodes::ExprCfgNode {
195
195
not this .getExpr ( ) .( Pair ) .getKey ( ) .getConstantValue ( ) .isSymbol ( _) and
196
196
not this .getExpr ( ) instanceof HashSplatExpr and
197
197
not this .getExpr ( ) instanceof SplatExpr and
198
- arg .isPositional ( i )
198
+ arg .isPositional ( i ) and
199
+ // There are no splat arguments before the positional argument
200
+ not splatArgumentAt ( call , any ( int j | j < i ) )
199
201
)
200
202
or
201
203
exists ( CfgNodes:: ExprNodes:: PairCfgNode p |
@@ -217,7 +219,9 @@ private class Argument extends CfgNodes::ExprCfgNode {
217
219
exists ( int pos |
218
220
this = call .getArgument ( pos ) and
219
221
this .getExpr ( ) instanceof SplatExpr and
220
- arg .isSplat ( pos )
222
+ arg .isSplat ( pos ) and
223
+ // There are no earlier splat arguments
224
+ not splatArgumentAt ( call , any ( int j | j < pos ) )
221
225
)
222
226
or
223
227
this = call .getAnArgument ( ) and
@@ -432,7 +436,7 @@ private predicate splatParameterAt(Callable c, int pos) {
432
436
}
433
437
434
438
private predicate splatArgumentAt ( CfgNodes:: ExprNodes:: CallCfgNode c , int pos ) {
435
- exists ( Argument arg , ArgumentPosition apos | arg . isArgumentOf ( c , apos ) and apos . isSplat ( pos ) )
439
+ c . getArgument ( pos ) . getExpr ( ) instanceof SplatExpr
436
440
}
437
441
438
442
/** A collection of cached types and predicates to be evaluated in the same stage. */
@@ -920,7 +924,12 @@ private module ParameterNodes {
920
924
921
925
override predicate isParameterOf ( DataFlowCallable c , ParameterPosition pos ) {
922
926
exists ( Callable callable | callable = c .asCfgScope ( ) |
923
- exists ( int i | pos .isPositional ( i ) and callable .getParameter ( i ) = parameter |
927
+ exists ( int i |
928
+ pos .isPositional ( i ) and
929
+ callable .getParameter ( i ) = parameter and
930
+ // There are no splat parameters before the positional parameter
931
+ not splatParameterAt ( callable , any ( int m | m < i ) )
932
+ |
924
933
parameter instanceof SimpleParameter
925
934
or
926
935
parameter instanceof OptionalParameter
@@ -939,7 +948,9 @@ private module ParameterNodes {
939
948
parameter = callable .getParameter ( n ) .( SplatParameter ) and
940
949
pos .isSplat ( n ) and
941
950
// There are no positional parameters after the splat
942
- not exists ( SimpleParameter p , int m | m > n | p = callable .getParameter ( m ) )
951
+ not exists ( SimpleParameter p , int m | m > n | p = callable .getParameter ( m ) ) and
952
+ // There are no earlier splat parameters
953
+ not splatParameterAt ( callable , any ( int m | m < n ) )
943
954
)
944
955
or
945
956
parameter = callable .getAParameter ( ) .( BlockParameter ) and
0 commit comments