@@ -523,6 +523,11 @@ fn translation_rules() -> Vec<Rule<SwiftContext>> {
523523 =>
524524 ( identifier #{ name} )
525525 ) ,
526+ rule!(
527+ ( patternExpr pattern: @p)
528+ =>
529+ expr { p }
530+ ) ,
526531 // A `let`/`var` value-binding pattern (`let x`) inside a case or `if case`
527532 // preserves the binding specifier around its inner pattern.
528533 rule!(
@@ -672,39 +677,11 @@ fn translation_rules() -> Vec<Rule<SwiftContext>> {
672677 tree!( ( call_expr callee: { callee} argument: { args} ) )
673678 }
674679 ) ,
675- // A call or enum-case pattern argument. Both use the shared `argument`
676- // shape, preserving the optional label as `name` and the child as `value`.
677- // The pattern-only shapes (`patternExpr`, `discardAssignmentExpr`) are
678- // matched first; they never occur as ordinary call arguments.
679- rule!(
680- ( labeledExpr
681- label: _? @@lbl
682- expression: ( functionCallExpr
683- calledExpression: @constructor
684- arguments: _* @elements) )
685- =>
686- argument {
687- tree!( ( argument
688- name_node: ( identifier #{ lbl} ) ?
689- value: ( call_expr callee: { constructor} argument: { elements} ) ) )
690- }
691- ) ,
692- rule!(
693- ( labeledExpr label: _? @@lbl expression: ( patternExpr pattern: @p) )
694- =>
695- ( argument name_node: ( identifier #{ lbl} ) ? value: { p} )
696- ) ,
697- rule!(
698- ( labeledExpr label: _? @@lbl expression: ( discardAssignmentExpr) @@wildcard)
699- =>
700- ( argument name_node: ( identifier #{ lbl} ) ? value: ( identifier #{ wildcard} ) )
701- ) ,
680+ // A call or enum-case pattern argument.
702681 rule!(
703682 ( labeledExpr label: _? @@lbl expression: @val)
704683 =>
705- argument {
706- tree!( ( argument name_node: ( identifier #{ lbl} ) ? value: { val} ) )
707- }
684+ ( argument name_node: ( identifier #{ lbl} ) ? value: { val} )
708685 ) ,
709686 // Member access (`list.append`). The `declName` is itself a
710687 // `declReferenceExpr`; pull its `baseName` out as the member identifier.
0 commit comments