Skip to content
← Back

src/semantic/symbols/store_free_bits.ghul

1
namespace Semantic.Symbols is
2
// The proven store-free bits, keyed by symbol id rather than held
3
// on Function objects. Keying by id keeps a function's bit alive
4
// across an incremental edit that replaces the symbol object, when
5
// the replacement adopts the outgoing symbol's id — so a hover through
6
// a retained caller, which can still hold the outgoing symbol,
7
// answers the same as one through the replacement. An edit that
8
// also changes the body resets the carried bit to the conservative
9
// default instead of trusting it; the next solve re-derives it.
10
//
11
// Absent means false — "not proven", the sound default. Cleared
12
// whenever the symbol tables are cleared: a full rebuild re-creates
13
// every symbol with a fresh id and re-derives every bit, so stale
14
// entries would only accumulate.
15
class STORE_FREE_BITS is
16
_bits: Collections.MutableMap[int, bool]? static
17
18
bits: Collections.MutableMap[int, bool] static is
19
if !_bits? then
20
_bits = Collections.MAP[int, bool]()
21
fi
22
23
return _bits
24
si
25
26
is_proven_store_free(id: int) -> bool static =>
27
_bits? /\ _bits.contains_key(id) /\ _bits![id]
28
29
set_proven_store_free(id: int, value: bool) static is
30
bits[id] = value
31
si
32
33
clear() static is
34
if _bits? then
35
_bits.clear()
36
fi
37
si
38
si
39
si