Removed a few #[allow(dead_code)]#4299
Merged
daxpedda merged 3 commits intowasm-bindgen:mainfrom Nov 29, 2024
Merged
Conversation
daxpedda
approved these changes
Nov 29, 2024
Member
daxpedda
left a comment
There was a problem hiding this comment.
LGTM.
Will look into the other unused fields.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes:
nargsfield inAuxImport::Closure. The field wasn't used because the generated JS code used...argsto capture any number of arguments. If this information is necessary in the future,AuxImport::Closurealready includes the adapter ID of the closure function and the number of args can be retrieved from that.holefield inInstruction::OptionWasmToStringEnum. The bindings have a comment explaining how the hole is handled implicitly as an "invalid" value, so it doesn't need to know the actual value of the hole.So about the integer conversion: Instead of removing the unused fields, I realized that
Instruction::IntToWasmandInstruction::WasmToIntwere kind of busted. The main issue is that they not only carried redundant data, but could also carry invalid data.To fix this, I first split both into 64 and 32 variants. This immediately makes the JS -> WASM conversions nops. The WASM -> JS directions are also simpler, because they just need a single
boolof data to select the correct conversion.This also fixes a minor bug in
representable_without_js_glue. The function previously incorrectly determined thatWASM -> JS u64andWASM -> JS NonNulldid not require glue code. This was trivial to fix with the new representation.This PR should not affect the output of the CLI in any way.