Currently it is not directly possible to configure lints for the
entire workspace via TOML, which forced us to repeat `#![allow]`
blocks in each crate.
embark pointed out this workaround to configure lints at the
workspace level via RUSTFLAGS:
https://github.com/EmbarkStudios/rust-ecosystem/issues/22#issuecomment-947011395
Remove the common `#![allow]` blocks and switch to this method for
global lint config.
Temporarily allow `needless_borrow` lint, buggy pending this fix:
https://github.com/rust-lang/rust-clippy/pull/8355
* Have `DefineFunction` and `DefineFunction2` go through the same
code path by implementing `From<DefineFunction>` for
`DefineFunction2`.
* Change `register` to a `Option<NonZeroU8>` for size optimization.
* Add `function::Param` to store param info instead of a tuple.
Use a struct for all variants of `avm1::Action`.
This makes the style more consistent instead of using a mix of
struct and tuple variants, and allows the data to be easily passed
around.
`TextFormat` objects differ from regular objects in that
`TextField.setTextFormat` and `TextField.setNewTextFormat` accept
only the former, and ignore the latter.
Also, `TextFormat.prototype` has native accessors that coerce the
values on get/set.
* Use `TryFlags` instead of hard-coded binary literals.
* Rename `try_length`, `catch_length`, `finally_length` to `try_size`,
`catch_size`, `finally_size` to match SWF19 namings.
* Refactor write and fix a few bugs there:
* The actions length should not include the try, catch, finally
bodies, only the metadata of `flags`, `try_size`, `catch_size`,
`finally_size` and catch variable (either as `u8` or `SwfStr`).
* A placeholder byte should be written in place of the catch variable
when there is no catch clause.
* `try_actions` -> `try_body`
* `catch` -> `catch_body`
* `finally` -> `finally_body`
This aligns with the names used in SWF19, and is more consistent.
Re-number the `ClipEventFlag` enum members to match how they
actually appear in a SWF. This allows much simpler read/write
operations.
Also, gracefully handle malformed ClipActions that are only 1 or 0
bytes, as it seems that Flash accepts those too.
Each function is reduced to just 3 opcodes on x86:
https://godbolt.org/z/n6q6zxnh6
WebAssembly benefits as well: https://godbolt.org/z/fcETE9GYn
This should improve load-time performance because read_f64_me is
used frequently (for each AVM1 double constant).
Let the `Reader` outlive outside the loop, so it tracks its own
position, instead of doing so manually.
Also move `read_from_file` outside and reuse it.
Change two cases to use `Reader::read_slice` instead of `self.input`.
Not only this avoids relying on an implementation detail, this also
raises an `UnexpectedEof` error if the read is beyond the SWF.