avm1: Use u16 for Property::attributes

This commit is contained in:
Mike Welsh 2022-04-17 11:12:43 -07:00
parent bcd35d6ad7
commit e6cadf7de4
3 changed files with 8 additions and 7 deletions

View File

@ -267,10 +267,10 @@ pub fn as_set_prop_flags<'gc>(
return Ok(Value::Undefined);
};
let set_flags = args.get(2).unwrap_or(&0.into()).coerce_to_f64(activation)? as u8;
let set_flags = args.get(2).unwrap_or(&0.into()).coerce_to_f64(activation)? as u16;
let set_attributes = Attribute::from_bits_truncate(set_flags);
let clear_flags = args.get(3).unwrap_or(&0.into()).coerce_to_f64(activation)? as u8;
let clear_flags = args.get(3).unwrap_or(&0.into()).coerce_to_f64(activation)? as u16;
let clear_attributes = Attribute::from_bits_truncate(clear_flags);
if set_attributes.bits() != set_flags || clear_attributes.bits() != clear_flags {

View File

@ -10,10 +10,11 @@ bitflags! {
/// The values are significant and should match the order used by `object::as_set_prop_flags`.
#[derive(Collect)]
#[collect(require_static)]
pub struct Attribute: u8 {
const DONT_ENUM = 1 << 0;
const DONT_DELETE = 1 << 1;
const READ_ONLY = 1 << 2;
pub struct Attribute: u16 {
const DONT_ENUM = 1 << 0;
const DONT_DELETE = 1 << 1;
const READ_ONLY = 1 << 2;
const VERSION_MASK = 0xf << 9;
}
}

View File

@ -27,7 +27,7 @@ pub struct Declaration {
// This should be an `Attribute`, but because of `const` shenanigans
// we need to store the raw flags.
// See the comment in the `declare_properties!` macro.
pub attributes: u8,
pub attributes: u16,
}
/// All the possible types of a [`Declaration`].