@@ -454,7 +454,7 @@ private module Cached {
454
454
} or
455
455
TSynthSplatParameterElementNode ( DataFlowCallable c , int n ) {
456
456
exists ( c .asCallable ( ) ) and // exclude library callables
457
- isParameterNode ( _, c , any ( ParameterPosition p | p .isSplat ( _ ) ) ) and
457
+ isParameterNode ( _, c , any ( ParameterPosition p | p .isSplat ( any ( int i | i > 0 ) ) ) ) and
458
458
n in [ 0 .. 10 ]
459
459
} or
460
460
TExprPostUpdateNode ( CfgNodes:: ExprCfgNode n ) {
@@ -1214,7 +1214,7 @@ module ArgumentNodes {
1214
1214
* part of the method signature, such that those cannot end up in the hash-splat
1215
1215
* parameter.
1216
1216
*/
1217
- class SynthHashSplatArgumentNode extends ArgumentNode , TSynthHashSplatArgumentNode {
1217
+ class SynthHashSplatArgumentNode extends ArgumentNode , NodeImpl , TSynthHashSplatArgumentNode {
1218
1218
CfgNodes:: ExprNodes:: CallCfgNode c ;
1219
1219
1220
1220
SynthHashSplatArgumentNode ( ) { this = TSynthHashSplatArgumentNode ( c ) }
@@ -1227,12 +1227,6 @@ module ArgumentNodes {
1227
1227
call = c and
1228
1228
pos .isHashSplat ( )
1229
1229
}
1230
- }
1231
-
1232
- private class SynthHashSplatArgumentNodeImpl extends NodeImpl , TSynthHashSplatArgumentNode {
1233
- CfgNodes:: ExprNodes:: CallCfgNode c ;
1234
-
1235
- SynthHashSplatArgumentNodeImpl ( ) { this = TSynthHashSplatArgumentNode ( c ) }
1236
1230
1237
1231
override CfgScope getCfgScope ( ) { result = c .getExpr ( ) .getCfgScope ( ) }
1238
1232
@@ -1541,6 +1535,23 @@ predicate storeStepCommon(Node node1, ContentSet c, Node node2) {
1541
1535
)
1542
1536
}
1543
1537
1538
+ // Store from TSynthSplatArgumentElementNode(n)
1539
+ // into TSynthSplatArgumentNode[n]
1540
+ predicate synthSplatArgumentElementStoreStep (
1541
+ SynthSplatArgumentElementNode node1 , ContentSet c , SynthSplatArgumentNode node2
1542
+ ) {
1543
+ exists ( CfgNodes:: ExprNodes:: CallCfgNode call , int n |
1544
+ node2 = TSynthSplatArgumentNode ( call ) and
1545
+ node1 = TSynthSplatArgumentElementNode ( call , n ) and
1546
+ (
1547
+ c = getPositionalContent ( n )
1548
+ or
1549
+ n = - 1 and
1550
+ c .isSingleton ( TUnknownElementContent ( ) )
1551
+ )
1552
+ )
1553
+ }
1554
+
1544
1555
/**
1545
1556
* Holds if data can flow from `node1` to `node2` via an assignment to
1546
1557
* content `c`.
@@ -1578,18 +1589,7 @@ predicate storeStep(Node node1, ContentSet c, Node node2) {
1578
1589
c = getPositionalContent ( elemNode .getStorePosition ( ) - splatPos )
1579
1590
)
1580
1591
or
1581
- // Store from TSynthSplatArgumentElementNode(n)
1582
- // into TSynthSplatArgumentNode[n]
1583
- exists ( CfgNodes:: ExprNodes:: CallCfgNode call , int n |
1584
- node2 = TSynthSplatArgumentNode ( call ) and
1585
- node1 = TSynthSplatArgumentElementNode ( call , n ) and
1586
- (
1587
- c = getPositionalContent ( n )
1588
- or
1589
- n = - 1 and
1590
- c .isSingleton ( TUnknownElementContent ( ) )
1591
- )
1592
- )
1592
+ synthSplatArgumentElementStoreStep ( node1 , c , node2 )
1593
1593
or
1594
1594
storeStepCommon ( node1 , c , node2 )
1595
1595
or
@@ -1604,19 +1604,6 @@ predicate readStepCommon(Node node1, ContentSet c, Node node2) {
1604
1604
node2 = node1 .( SynthHashSplatParameterNode ) .getAKeywordParameter ( c )
1605
1605
or
1606
1606
node2 = node1 .( SynthSplatParameterNode ) .getAParameter ( c )
1607
- or
1608
- // TODO: convert into the above form
1609
- synthSplatArgumentElementReadStep ( node1 , c , node2 )
1610
- or
1611
- // read from SynthSplatParameterNode[n] to nth positional parameter
1612
- exists ( SynthSplatParameterNode paramNode , NormalParameterNode posNode , int n |
1613
- paramNode = node1 and
1614
- posNode = node2 and
1615
- posNode
1616
- .isParameterOf ( paramNode .getEnclosingCallable ( ) ,
1617
- any ( ParameterPosition p | p .isPositional ( n ) ) ) and
1618
- c = getPositionalContent ( n )
1619
- )
1620
1607
}
1621
1608
1622
1609
// read from splat arg to synth splat arg element
@@ -1678,6 +1665,9 @@ predicate readStep(Node node1, ContentSet c, Node node2) {
1678
1665
c = getPositionalContent ( e .getReadPosition ( ) )
1679
1666
)
1680
1667
or
1668
+ // TODO: convert into the above form
1669
+ synthSplatArgumentElementReadStep ( node1 , c , node2 )
1670
+ or
1681
1671
readStepCommon ( node1 , c , node2 )
1682
1672
}
1683
1673
0 commit comments