Skip to content

Fix Module::display to print function bodies again#10

Merged
cfallin merged 1 commit intobytecodealliance:mainfrom
daxhuiberts:fix-module-display
Feb 25, 2026
Merged

Fix Module::display to print function bodies again#10
cfallin merged 1 commit intobytecodealliance:mainfrom
daxhuiberts:fix-module-display

Conversation

@daxhuiberts
Copy link
Contributor

The change which added PrintDecorator broke the default Module::display by not showing the function bodies anymore when no PrintDecorator was provided.

This change always invokes the body display function again, now with the optional PrintDecorator.

This does change the signature of FunctionBody::display_with_decorator to take an Option<&'a PD> now, which is not consistent with the function convention on Module, but this needs a display function on FunctionBody which takes an Option.

Alternatively I can change this to invoke FunctionBody::display or FunctionBody::display_with_decorator depending on the presence/absence of a decorator, but that feels less ideal.

The change which added `PrintDecorator` broke the default `Module::display`
by not showing the function bodies anymore when no `PrintDecorator` was provided.

This change always invokes the body display function again, now with the optional `PrintDecorator`.
Copy link
Member

@cfallin cfallin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks very much!

@cfallin cfallin merged commit 13b290c into bytecodealliance:main Feb 25, 2026
3 checks passed
@daxhuiberts
Copy link
Contributor Author

I also saw that ModuleDisplay and FunctionBodyDisplay are generic over PrintDecorator.
Perhaps they should not be generic, but accept an Option<&'a dyn PD> which feels more appropriate here.
This will also remove the need of NOPPrintDecorator.

I can make a follow-up PR with this change if you're welcome to it.

@cfallin cfallin mentioned this pull request Mar 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants