pub fn print_stmt(stmt: &TsStmt, depth: usize) -> StringExpand description
Print a single TsStmt on its own, at depth — the statement-level
sibling of print_type’s own “one fragment, not a whole document”
entry point. bynk-emit‘s own #1333 need (emit_doc_block, a shared
helper spliced into ~14 still-unconverted callers’ own buffers) wants
one statement’s own printed text at a caller-supplied depth, not a
whole TsProgram — no source-map/buffer machinery, matching
print_type’s own scope exactly, and reusing render_stmt’s own
exhaustive per-kind dispatch (this module’s own private renderer)
rather than a second copy.
Review of #1402: a TsStmtKind::Raw nested inside a Switch case’s own
body (emit_stub_rhs’s own ReturnsEach dispatch, Arc C slice 33,
tests_emit.rs slice C) carries the identical “no indent of its own,
pre-indented at a fixed absolute depth” hazard render_class_method’s
and render_multiline_object_entry’s own debug_assert!s already guard
— stmt_contains_raw already recurses into Switch cases, so the same
check applies here, this fragment entry point’s own first Raw-bearing
Switch caller. A bare Raw passed directly as stmt itself is exempt
(not a false negative — render_stmt’s own Raw arm never reads
depth at all, so calling print_stmt on a bare Raw is safe at any
depth, the established print_stmt_renders_raw_text_verbatim_with_no_ added_indent_or_punctuation contract below): only a Raw nested inside
a depth-using wrapper (like this Switch case) is the real hazard.