@@ -672,13 +672,8 @@ func skipBelow(heads []DocHeading, rootLevel int) []DocHeading {
672672 return out
673673}
674674
675- // isClaimed reports whether idx is a member of claimed. claimed is a
676- // set — every entry is written exactly once, via claimed[idx] =
677- // struct{}{} — so map[int]struct{} (zero-byte value) replaces the
678- // map[int]bool every read/write site in this file, matchtree.go, and
679- // validate_content.go used to spell as a truthy map read. See
680- // docs/development/high-performance-go.md "map[K]struct{} for sets".
681- func isClaimed (claimed map [int ]struct {}, idx int ) bool {
675+ // IsClaimed reports whether idx is a member of the claimed set.
676+ func IsClaimed (claimed map [int ]struct {}, idx int ) bool {
682677 _ , ok := claimed [idx ]
683678 return ok
684679}
@@ -715,7 +710,7 @@ func validateScopes(
715710 claimed [i ] = struct {}{}
716711 continue
717712 }
718- if isClaimed (claimed , i ) {
713+ if IsClaimed (claimed , i ) {
719714 continue
720715 }
721716 newIdx , scDiags , claimedThis := matchScope (
@@ -725,7 +720,7 @@ func validateScopes(
725720 docIdx = newIdx
726721 if claimedThis {
727722 allowExtra = false
728- } else if ! isClaimed (claimed , i ) && sc .Required () {
723+ } else if ! IsClaimed (claimed , i ) && sc .Required () {
729724 // Anchor the missing section at the heading it should
730725 // follow (the preceding document heading), so the
731726 // squiggle lands where the section belongs rather than
@@ -898,7 +893,7 @@ func claimedScopeMatches(
898893 claimCounts map [int ]int , docFM map [string ]any ,
899894) (int , bool ) {
900895 for i , sc := range scopes {
901- if ! isClaimed (claimed , i ) {
896+ if ! IsClaimed (claimed , i ) {
902897 continue
903898 }
904899 if sc .Preamble || isSlotMatcher (sc .Matcher ) {
@@ -961,7 +956,7 @@ func unclaimedListedScope(
961956 docFM map [string ]any ,
962957) int {
963958 for i , sc := range scopes {
964- if isClaimed (claimed , i ) || sc .Preamble || isSlotMatcher (sc .Matcher ) {
959+ if IsClaimed (claimed , i ) || sc .Preamble || isSlotMatcher (sc .Matcher ) {
965960 continue
966961 }
967962 if scopeMatchesHeading (sc , dh , docFM ) {
@@ -1306,7 +1301,7 @@ func anyLaterScopeClaims(
13061301) bool {
13071302 for i := startIdx ; i < len (scopes ); i ++ {
13081303 sc := scopes [i ]
1309- if isClaimed (claimed , i ) || sc .Preamble || isSlotMatcher (sc .Matcher ) {
1304+ if IsClaimed (claimed , i ) || sc .Preamble || isSlotMatcher (sc .Matcher ) {
13101305 continue
13111306 }
13121307 if scopeMatchesHeading (sc , dh , docFM ) {
@@ -1330,7 +1325,7 @@ func claimsLaterLiteral(
13301325) bool {
13311326 for i := startIdx ; i < len (scopes ); i ++ {
13321327 sc := scopes [i ]
1333- if isClaimed (claimed , i ) || sc .Preamble ||
1328+ if IsClaimed (claimed , i ) || sc .Preamble ||
13341329 isSlotMatcher (sc .Matcher ) || isBroadMatcher (sc .Matcher ) {
13351330 continue
13361331 }
@@ -1465,7 +1460,7 @@ func findOutOfOrderIdx(
14651460) int {
14661461 for i := minIdx ; i < len (scopes ); i ++ {
14671462 sc := scopes [i ]
1468- if isClaimed (claimed , i ) || sc .Preamble || isSlotMatcher (sc .Matcher ) {
1463+ if IsClaimed (claimed , i ) || sc .Preamble || isSlotMatcher (sc .Matcher ) {
14691464 continue
14701465 }
14711466 if scopeMatchesHeading (sc , dh , docFM ) {
@@ -1537,7 +1532,7 @@ func scanScopeRunAtLevel(
15371532 var out []int
15381533 started := false
15391534 for i , h := range heads {
1540- if isClaimed (claimed , i ) {
1535+ if IsClaimed (claimed , i ) {
15411536 continue
15421537 }
15431538 if h .Line < parentStart || h .Line >= parentEnd {
@@ -1585,7 +1580,7 @@ func firstWrongLevelMatch(
15851580 return - 1
15861581 }
15871582 for i , h := range heads {
1588- if isClaimed (claimed , i ) {
1583+ if IsClaimed (claimed , i ) {
15891584 continue
15901585 }
15911586 if h .Line < parentStart || h .Line >= parentEnd {
0 commit comments