Skip to content

Commit 13b290c

Browse files
authored
Merge pull request #10 from daxhuiberts/fix-module-display
Fix `Module::display` to print function bodies again
2 parents c2ab5cf + ce13572 commit 13b290c

2 files changed

Lines changed: 12 additions & 10 deletions

File tree

src/ir/display.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -322,14 +322,16 @@ impl<'a, PD: PrintDecorator> Display for ModuleDisplay<'a, PD> {
322322
sig_strs.get(&sig).unwrap()
323323
)?;
324324

325-
if let Some(decorator) = &self.decorators {
326-
let decorator = &(*decorator)(func);
327-
writeln!(
328-
f,
329-
"{}",
330-
body.display_with_decorator(" ", Some(self.module), decorator)
331-
)?;
332-
}
325+
let decorator = self
326+
.decorators
327+
.as_ref()
328+
.map(|decorator_fn| decorator_fn(func));
329+
330+
writeln!(
331+
f,
332+
"{}",
333+
body.display_with_decorator(" ", Some(self.module), decorator.as_ref())
334+
)?;
333335
}
334336
FuncDecl::Lazy(sig, name, reader) => {
335337
writeln!(

src/ir/func.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -471,14 +471,14 @@ impl FunctionBody {
471471
&'a self,
472472
indent: &'a str,
473473
module: Option<&'a Module>,
474-
decorator: &'a PD,
474+
decorator: Option<&'a PD>,
475475
) -> FunctionBodyDisplay<'a, PD> {
476476
FunctionBodyDisplay {
477477
body: self,
478478
indent,
479479
verbose: false,
480480
module,
481-
decorator: Some(&decorator),
481+
decorator: decorator,
482482
}
483483
}
484484

0 commit comments

Comments
 (0)