You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// Internal initializer used by swift-syntax to create labeled expressions from existing syntax nodes.
838
+
///
839
+
/// This initializer is not intended for direct use when creating labeled expressions programmatically.
840
+
/// Instead, use the main initializer that accepts individual components.
841
+
///
842
+
/// - Parameters:
843
+
/// - node: An existing syntax node to convert. Must be of kind `.labeledExpr`.
810
844
publicinit?(_ node: __shared someSyntaxProtocol){
811
845
guard node.raw.kind ==.labeledExpr else{
812
846
returnnil
813
847
}
814
848
self._syntaxNode = node._syntaxNode
815
849
}
816
850
851
+
/// Creates a new labeled expression with the given components.
852
+
///
853
+
/// Example creating a labeled string literal argument:
854
+
/// ```swift
855
+
/// let argument = LabeledExprSyntax(
856
+
/// label: .identifier("defaultValue"),
857
+
/// colon: .colonToken(),
858
+
/// expression: stringLiteral
859
+
/// )
860
+
/// ```
861
+
///
817
862
/// - Parameters:
818
-
/// - leadingTrivia: Trivia to be prepended to the leading trivia of the node’s first token. If the node is empty, there is no token to attach the trivia to and the parameter is ignored.
819
-
/// - trailingTrivia: Trivia to be appended to the trailing trivia of the node’s last token. If the node is empty, there is no token to attach the trivia to and the parameter is ignored.
863
+
/// - leadingTrivia: Trivia to be prepended to the leading trivia of the node's first token. If the node is empty, there is no token to attach the trivia to and the parameter is ignored.
864
+
/// - unexpectedBeforeLabel: Used internally by swift-syntax to handle malformed source code. When creating expressions programmatically, you should pass nil.
865
+
/// - label: The optional label for this expression, created using `.identifier()` for named labels or `._` for unnamed ones.
866
+
/// - unexpectedBetweenLabelAndColon: Used internally by swift-syntax to handle malformed source code. When creating expressions programmatically, you should pass nil.
867
+
/// - colon: The colon token that follows the label, created using `.colonToken()`.
868
+
/// - unexpectedBetweenColonAndExpression: Used internally by swift-syntax to handle malformed source code. When creating expressions programmatically, you should pass nil.
869
+
/// - expression: The expression being labeled.
870
+
/// - unexpectedBetweenExpressionAndTrailingComma: Used internally by swift-syntax to handle malformed source code. When creating expressions programmatically, you should pass nil.
871
+
/// - trailingComma: An optional trailing comma, useful when this expression is part of a list.
872
+
/// - unexpectedAfterTrailingComma: Used internally by swift-syntax to handle malformed source code. When creating expressions programmatically, you should pass nil.
873
+
/// - trailingTrivia: Trivia to be appended to the trailing trivia of the node's last token. If the node is empty, there is no token to attach the trivia to and the parameter is ignored.
0 commit comments