Add switch expression.

This commit is contained in:
Stephen Chung
2020-11-13 18:32:18 +08:00
parent 7d1b971b39
commit 55b4907f19
19 changed files with 547 additions and 252 deletions

View File

@@ -3,7 +3,7 @@
use crate::fn_native::{FnPtr, SendSync};
use crate::r#unsafe::{unsafe_cast_box, unsafe_try_cast};
use crate::utils::ImmutableString;
use crate::INT;
use crate::{StaticVec, INT};
#[cfg(not(feature = "no_closure"))]
use crate::fn_native::{shared_try_take, Locked, Shared};
@@ -378,10 +378,15 @@ impl Hash for Dynamic {
#[cfg(not(feature = "no_index"))]
Union::Array(a) => a.hash(state),
#[cfg(not(feature = "no_object"))]
Union::Map(m) => m.iter().for_each(|(key, item)| {
key.hash(state);
item.hash(state);
}),
Union::Map(m) => {
let mut buf: StaticVec<_> = m.keys().collect();
buf.sort();
buf.into_iter().for_each(|key| {
key.hash(state);
m[key].hash(state);
})
}
#[cfg(not(feature = "no_closure"))]
#[cfg(not(feature = "sync"))]