Skip to content

Commit 04a6768

Browse files
tausbnCopilot
andcommitted
Unified: Format Swift translation rules
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 3843b4a commit 04a6768

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

  • unified/extractor/src/languages/swift

‎unified/extractor/src/languages/swift/swift.rs‎

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -890,7 +890,13 @@ fn translation_rules() -> Vec<Rule<SwiftContext>> {
890890
(switch_case body: (block stmt: {body}))
891891
),
892892
// A single case item unwraps to its pattern, possibly boxed in conditional_pattern
893-
rule!((switchCaseItem pattern: @p whereClause: (whereClause condition: @cond)) => (conditional_pattern pattern: { p } condition: {cond})),
893+
rule!(
894+
(switchCaseItem
895+
pattern: @p
896+
whereClause: (whereClause condition: @cond))
897+
=>
898+
(conditional_pattern pattern: {p} condition: {cond})
899+
),
894900
rule!((switchCaseItem pattern: @p) => pattern { p }),
895901
// A pattern-matching condition (`if case let x = e`, `if case .foo(let x)
896902
// = e`) becomes a `pattern_guard_expr`: the matched pattern and the
@@ -1035,7 +1041,9 @@ fn translation_rules() -> Vec<Rule<SwiftContext>> {
10351041
catch_clause: {catches})
10361042
),
10371043
rule!(
1038-
(catchItem pattern: @pattern whereClause: (whereClause condition: @guard))
1044+
(catchItem
1045+
pattern: @pattern
1046+
whereClause: (whereClause condition: @guard))
10391047
=>
10401048
(conditional_pattern pattern: {pattern} condition: {guard})
10411049
),
@@ -1198,7 +1206,9 @@ fn translation_rules() -> Vec<Rule<SwiftContext>> {
11981206
}
11991207
),
12001208
rule!(
1201-
(tupleTypeElement firstName: _? @@name type: @ty)
1209+
(tupleTypeElement
1210+
firstName: _? @@name
1211+
type: @ty)
12021212
=>
12031213
argument {
12041214
if ctx.in_function_type {

0 commit comments

Comments
 (0)