Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add --emit-file option to emit .wat files #413

Merged
merged 5 commits into from
Aug 22, 2024

Conversation

vasucp1207
Copy link
Contributor

@vasucp1207 vasucp1207 commented Aug 21, 2024

Issue #247

Add --emit-flag flag to emit file.wat from file.wasm

@zapashcanon
Copy link
Member

zapashcanon commented Aug 21, 2024

Hi!

Welcome to the project, and thanks for the PR! :)

I added some minor comments. Maybe you could also add an entry in CHANGES.md ?

I have two other questions, it's a little bit unusual for -o to be a simple flag, one usually expects something like -o outputname.wat. We could either rename -o to --emit-file or change -o from a flag to a parameter expecting an actual file name. WDYT ?

Could you add a small test in test/wasm2wat/ ? You would have to create a file named emit.t for instance, which would have the following content:

test that we can emit to a file:
  $ owi wasm2wat m.wasm --emit-file
  $ cat m.wat

Then you would run dune runtest (it may take a while). You'll then see some output, if it looks correct, you should run dune promote and commit the changes.

You'll need to run the dune runtest+dune promote procedure anyway in order to update the manual pages that are making the CI fail. :)

@vasucp1207
Copy link
Contributor Author

Hi!

Welcome to the project, and thanks for the PR! :)

I added some minor comments. Maybe you could also add an entry in CHANGES.md ?

I have two other questions, it's a little bit unusual for -o to be a simple flag, one usually expects something like -o outputname.wat. We could either rename -o to --emit-file or change -o from a flag to a parameter expecting an actual file name. WDYT ?

Because wasm2wat can take multiple files as arguments, I think it's not a good idea to change -o flag to a parameter that expects a file name, --emit-file is better because it can handle multiple files. Correct me, If I am missing something.

Could you add a small test in test/wasm2wat/ ? You would have to create a file named emit.t for instance, which would have the following content:

test that we can emit to a file:
  $ owi wasm2wat m.wasm --emit-file
  $ cat m.wat

Then you would run dune runtest (it may take a while). You'll then see some output, if it looks correct, you should run dune promote and commit the changes.

You'll need to run the dune runtest+dune promote procedure anyway in order to update the manual pages that are making the CI fail. :)

@zapashcanon
Copy link
Member

Because wasm2wat can take multiple files as arguments, I think it's not a good idea to change -o flag to a parameter that expects a file name, --emit-file is better because it can handle multiple files. Correct me, If I am missing something.

Indeed, I forgot about it being able to handle multiple files... --emit-file is better indeed.

@vasucp1207 vasucp1207 changed the title add -o option to emit .wat files add --emit-file option to emit .wat files Aug 21, 2024
@zapashcanon
Copy link
Member

Thanks, the tests look good now. I'm going to merge once the two reviews about src/cmd/cmd_wasm2wat.ml are addressed.

@zapashcanon
Copy link
Member

Thanks!

@zapashcanon zapashcanon merged commit d73756b into OCamlPro:main Aug 22, 2024
4 checks passed
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