Skip to content

Commit 2d73721

Browse files
committed
Make optional bindings and pattern matchings expressible as ConditionElement
1 parent 441a8c9 commit 2d73721

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
@@ -1488,18 +1488,26 @@ public extension ExpressibleAsAvailabilityCondition {
14881488
return createAvailabilityCondition()
14891489
}
14901490
}
1491-
public protocol ExpressibleAsMatchingPatternCondition: ExpressibleAsSyntaxBuildable {
1491+
public protocol ExpressibleAsMatchingPatternCondition: ExpressibleAsConditionElement {
14921492
func createMatchingPatternCondition() -> MatchingPatternCondition
14931493
}
14941494
public extension ExpressibleAsMatchingPatternCondition {
1495+
/// Conformance to ExpressibleAsConditionElement
1496+
func createConditionElement() -> ConditionElement {
1497+
return ConditionElement(condition: self)
1498+
}
14951499
func createSyntaxBuildable() -> SyntaxBuildable {
14961500
return createMatchingPatternCondition()
14971501
}
14981502
}
1499-
public protocol ExpressibleAsOptionalBindingCondition: ExpressibleAsSyntaxBuildable {
1503+
public protocol ExpressibleAsOptionalBindingCondition: ExpressibleAsConditionElement {
15001504
func createOptionalBindingCondition() -> OptionalBindingCondition
15011505
}
15021506
public extension ExpressibleAsOptionalBindingCondition {
1507+
/// Conformance to ExpressibleAsConditionElement
1508+
func createConditionElement() -> ConditionElement {
1509+
return ConditionElement(condition: self)
1510+
}
15031511
func createSyntaxBuildable() -> SyntaxBuildable {
15041512
return createOptionalBindingCondition()
15051513
}

Sources/SwiftSyntaxBuilder/gyb_helpers/ExpressibleAsConformances.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,15 @@
2222
'ExprList': [
2323
'ConditionElement'
2424
],
25+
'MatchingPatternCondition': [
26+
'ConditionElement'
27+
],
2528
'MemberDeclList': [
2629
'MemberDeclBlock'
2730
],
31+
'OptionalBindingCondition': [
32+
'ConditionElement'
33+
],
2834
'SequenceExpr': [
2935
'CodeBlockItem',
3036
'TupleExprElement'

Sources/SwiftSyntaxBuilderGeneration/gyb_generated/ExpressibleAsConformances.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,15 @@ let SYNTAX_BUILDABLE_EXPRESSIBLE_AS_CONFORMANCES: [String: [String]] = [
3636
"ExprList": [
3737
"ConditionElement",
3838
],
39+
"MatchingPatternCondition": [
40+
"ConditionElement",
41+
],
3942
"MemberDeclList": [
4043
"MemberDeclBlock",
4144
],
45+
"OptionalBindingCondition": [
46+
"ConditionElement",
47+
],
4248
"SequenceExpr": [
4349
"CodeBlockItem",
4450
"TupleExprElement",

0 commit comments

Comments
 (0)