Skip to content

Commit aa3bd9d

Browse files
committed
refactor: drop verify IR helpers orphaned by single-roundtrip
readTopology and initialName became unused when the perf commit threaded a single loadIR result through Verify's builders via the FromIR variants. Remove both wrapper functions; update the two prose comments in reach.go and invariant.go that named readTopology. Signed-off-by: Joshua Temple <joshua.temple@stablekernel.com>
1 parent 1abe434 commit aa3bd9d

3 files changed

Lines changed: 4 additions & 25 deletions

File tree

state/verify/invariant.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ func NeverActive(s string) Invariant {
9898

9999
// configGraph is the configuration-product view of a machine's IR: the structural
100100
// information needed to enumerate every reachable configuration of active leaves.
101-
// It is built from the same serialized public IR readTopology flattens, so a
101+
// It is built from the same serialized public IR Verify loads once, so a
102102
// code-built and a JSON-loaded machine explore identically.
103103
type configGraph struct {
104104
// initial is the machine's initial state name; hasInitial guards the empty case.

state/verify/ir.go

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,8 @@ type topology struct {
2121
parent map[string]string
2222
}
2323

24-
// readTopology flattens the machine's IR into a topology. A machine whose IR
25-
// cannot be read yields the zero topology rather than panicking, matching
26-
// Verify's no-panic contract.
27-
func readTopology[S comparable, E comparable, C any](m *state.Machine[S, E, C]) topology {
28-
ir, ok := loadIR(m)
29-
if !ok {
30-
return topology{parent: map[string]string{}}
31-
}
32-
return topologyFromIR(ir)
33-
}
34-
35-
// topologyFromIR builds a topology from an already-loaded IR, so a caller that has
36-
// round-tripped the machine once can reuse it instead of re-serializing.
24+
// topologyFromIR builds a topology from an already-loaded IR. Verify loads the IR
25+
// once and passes it here rather than letting each builder re-serialize.
3726
func topologyFromIR[S comparable, E comparable, C any](ir *state.IR[S, E, C]) topology {
3827
t := topology{parent: map[string]string{}}
3928
for i := range ir.States {
@@ -59,16 +48,6 @@ func collectStates[S comparable, E comparable, C any](s *state.State[S, E, C], p
5948
}
6049
}
6150

62-
// initialName returns the machine's initial state name, or "" when the machine
63-
// declares no initial state.
64-
func initialName[S comparable, E comparable, C any](m *state.Machine[S, E, C]) string {
65-
ir, ok := loadIR(m)
66-
if !ok {
67-
return ""
68-
}
69-
return initialNameFromIR(ir)
70-
}
71-
7251
// initialNameFromIR returns the initial state name from an already-loaded IR.
7352
func initialNameFromIR[S comparable, E comparable, C any](ir *state.IR[S, E, C]) string {
7453
if !ir.HasInitial {

state/verify/reach.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import (
3333

3434
// searchGraph is the constrained-search view of a machine's IR: the structural
3535
// edges plus, for each node, the active-configuration members its entry brings
36-
// online. It is built from the same serialized public IR readTopology flattens,
36+
// online. It is built from the same serialized public IR Verify loads once,
3737
// so a code-built and a JSON-loaded machine search identically.
3838
type searchGraph struct {
3939
// initial is the machine's initial state name; hasInitial guards the empty case.

0 commit comments

Comments
 (0)