Guard against setters mutating constants, and allow pure setters.

This commit is contained in:
Stephen Chung
2021-05-15 11:41:42 +08:00
parent 565134c4da
commit 941e09d29d
15 changed files with 184 additions and 156 deletions

View File

@@ -870,9 +870,15 @@ impl Dynamic {
#[cfg(feature = "decimal")]
Union::Decimal(_, _, access) => *access = typ,
#[cfg(not(feature = "no_index"))]
Union::Array(_, _, access) => *access = typ,
Union::Array(a, _, access) => {
*access = typ;
a.iter_mut().for_each(|v| v.set_access_mode(typ));
}
#[cfg(not(feature = "no_object"))]
Union::Map(_, _, access) => *access = typ,
Union::Map(m, _, access) => {
*access = typ;
m.values_mut().for_each(|v| v.set_access_mode(typ));
}
#[cfg(not(feature = "no_std"))]
Union::TimeStamp(_, _, access) => *access = typ,
#[cfg(not(feature = "no_closure"))]