Expand description
The rewriting pass.
Rewriter walks the function with synβs VisitMut, innermost blocks first. In every block
of async code it
- hands
forandwhileloops tocrate::loops, - exposes awaits hidden inside larger statements (
Rewriter::expose_awaits), - splits the block into regions at barriers and schedules each region
(
crate::schedule).
A block whose regions all stay sequential is emitted exactly as written.
StructsΒ§
- Rewriter π
- The state of one
#[psync::graph]expansion.
ConstantsΒ§
- MAX_
HOIST_ πDEPTH - How many times a statement may be split while exposing nested awaits.
FunctionsΒ§
- awaited_
value π - Whether a
letβs value is itself awaited (x.await,x.await?,x.await.len()), so the binding is already a node of its own await and there is nothing to expose. - bind_
values π - Record what
stmtβs bindings name. Aletof one immutable name binds the target its value names, if that says more than βanythingβ and depends on nomutbinding (so it is the same value wherever the name is used). Any binding forgets what was known of its name, and of the values computed from it (they were computed from the shadowed one). - is_
control_ πflow - A statement that is, or binds, a branch or a loop.