Skip to content

Add Documentation to Closure & Await Syntax Nodes#3271

Open
nazaralwi wants to merge 2 commits intoswiftlang:mainfrom
nazaralwi:doc-for-closure-await-syntax
Open

Add Documentation to Closure & Await Syntax Nodes#3271
nazaralwi wants to merge 2 commits intoswiftlang:mainfrom
nazaralwi:doc-for-closure-await-syntax

Conversation

@nazaralwi
Copy link

As part of #1528, the documentation is added to Closure and Await Syntax nodes.

And I think some node names are outdated. Current mappings:

  • ClosureCaptureItemSpecifierSyntaxClosureCaptureSpecifierSyntax
  • ClosureCaptureItemSyntaxClosureCaptureSyntax
  • ClosureCaptureSignatureSyntaxClosureCaptureClauseSyntax
  • ClosureParamSyntaxClosureShorthandParameterSyntax

Copy link
Member

@rintaro rintaro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for doing this!

{ (x: Int, y: Int) -> Int in
return x + y
}
```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you clarify which parts of the example are ClosureParameterSyntax?


```swift
{ (x: Int, y: Int) in x + y }
```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto. which part?

let doubled = numbers.map { [weak self] x -> Int in
return x * 2
}
```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto.

}
```

Everything before the `in` keyword is part of the closure signature.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything after { and up to in.

@nazaralwi nazaralwi requested a review from rintaro February 22, 2026 07:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants