@@ -487,7 +487,7 @@ func (n *nodeContext) checkTypos() {
487
487
replacements := na .getReplacements (nil ) // TODO(perf): use buffer
488
488
required := slices .Clone (required ) // TODO(perf): use buffer
489
489
// do the right thing in appendRequired either way.
490
- required .replaceIDs (replacements ... )
490
+ required .replaceIDs (n . ctx , replacements ... )
491
491
492
492
a = a .DerefDisjunct ()
493
493
// TODO(perf): somehow prevent error generation of recursive structures,
@@ -617,10 +617,10 @@ func (a reqSets) assert() {
617
617
// - If in active definition, replace old definition
618
618
// - If in embed, replace embed in respective sets. definition starts new group
619
619
// - child definition replaces parent definition
620
- func (a * reqSets ) replaceIDs (b ... replaceID ) {
620
+ func (a * reqSets ) replaceIDs (ctx * OpContext , b ... replaceID ) {
621
621
temp := * a
622
622
temp = temp [:0 ]
623
- var buf reqSets
623
+ buf := ctx . reqSetsBuf [: 0 ]
624
624
outer:
625
625
for i := 0 ; i < len (* a ); {
626
626
e := (* a )[i ]
@@ -641,7 +641,7 @@ outer:
641
641
} else {
642
642
temp = append (temp , buf ... )
643
643
}
644
- buf = buf [:0 ] // TODO(perf): use OpContext buffer.
644
+ buf = buf [:0 ]
645
645
}
646
646
}
647
647
@@ -653,6 +653,7 @@ outer:
653
653
buf [0 ].size = uint32 (len (buf ))
654
654
temp = append (temp , buf ... )
655
655
}
656
+ ctx .reqSetsBuf = buf [:0 ] // to be reused later on
656
657
* a = temp
657
658
}
658
659
@@ -772,7 +773,7 @@ outer:
772
773
})
773
774
}
774
775
775
- a .replaceIDs (n .replaceIDs ... )
776
+ a .replaceIDs (n .ctx , n . replaceIDs ... )
776
777
777
778
// If 'v' is a hidden field, then all reqSets in 'a' for which there is no
778
779
// corresponding entry in conjunctInfo should be removed from 'a'.
0 commit comments