Allow overwriting virtual properties via setting `set` to `None`.

This commit is contained in:
David Wendt 2019-10-09 20:37:01 -04:00
parent feaa3dd203
commit d35e36def5
1 changed files with 8 additions and 1 deletions

View File

@ -63,9 +63,16 @@ impl<'gc> Property<'gc> {
new_value: Value<'gc>,
) {
match self {
Property::Virtual { set, .. } => {
Property::Virtual {
set, attributes, ..
} => {
if let Some(function) = set {
function(avm, context, this, &[new_value]);
} else if !attributes.contains(ReadOnly) {
*self = Property::Stored {
value: new_value,
attributes: *attributes,
};
}
}
Property::Stored {