Add ReadModule(), which reads full binary module #35
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.
Previously the only way to read a module was lazily, section by section.
That's still the most efficient way to read a module, but if you know
that you'll need the full contents anyway, it's nicer to have a function
that reads all the sections into their components directly.
This change renames
ReadModule
toReadLazyModule
, and introduces anew
ReadModule
function that reads into the existingbinary::Module
struct.
This required a few other changes:
The binary visitor was accidentally removing some of the locations;
Some module reading errors are only logged to the
wasp::Errors
struct, so you can't easily know whether reading the module succeeded
unless you query that struct. The
TextErrors
andBinaryErrors
derived classes already had this ability (
has_error()
), so now it is avirtual method on
wasp::Errors
too (renamed toHasError()
)