Skip to content

Commit bd2b5d9

Browse files
committed
Make optional bindings and pattern matchings expressible as ConditionElement
1 parent d9af173 commit bd2b5d9

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

Sources/SwiftSyntaxBuilder/generated/ExpressibleAsProtocols.swift

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1484,18 +1484,26 @@ public extension ExpressibleAsAvailabilityCondition {
14841484
return createAvailabilityCondition()
14851485
}
14861486
}
1487-
public protocol ExpressibleAsMatchingPatternCondition: ExpressibleAsSyntaxBuildable {
1487+
public protocol ExpressibleAsMatchingPatternCondition: ExpressibleAsConditionElement {
14881488
func createMatchingPatternCondition() -> MatchingPatternCondition
14891489
}
14901490
public extension ExpressibleAsMatchingPatternCondition {
1491+
/// Conformance to ExpressibleAsConditionElement
1492+
func createConditionElement() -> ConditionElement {
1493+
return ConditionElement(condition: self)
1494+
}
14911495
func createSyntaxBuildable() -> SyntaxBuildable {
14921496
return createMatchingPatternCondition()
14931497
}
14941498
}
1495-
public protocol ExpressibleAsOptionalBindingCondition: ExpressibleAsSyntaxBuildable {
1499+
public protocol ExpressibleAsOptionalBindingCondition: ExpressibleAsConditionElement {
14961500
func createOptionalBindingCondition() -> OptionalBindingCondition
14971501
}
14981502
public extension ExpressibleAsOptionalBindingCondition {
1503+
/// Conformance to ExpressibleAsConditionElement
1504+
func createConditionElement() -> ConditionElement {
1505+
return ConditionElement(condition: self)
1506+
}
14991507
func createSyntaxBuildable() -> SyntaxBuildable {
15001508
return createOptionalBindingCondition()
15011509
}

Sources/SwiftSyntaxBuilder/gyb_helpers/ExpressibleAsConformances.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,15 @@
2121
'FunctionCallExpr': [
2222
'CodeBlockItem'
2323
],
24+
'MatchingPatternCondition': [
25+
'ConditionElement'
26+
],
2427
'MemberDeclList': [
2528
'MemberDeclBlock'
2629
],
30+
'OptionalBindingCondition': [
31+
'ConditionElement'
32+
],
2733
'SequenceExpr': [
2834
'CodeBlockItem',
2935
'TupleExprElement'

Sources/SwiftSyntaxBuilderGeneration/gyb_generated/ExpressibleAsConformances.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,15 @@ let SYNTAX_BUILDABLE_EXPRESSIBLE_AS_CONFORMANCES: [String: [String]] = [
3535
"FunctionCallExpr": [
3636
"CodeBlockItem",
3737
],
38+
"MatchingPatternCondition": [
39+
"ConditionElement",
40+
],
3841
"MemberDeclList": [
3942
"MemberDeclBlock",
4043
],
44+
"OptionalBindingCondition": [
45+
"ConditionElement",
46+
],
4147
"SequenceExpr": [
4248
"CodeBlockItem",
4349
"TupleExprElement",

0 commit comments

Comments
 (0)