@@ -377,8 +377,7 @@ private module Cached {
377
377
378
378
class TSourceParameterNode =
379
379
TNormalParameterNode or TBlockParameterNode or TSelfParameterNode or
380
- TSynthHashSplatParameterNode or TSynthSplatParameterNode or TSynthSplatArgParameterNode or
381
- TSynthSplatParameterElementNode ;
380
+ TSynthHashSplatParameterNode or TSynthSplatParameterNode or TSynthSplatArgParameterNode ;
382
381
383
382
cached
384
383
Location getLocation ( NodeImpl n ) { result = n .getLocationImpl ( ) }
@@ -480,8 +479,11 @@ private module Cached {
480
479
entrySsaDefinition ( n ) and
481
480
not LocalFlow:: localFlowSsaParamInput ( _, n )
482
481
or
483
- // Needed for stores in type tracking
484
482
TypeTrackerSpecific:: storeStepIntoSourceNode ( _, n , _)
483
+ or
484
+ TypeTrackerSpecific:: readStepIntoSourceNode ( _, n , _)
485
+ or
486
+ TypeTrackerSpecific:: readStoreStepIntoSourceNode ( _, n , _, _)
485
487
}
486
488
487
489
cached
@@ -936,7 +938,7 @@ private module ParameterNodes {
936
938
* A node that holds the content of a specific positional argument.
937
939
* See `SynthSplatArgumentNode` for more information.
938
940
*/
939
- class SynthSplatParameterElementNode extends ParameterNodeImpl , TSynthSplatParameterElementNode {
941
+ class SynthSplatParameterElementNode extends NodeImpl , TSynthSplatParameterElementNode {
940
942
private DataFlowCallable callable ;
941
943
private int pos ;
942
944
@@ -957,10 +959,6 @@ private module ParameterNodes {
957
959
)
958
960
}
959
961
960
- final override Parameter getParameter ( ) { none ( ) }
961
-
962
- final override predicate isParameterOf ( DataFlowCallable c , ParameterPosition p ) { none ( ) }
963
-
964
962
final override CfgScope getCfgScope ( ) { result = callable .asCallable ( ) }
965
963
966
964
final override DataFlowCallable getEnclosingCallable ( ) { result = callable }
@@ -1369,7 +1367,7 @@ private ContentSet getKeywordContent(string name) {
1369
1367
)
1370
1368
}
1371
1369
1372
- private ContentSet getPositionalContent ( int n ) {
1370
+ ContentSet getPositionalContent ( int n ) {
1373
1371
exists ( ConstantValue:: ConstantIntegerValue i |
1374
1372
result .isSingleton ( TKnownElementContent ( i ) ) and
1375
1373
i .isInt ( n )
@@ -1400,18 +1398,13 @@ predicate storeStepCommon(Node node1, ContentSet c, Node node2) {
1400
1398
)
1401
1399
)
1402
1400
or
1401
+ // Wrap all positional arguments in a synthesized splat argument node
1403
1402
exists ( CfgNodes:: ExprNodes:: CallCfgNode call , ArgumentPosition pos |
1404
1403
node2 = TSynthSplatArgumentNode ( call ) and
1405
1404
node1 .asExpr ( ) .( Argument ) .isArgumentOf ( call , pos )
1406
1405
|
1407
1406
exists ( int n | pos .isPositional ( n ) and c = getPositionalContent ( n ) )
1408
1407
)
1409
- or
1410
- node1 =
1411
- any ( SynthSplatParameterElementNode elemNode |
1412
- node2 = elemNode .getSplatParameterNode ( _) and
1413
- c = getPositionalContent ( elemNode .getStorePosition ( ) )
1414
- )
1415
1408
}
1416
1409
1417
1410
/**
@@ -1445,9 +1438,24 @@ predicate storeStep(Node node1, ContentSet c, Node node2) {
1445
1438
FlowSummaryImpl:: Private:: Steps:: summaryStoreStep ( node1 .( FlowSummaryNode ) .getSummaryNode ( ) , c ,
1446
1439
node2 .( FlowSummaryNode ) .getSummaryNode ( ) )
1447
1440
or
1441
+ node1 =
1442
+ any ( SynthSplatParameterElementNode elemNode |
1443
+ node2 = elemNode .getSplatParameterNode ( _) and
1444
+ c = getPositionalContent ( elemNode .getStorePosition ( ) )
1445
+ )
1446
+ or
1448
1447
storeStepCommon ( node1 , c , node2 )
1449
1448
}
1450
1449
1450
+ /**
1451
+ * Subset of `readStep` that should be shared with type-tracking.
1452
+ */
1453
+ predicate readStepCommon ( Node node1 , ContentSet c , Node node2 ) {
1454
+ node2 = node1 .( SynthHashSplatParameterNode ) .getAKeywordParameter ( c )
1455
+ or
1456
+ node2 = node1 .( SynthSplatParameterNode ) .getAParameter ( c )
1457
+ }
1458
+
1451
1459
/**
1452
1460
* Holds if there is a read step of content `c` from `node1` to `node2`.
1453
1461
*/
@@ -1475,19 +1483,17 @@ predicate readStep(Node node1, ContentSet c, Node node2) {
1475
1483
) )
1476
1484
)
1477
1485
or
1478
- node2 = node1 .( SynthHashSplatParameterNode ) .getAKeywordParameter ( c )
1479
- or
1480
1486
FlowSummaryImpl:: Private:: Steps:: summaryReadStep ( node1 .( FlowSummaryNode ) .getSummaryNode ( ) , c ,
1481
1487
node2 .( FlowSummaryNode ) .getSummaryNode ( ) )
1482
1488
or
1483
- node2 = node1 .( SynthSplatParameterNode ) .getAParameter ( c )
1484
- or
1485
1489
// Read from SynthSplatArgParameterNode into SynthSplatParameterElementNode
1486
1490
node2 =
1487
1491
any ( SynthSplatParameterElementNode e |
1488
1492
node1 .( SynthSplatArgParameterNode ) .isParameterOf ( e .getEnclosingCallable ( ) , _) and
1489
1493
c = getPositionalContent ( e .getReadPosition ( ) )
1490
1494
)
1495
+ or
1496
+ readStepCommon ( node1 , c , node2 )
1491
1497
}
1492
1498
1493
1499
/**
0 commit comments