forked from binast/binjs-ref
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolves binast#176 - Getting rid of TokenWriter::{list, tagged_tuple…
…, Tree} and the companion code in ast.rs This changeset simplifies trait `io::TokenWriter`, getting rid of some baggage that makes work on entropy needlessly complicated. For backwards compatibility reason, we keep a `io::deprecated::TokenWriterWithTree`, which is essentially a copy of the old `io::TokenWriter`, along with a `io::deprecated::TokenWriterTreeAdapter`, which converts from the old form to the new one. This change should make future work on entropy a bit simpler, improve performance and this has already helped locate a few bugs in the generic implementation of encoding. This change will need to be followed up by a corresponding work on the TokenReader, once we have a clear idea of exactly what needs to be done. 1. `TokenWriter` doesn't define a type `Tree` anymore. Rather, on success, all methods return `()`. Consequently, all implementations of `Serializer`, which returned `TokenWriter::Tree` on success now return `()` on success. This includes both hardcoded implementations and implementations extracted from the webidl. 2. `TokenWriter` doesn't take a `Vec` of children for lists and tagged tuples anymore. Consequently, we adapt the code generator to not create these `Vec` of children anymore. 3. Similarly, the generic implementation of encoding (which might not be useful anymore, but it's still here for the moment) needs to be adapted to the new `TokenWriter`. This requires a few contorsions in binjs_generic/src/io/encode.rs. 4. Both methods `Encoder::encode`, which give access to all token writers now use `TokenWriterTreeAdapter` for older implementations of `TokenWriterWithThree`. 5. We adapt the entropy dictionary builder to this new `TokenWriter`, which essentially means removing now useless code. 6. Other implementations of `TokenWriter` move to `TokenWriterWithTree`, which changes essentially the interface name. 7. Adding methods `from_rc_string` to all types derived from `SharedString`. 8. Adapting tests to the API changes.
- Loading branch information
Showing
16 changed files
with
444 additions
and
223 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Oops, something went wrong.