@@ -855,12 +855,42 @@ public struct KeyPathComponentListSyntax: SyntaxCollection, SyntaxHashable {
855
855
public static let syntaxKind = SyntaxKind . keyPathComponentList
856
856
}
857
857
858
+ /// A list of labeled expressions used in function calls, macro expansions, and other contexts where arguments can have labels.
859
+ ///
860
+ /// This collection represents a list of expressions that may have labels, such as function call arguments or macro parameters.
861
+ ///
862
+ /// Example of creating a list of labeled arguments:
863
+ /// ```swift
864
+ /// let arguments = LabeledExprListSyntax {
865
+ /// LabeledExprSyntax(
866
+ /// label: .identifier("localized"),
867
+ /// colon: .colonToken(),
868
+ /// expression: stringLiteral
869
+ /// )
870
+ /// LabeledExprSyntax(
871
+ /// label: .identifier("defaultValue"),
872
+ /// colon: .colonToken(),
873
+ /// expression: defaultValueLiteral
874
+ /// )
875
+ /// }
876
+ /// ```
877
+ ///
878
+ /// Example of creating a function call with labeled arguments:
879
+ /// ```swift
880
+ /// let functionCall = FunctionCallExprSyntax(
881
+ /// calledExpression: ExprSyntax(name),
882
+ /// leftParen: .leftParenToken(),
883
+ /// arguments: arguments,
884
+ /// rightParen: .rightParenToken()
885
+ /// )
886
+ /// ```
887
+ ///
858
888
/// ### Children
859
- ///
889
+ ///
860
890
/// ``LabeledExprSyntax`` `*`
861
891
///
862
892
/// ### Contained in
863
- ///
893
+ ///
864
894
/// - ``AttributeSyntax``.``AttributeSyntax/arguments``
865
895
/// - ``ExpressionSegmentSyntax``.``ExpressionSegmentSyntax/expressions``
866
896
/// - ``FunctionCallExprSyntax``.``FunctionCallExprSyntax/arguments``
@@ -874,6 +904,21 @@ public struct LabeledExprListSyntax: SyntaxCollection, SyntaxHashable {
874
904
875
905
public let _syntaxNode : Syntax
876
906
907
+ /// Creates a list of labeled expressions from a syntax node.
908
+ ///
909
+ /// Example:
910
+ /// ```swift
911
+ /// let arguments = LabeledExprListSyntax {
912
+ /// LabeledExprSyntax(
913
+ /// label: .identifier("name"),
914
+ /// colon: .colonToken(),
915
+ /// expression: nameExpr
916
+ /// )
917
+ /// }
918
+ /// ```
919
+ ///
920
+ /// - Parameters:
921
+ /// - node: The syntax node to create the list from. Must be of kind `.labeledExprList`.
877
922
public init ? ( _ node: some SyntaxProtocol ) {
878
923
guard node. raw. kind == . labeledExprList else {
879
924
return nil
0 commit comments