Parse, validate via Process::add_program, and disassemble. Catches the class
of malformed-but-parseable bytecode that disassemble panics on (e.g. issue
#29399, where a non-finalize function declared a future-typed register input).
Pattern matches crates/compiler/src/test_compiler.rs:62-66.
Disassembles Aleo bytecode using the snarkVM network selected by network.
Native: validates via a fresh Process per call. Note the fresh process has
no other programs loaded, so this rejects programs with imports — callers
that have a typed network at compile time and need import-using programs
should prefer disassemble_from_str with a shared process loaded in
topological order. WASM: parse-only via disassemble_from_str_unchecked
(Process is not in the wasm dep set yet).
Parse-only disassembly. Performs grammar-level checks via Program::from_str
and converts to the leo AST. Prefer disassemble_from_str (native) if you
have a Process and want the snarkVM semantic checks that reject the class
of malformed-but-parseable bytecode that disassemble panics on; this
_unchecked variant skips that step.
Validate program via process.add_program and disassemble. Same add_program + disassemble tail as
disassemble_from_str, but accepts an already-parsed Program so callers that need to peek at imports first
(to build a topological load order, say) don’t pay for a re-parse. process must already have all of
program’s declared imports loaded.