@@ -451,88 +451,6 @@ public struct CaptureTransform: Hashable, CustomStringConvertible {
451
451
// These wrapper types are required because even @_spi-marked public APIs can't
452
452
// include symbols from implementation-only dependencies.
453
453
454
- extension DSLTree . Node {
455
- func _addCaptures(
456
- to list: inout CaptureList ,
457
- optionalNesting nesting: Int
458
- ) {
459
- let addOptional = nesting+ 1
460
- switch self {
461
- case let . orderedChoice( children) :
462
- for child in children {
463
- child. _addCaptures ( to: & list, optionalNesting: addOptional)
464
- }
465
-
466
- case let . concatenation( children) :
467
- for child in children {
468
- child. _addCaptures ( to: & list, optionalNesting: nesting)
469
- }
470
-
471
- case let . capture( name, _, child) :
472
- list. append ( . init(
473
- name: name,
474
- type: child. valueCaptureType? . base,
475
- optionalDepth: nesting) )
476
- child. _addCaptures ( to: & list, optionalNesting: nesting)
477
-
478
- case let . nonCapturingGroup( kind, child) :
479
- assert ( !kind. ast. isCapturing)
480
- child. _addCaptures ( to: & list, optionalNesting: nesting)
481
-
482
- case let . conditional( cond, trueBranch, falseBranch) :
483
- switch cond. ast {
484
- case . group( let g) :
485
- AST . Node. group ( g) . _addCaptures ( to: & list, optionalNesting: nesting)
486
- default :
487
- break
488
- }
489
-
490
- trueBranch. _addCaptures ( to: & list, optionalNesting: addOptional)
491
- falseBranch. _addCaptures ( to: & list, optionalNesting: addOptional)
492
-
493
-
494
- case let . quantification( amount, _, child) :
495
- var optNesting = nesting
496
- if amount. ast. bounds. atLeast == 0 {
497
- optNesting += 1
498
- }
499
- child. _addCaptures ( to: & list, optionalNesting: optNesting)
500
-
501
- case let . regexLiteral( re) :
502
- return re. ast. _addCaptures ( to: & list, optionalNesting: nesting)
503
-
504
- case let . absentFunction( abs) :
505
- switch abs. ast. kind {
506
- case . expression( _, _, let child) :
507
- child. _addCaptures ( to: & list, optionalNesting: nesting)
508
- case . clearer, . repeater, . stopper:
509
- break
510
- @unknown default :
511
- fatalError ( )
512
- }
513
-
514
- case let . convertedRegexLiteral( n, _) :
515
- return n. _addCaptures ( to: & list, optionalNesting: nesting)
516
-
517
- case . matcher:
518
- break
519
-
520
- case . transform( _, let child) :
521
- child. _addCaptures ( to: & list, optionalNesting: nesting)
522
-
523
- case . customCharacterClass, . atom, . trivia, . empty,
524
- . quotedLiteral, . consumer, . characterPredicate:
525
- break
526
- }
527
- }
528
-
529
- var _captureList : CaptureList {
530
- var list = CaptureList ( )
531
- self . _addCaptures ( to: & list, optionalNesting: 0 )
532
- return list
533
- }
534
- }
535
-
536
454
extension DSLTree {
537
455
/// Presents a wrapped version of `DSLTree.Node` that can provide an internal
538
456
/// `_TreeNode` conformance.
0 commit comments