forked from libre-chip/fayalite
redo #[hdl(sim)] match/let destructuring to support matching values of type Type::SimValue
This commit is contained in:
parent
7e9d7739fb
commit
2266315944
4 changed files with 183 additions and 116 deletions
|
|
@ -1096,11 +1096,9 @@ impl Visitor<'_> {
|
|||
let (#(#bindings,)*) = {
|
||||
type __MatchTy<T> = <T as ::fayalite::ty::Type>::SimValue;
|
||||
let __match_value = #expr;
|
||||
let __match_value = {
|
||||
use ::fayalite::sim::value::match_sim_value::*;
|
||||
// use method syntax to deduce the correct trait to call
|
||||
::fayalite::sim::value::match_sim_value::MatchSimValueHelper::new(__match_value).__fayalite_match_sim_value()
|
||||
};
|
||||
// use method syntax to deduce what type to convert to
|
||||
let __match_value = ::fayalite::sim::value::match_sim_value::MatchSimValueHelper::new(__match_value)
|
||||
.__fayalite_match_sim_value();
|
||||
#let_token #pat #eq_token __match_value #semi_token
|
||||
(#(#bindings_idents,)*)
|
||||
};
|
||||
|
|
@ -1172,11 +1170,9 @@ impl Visitor<'_> {
|
|||
{
|
||||
type __MatchTy<T> = <T as ::fayalite::ty::Type>::SimValue;
|
||||
let __match_value = #expr;
|
||||
let __match_value = {
|
||||
use ::fayalite::sim::value::match_sim_value::*;
|
||||
// use method syntax to deduce the correct trait to call
|
||||
::fayalite::sim::value::match_sim_value::MatchSimValueHelper::new(__match_value).__fayalite_match_sim_value()
|
||||
};
|
||||
// use method syntax to deduce what type to convert to
|
||||
let __match_value = ::fayalite::sim::value::match_sim_value::MatchSimValueHelper::new(__match_value)
|
||||
.__fayalite_match_sim_value();
|
||||
#match_token __match_value {
|
||||
#(#arms)*
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue