@@ -506,13 +506,13 @@ def visit_block_var(node)
506506 )
507507 end
508508
509- params = node . params
510509 children =
511- if ::Parser ::Builders ::Default . emit_procarg0 && node . arg0?
510+ if ::Parser ::Builders ::Default . emit_procarg0 && node . arg0? &&
511+ node . pipe?
512512 # There is a special node type in the parser gem for when a single
513513 # required parameter to a block would potentially be expanded
514514 # automatically. We handle that case here.
515- required = params . requireds . first
515+ required = node . params . requireds . first
516516 procarg0 =
517517 if ::Parser ::Builders ::Default . emit_arg_inside_procarg0 &&
518518 required . is_a? ( Ident )
@@ -537,18 +537,21 @@ def visit_block_var(node)
537537
538538 [ procarg0 ]
539539 else
540- visit ( params ) . children
540+ visit ( node . params ) . children
541541 end
542542
543- s (
544- :args ,
545- children + shadowargs ,
546- source_map_collection (
547- begin_token : source_range_length ( node . location . start_char , 1 ) ,
548- end_token : source_range_length ( node . location . end_char , -1 ) ,
549- expression : source_range_node ( node )
550- )
551- )
543+ location =
544+ if node . location . start_char == node . location . end_char
545+ source_map_collection ( expression : nil )
546+ else
547+ source_map_collection (
548+ begin_token : source_range_length ( node . location . start_char , 1 ) ,
549+ end_token : source_range_length ( node . location . end_char , -1 ) ,
550+ expression : source_range_node ( node )
551+ )
552+ end
553+
554+ s ( :args , children + shadowargs , location )
552555 end
553556
554557 # Visit a BodyStmt node.
@@ -1541,7 +1544,7 @@ def visit_label(node)
15411544
15421545 # Visit a Lambda node.
15431546 def visit_lambda ( node )
1544- args = node . params . is_a? ( LambdaVar ) ? node . params : node . params . contents
1547+ args = node . params . is_a? ( BlockVar ) ? node . params : node . params . contents
15451548 args_node = visit ( args )
15461549
15471550 type = :block
@@ -1589,34 +1592,6 @@ def visit_lambda(node)
15891592 )
15901593 end
15911594
1592- # Visit a LambdaVar node.
1593- def visit_lambda_var ( node )
1594- shadowargs =
1595- node . locals . map do |local |
1596- s (
1597- :shadowarg ,
1598- [ local . value . to_sym ] ,
1599- source_map_variable (
1600- source_range_node ( local ) ,
1601- source_range_node ( local )
1602- )
1603- )
1604- end
1605-
1606- location =
1607- if node . location . start_char == node . location . end_char
1608- source_map_collection ( expression : nil )
1609- else
1610- source_map_collection (
1611- begin_token : source_range_length ( node . location . start_char , 1 ) ,
1612- end_token : source_range_length ( node . location . end_char , -1 ) ,
1613- expression : source_range_node ( node )
1614- )
1615- end
1616-
1617- s ( :args , visit ( node . params ) . children + shadowargs , location )
1618- end
1619-
16201595 # Visit an MAssign node.
16211596 def visit_massign ( node )
16221597 s (
0 commit comments