Refactor and add state to debugger.

This commit is contained in:
Stephen Chung
2022-01-28 18:59:18 +08:00
parent 20baae71d4
commit 66af69aaff
30 changed files with 693 additions and 624 deletions

View File

@@ -1119,18 +1119,18 @@ impl Dynamic {
#[cfg(not(feature = "no_index"))]
Union::Array(ref mut a, _, ref mut access) => {
*access = typ;
a.iter_mut().for_each(|v| {
for v in a.iter_mut() {
v.set_access_mode(typ);
});
}
}
#[cfg(not(feature = "no_index"))]
Union::Blob(_, _, ref mut access) => *access = typ,
#[cfg(not(feature = "no_object"))]
Union::Map(ref mut m, _, ref mut access) => {
*access = typ;
m.values_mut().for_each(|v| {
for v in m.values_mut() {
v.set_access_mode(typ);
});
}
}
#[cfg(not(feature = "no_std"))]
Union::TimeStamp(_, _, ref mut access) => *access = typ,
@@ -1708,14 +1708,14 @@ impl Dynamic {
match self.0 {
#[cfg(not(feature = "no_closure"))]
Union::Shared(ref cell, _, _) => {
let value = crate::func::native::shared_write_lock(cell);
let guard = crate::func::native::locked_write(cell);
if (*value).type_id() != TypeId::of::<T>()
if (*guard).type_id() != TypeId::of::<T>()
&& TypeId::of::<Dynamic>() != TypeId::of::<T>()
{
return None;
} else {
return Some(DynamicWriteLock(DynamicWriteLockInner::Guard(value)));
return Some(DynamicWriteLock(DynamicWriteLockInner::Guard(guard)));
}
}
_ => (),

View File

@@ -611,9 +611,9 @@ impl Scope<'_> {
impl<K: Into<Identifier>> Extend<(K, Dynamic)> for Scope<'_> {
#[inline]
fn extend<T: IntoIterator<Item = (K, Dynamic)>>(&mut self, iter: T) {
iter.into_iter().for_each(|(name, value)| {
for (name, value) in iter {
self.push_dynamic_value(name, AccessMode::ReadWrite, value);
});
}
}
}
@@ -629,7 +629,7 @@ impl<K: Into<Identifier>> FromIterator<(K, Dynamic)> for Scope<'_> {
impl<K: Into<Identifier>> Extend<(K, bool, Dynamic)> for Scope<'_> {
#[inline]
fn extend<T: IntoIterator<Item = (K, bool, Dynamic)>>(&mut self, iter: T) {
iter.into_iter().for_each(|(name, is_constant, value)| {
for (name, is_constant, value) in iter {
self.push_dynamic_value(
name,
if is_constant {
@@ -639,7 +639,7 @@ impl<K: Into<Identifier>> Extend<(K, bool, Dynamic)> for Scope<'_> {
},
value,
);
});
}
}
}