1
0
Fork 0

redo #[hdl(sim)] match/let destructuring to support matching values of type Type::SimValue

This commit is contained in:
Jacob Lifshay 2026-05-03 22:35:30 -07:00
parent 7e9d7739fb
commit 2266315944
Signed by: programmerjake
SSH key fingerprint: SHA256:HnFTLGpSm4Q4Fj502oCFisjZSoakwEuTsJJMSke63RQ
4 changed files with 183 additions and 116 deletions

View file

@ -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)*
}