mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Some structures of syntax nodes can have children choices, e.g. a dictionary expression can either contain a single ':' token or a list of key-value pairs. This patch gives the existing code generation infrastructure a way to specify such node choices. Node choices are specified under a child declaration with two constraints: a choice cannot be declared as optional, and a choice cannot have further recursive choices. Since we don't have too many node structures with choices, part of the SyntaxFactory code for these nodes is manually typed. This patch also teaches AccessorBlock to use node choices.
12 KiB
12 KiB