mirror of
https://github.com/erg-lang/erg.git
synced 2025-09-30 12:51:10 +00:00
Fix match
codegen
This commit is contained in:
parent
d63b018371
commit
771be313a9
7 changed files with 173 additions and 80 deletions
|
@ -2241,6 +2241,8 @@ impl From<&Identifier> for Field {
|
|||
}
|
||||
|
||||
impl Identifier {
|
||||
pub const UBAR: &Self = &Self::new(None, VarName::from_static("_"));
|
||||
|
||||
pub const fn new(dot: Option<Token>, name: VarName) -> Self {
|
||||
Self { dot, name }
|
||||
}
|
||||
|
|
|
@ -466,7 +466,7 @@ impl Desugarer {
|
|||
);
|
||||
}
|
||||
}
|
||||
VarPattern::Ident(_i) => {
|
||||
VarPattern::Ident(_) | VarPattern::Discard(_) => {
|
||||
let block = body
|
||||
.block
|
||||
.into_iter()
|
||||
|
@ -476,7 +476,6 @@ impl Desugarer {
|
|||
let def = Def::new(Signature::Var(v), body);
|
||||
new.push(Expr::Def(def));
|
||||
}
|
||||
_ => {}
|
||||
},
|
||||
Expr::Def(Def {
|
||||
sig: Signature::Subr(mut subr),
|
||||
|
@ -582,11 +581,10 @@ impl Desugarer {
|
|||
);
|
||||
}
|
||||
}
|
||||
VarPattern::Ident(_ident) => {
|
||||
VarPattern::Ident(_) | VarPattern::Discard(_) => {
|
||||
let def = Def::new(Signature::Var(sig.clone()), body);
|
||||
new_module.push(Expr::Def(def));
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue