@@ -1317,46 +1317,62 @@ private module ImplicitHashValueSynthesis {
13171317
13181318/**
13191319 * ```rb
1320- * def foo(&)
1321- * bar(&)
1320+ * def foo(*, **, &)
1321+ * bar(*, **, &)
13221322 * end
13231323 * ```
13241324 * desugars to,
13251325 * ```rb
1326- * def foo(& __synth_0)
1327- * bar(& __synth_0)
1326+ * def foo(* __synth_0, **__synth_1, &__synth_2 )
1327+ * bar(* __synth_0, **__synth_1, &__synth_2 )
13281328 * end
13291329 * ```
13301330 */
1331- private module AnonymousBlockParameterSynth {
1332- private BlockParameter anonymousBlockParameter ( ) {
1331+ private module AnonymousParameterSynth {
1332+ private class AnonymousParameter = TBlockParameter or THashSplatParameter or TSplatParameter ;
1333+
1334+ private class AnonymousArgument = TBlockArgument or THashSplatExpr or TSplatExpr ;
1335+
1336+ private AnonymousParameter anonymousParameter ( ) {
13331337 exists ( Ruby:: BlockParameter p | not exists ( p .getName ( ) ) and toGenerated ( result ) = p )
1338+ or
1339+ exists ( Ruby:: SplatParameter p | not exists ( p .getName ( ) ) and toGenerated ( result ) = p )
1340+ or
1341+ exists ( Ruby:: HashSplatParameter p | not exists ( p .getName ( ) ) and toGenerated ( result ) = p )
13341342 }
13351343
1336- private BlockArgument anonymousBlockArgument ( ) {
1344+ private AnonymousArgument anonymousArgument ( ) {
13371345 exists ( Ruby:: BlockArgument p | not exists ( p .getChild ( ) ) and toGenerated ( result ) = p )
1346+ or
1347+ exists ( Ruby:: SplatArgument p | not exists ( p .getChild ( ) ) and toGenerated ( result ) = p )
1348+ or
1349+ exists ( Ruby:: HashSplatArgument p | not exists ( p .getChild ( ) ) and toGenerated ( result ) = p )
13381350 }
13391351
1340- private class AnonymousBlockParameterSynthesis extends Synthesis {
1352+ private class AnonymousParameterSynthesis extends Synthesis {
13411353 final override predicate child ( AstNode parent , int i , Child child ) {
13421354 i = 0 and
1343- parent = anonymousBlockParameter ( ) and
1355+ parent = anonymousParameter ( ) and
13441356 child = SynthChild ( LocalVariableAccessSynthKind ( TLocalVariableSynth ( parent , 0 ) ) )
13451357 }
13461358
1347- final override predicate localVariable ( AstNode n , int i ) {
1348- n = anonymousBlockParameter ( ) and i = 0
1349- }
1359+ final override predicate localVariable ( AstNode n , int i ) { n = anonymousParameter ( ) and i = 0 }
13501360 }
13511361
1352- private class AnonymousBlockArgumentSynthesis extends Synthesis {
1362+ private class AnonymousArgumentSynthesis extends Synthesis {
13531363 final override predicate child ( AstNode parent , int i , Child child ) {
13541364 i = 0 and
1355- parent = anonymousBlockArgument ( ) and
1356- exists ( BlockParameter param |
1357- param = anonymousBlockParameter ( ) and
1365+ parent = anonymousArgument ( ) and
1366+ exists ( AnonymousParameter param |
1367+ param = anonymousParameter ( ) and
13581368 scopeOf ( toGenerated ( parent ) ) .getEnclosingMethod ( ) = scopeOf ( toGenerated ( param ) ) and
13591369 child = SynthChild ( LocalVariableAccessSynthKind ( TLocalVariableSynth ( param , 0 ) ) )
1370+ |
1371+ param instanceof TBlockParameter and parent instanceof TBlockArgument
1372+ or
1373+ param instanceof TSplatParameter and parent instanceof TSplatExpr
1374+ or
1375+ param instanceof THashSplatParameter and parent instanceof THashSplatExpr
13601376 )
13611377 }
13621378 }
0 commit comments