@@ -437,6 +437,7 @@ private module Cached {
437
437
FlowSummaryImplSpecific:: ParsePositions:: isParsedKeywordParameterPosition ( _, name )
438
438
} or
439
439
THashSplatArgumentPosition ( ) or
440
+ TSynthHashSplatArgumentPosition ( ) or
440
441
TSplatArgumentPosition ( int pos ) { exists ( Call c | c .getArgument ( pos ) instanceof SplatExpr ) } or
441
442
TSynthSplatArgumentPosition ( ) or
442
443
TAnyArgumentPosition ( ) or
@@ -461,14 +462,10 @@ private module Cached {
461
462
FlowSummaryImplSpecific:: ParsePositions:: isParsedKeywordArgumentPosition ( _, name )
462
463
} or
463
464
THashSplatParameterPosition ( ) or
464
- // To get flow from a hash-splat argument to a keyword parameter, we add a read-step
465
- // from a synthetic hash-splat parameter. We need this separate synthetic ParameterNode,
466
- // since we clear content of the normal hash-splat parameter for the names that
467
- // correspond to normal keyword parameters. Since we cannot re-use the same parameter
468
- // position for multiple parameter nodes in the same callable, we introduce this
469
- // synthetic parameter position.
470
465
TSynthHashSplatParameterPosition ( ) or
471
466
TSplatParameterPosition ( int pos ) {
467
+ pos = 0
468
+ or
472
469
exists ( Parameter p | p .getPosition ( ) = pos and p instanceof SplatParameter )
473
470
} or
474
471
TSynthSplatParameterPosition ( ) or
@@ -1297,12 +1294,15 @@ class ParameterPosition extends TParameterPosition {
1297
1294
/** Holds if this position represents a hash-splat parameter. */
1298
1295
predicate isHashSplat ( ) { this = THashSplatParameterPosition ( ) }
1299
1296
1297
+ /** Holds if this position represents a synthetic hash-splat parameter. */
1300
1298
predicate isSynthHashSplat ( ) { this = TSynthHashSplatParameterPosition ( ) }
1301
1299
1302
- predicate isSynthSplat ( ) { this = TSynthSplatParameterPosition ( ) }
1303
-
1300
+ /** Holds if this position represents a splat parameter at position `n`. */
1304
1301
predicate isSplat ( int n ) { this = TSplatParameterPosition ( n ) }
1305
1302
1303
+ /** Holds if this position represents a synthetic splat parameter. */
1304
+ predicate isSynthSplat ( ) { this = TSynthSplatParameterPosition ( ) }
1305
+
1306
1306
/**
1307
1307
* Holds if this position represents any parameter, except `self` parameters. This
1308
1308
* includes both positional, named, and block parameters.
@@ -1334,9 +1334,9 @@ class ParameterPosition extends TParameterPosition {
1334
1334
or
1335
1335
this .isAnyNamed ( ) and result = "any-named"
1336
1336
or
1337
- this .isSynthSplat ( ) and result = "synthetic *"
1338
- or
1339
1337
exists ( int pos | this .isSplat ( pos ) and result = "* (position " + pos + ")" )
1338
+ or
1339
+ this .isSynthSplat ( ) and result = "synthetic *"
1340
1340
}
1341
1341
}
1342
1342
@@ -1366,14 +1366,16 @@ class ArgumentPosition extends TArgumentPosition {
1366
1366
/** Holds if this position represents any positional parameter. */
1367
1367
predicate isAnyNamed ( ) { this = TAnyKeywordArgumentPosition ( ) }
1368
1368
1369
- /**
1370
- * Holds if this position represents a synthesized argument containing all keyword
1371
- * arguments wrapped in a hash.
1372
- */
1369
+ /** Holds if this position represents a hash-splat argument. */
1373
1370
predicate isHashSplat ( ) { this = THashSplatArgumentPosition ( ) }
1374
1371
1372
+ /** Holds if this position represents a synthetic hash-splat argument. */
1373
+ predicate isSynthHashSplat ( ) { this = TSynthHashSplatArgumentPosition ( ) }
1374
+
1375
+ /** Holds if this position represents a splat argument at position `n`. */
1375
1376
predicate isSplat ( int n ) { this = TSplatArgumentPosition ( n ) }
1376
1377
1378
+ /** Holds if this position represents a synthetic splat argument. */
1377
1379
predicate isSynthSplat ( ) { this = TSynthSplatArgumentPosition ( ) }
1378
1380
1379
1381
/** Gets a textual representation of this position. */
@@ -1394,9 +1396,11 @@ class ArgumentPosition extends TArgumentPosition {
1394
1396
or
1395
1397
this .isHashSplat ( ) and result = "**"
1396
1398
or
1397
- this .isSynthSplat ( ) and result = "synthetic *"
1399
+ this .isSynthHashSplat ( ) and result = "synthetic * *"
1398
1400
or
1399
1401
exists ( int pos | this .isSplat ( pos ) and result = "* (position " + pos + ")" )
1402
+ or
1403
+ this .isSynthSplat ( ) and result = "synthetic *"
1400
1404
}
1401
1405
}
1402
1406
@@ -1429,17 +1433,21 @@ predicate parameterMatch(ParameterPosition ppos, ArgumentPosition apos) {
1429
1433
or
1430
1434
exists ( string name | ppos .isKeyword ( name ) and apos .isKeyword ( name ) )
1431
1435
or
1432
- ppos .isHashSplat ( ) and apos .isHashSplat ( )
1433
- or
1434
- ppos .isSynthHashSplat ( ) and apos .isHashSplat ( )
1436
+ ( ppos .isHashSplat ( ) or ppos .isSynthHashSplat ( ) ) and
1437
+ ( apos .isHashSplat ( ) or apos .isSynthHashSplat ( ) )
1435
1438
or
1436
- ppos .isSplat ( 0 ) and apos .isSynthSplat ( )
1437
- or
1438
- ppos .isSynthSplat ( ) and
1439
- ( apos .isSynthSplat ( ) or apos .isSplat ( 0 ) )
1440
- or
1441
- // Exact splat match
1442
- exists ( int n | apos .isSplat ( n ) and ppos .isSplat ( n ) )
1439
+ exists ( int pos |
1440
+ (
1441
+ ppos .isSplat ( pos )
1442
+ or
1443
+ ppos .isSynthSplat ( ) and pos = 0
1444
+ ) and
1445
+ (
1446
+ apos .isSplat ( pos )
1447
+ or
1448
+ apos .isSynthSplat ( ) and pos = 0
1449
+ )
1450
+ )
1443
1451
or
1444
1452
ppos .isAny ( ) and argumentPositionIsNotSelf ( apos )
1445
1453
or
0 commit comments