Coverage Report

Created: 2026-08-15 07:39

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
10.7k
pub fn reset() {
7
10.7k
    NEXT.with(|c| c.set(0));
8
10.7k
}
9
10
49.4k
pub fn generate(span: Span) -> Id<'static> {
11
49.4k
    NEXT.with(|next| {
12
49.4k
        let generation = next.get() + 1;
13
49.4k
        next.set(generation);
14
49.4k
        Id::gensym(span, generation)
15
49.4k
    })
16
49.4k
}
17
18
39.9k
pub fn fill<'a>(span: Span, slot: &mut Option<Id<'a>>) -> Id<'a> {
19
39.9k
    *slot.get_or_insert_with(|| generate(span))
20
39.9k
}