Coverage Report

Created: 2026-08-28 08:35

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/wasm-tools/crates/wast/src/gensym.rs
Line
Count
Source
1
use crate::token::{Id, Span};
2
use std::cell::Cell;
3
4
thread_local!(static NEXT: Cell<u32> = Cell::new(0));
5
6
3.73k
pub fn reset() {
7
3.73k
    NEXT.with(|c| c.set(0));
8
3.73k
}
9
10
17.1k
pub fn generate(span: Span) -> Id<'static> {
11
17.1k
    NEXT.with(|next| {
12
17.1k
        let generation = next.get() + 1;
13
17.1k
        next.set(generation);
14
17.1k
        Id::gensym(span, generation)
15
17.1k
    })
16
17.1k
}
17
18
14.4k
pub fn fill<'a>(span: Span, slot: &mut Option<Id<'a>>) -> Id<'a> {
19
14.4k
    *slot.get_or_insert_with(|| generate(span))
20
14.4k
}