Skip to content

Commit dcbe892

Browse files
author
Jonas Schievink
committed
Add an HIR pretty-printer
1 parent b6d59f2 commit dcbe892

File tree

12 files changed

+914
-203
lines changed

12 files changed

+914
-203
lines changed

crates/hir-def/src/body.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ mod lower;
44
#[cfg(test)]
55
mod tests;
66
pub mod scope;
7+
mod pretty;
78

89
use std::{ops::Index, sync::Arc};
910

@@ -352,6 +353,10 @@ impl Body {
352353
}
353354
}
354355

356+
pub fn pretty_print(&self, db: &dyn DefDatabase, owner: DefWithBodyId) -> String {
357+
pretty::print_body_hir(db, self, owner)
358+
}
359+
355360
fn new(
356361
db: &dyn DefDatabase,
357362
expander: Expander,

0 commit comments

Comments
 (0)