Starting to implement Ignored pattern
This commit is contained in:
parent
f2282f0101
commit
dff204069f
@ -63,6 +63,12 @@ pub struct Alternative {
|
||||
pub item: Vec<Stmt>,
|
||||
}
|
||||
|
||||
impl Alternative {
|
||||
fn default(item: Vec<Stmt>) -> Alternative {
|
||||
Alternative { tag: None, guard: None, bound_vars: vec![], item }
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum Lit {
|
||||
Nat(u64),
|
||||
@ -156,12 +162,7 @@ fn reduce_if_expression(discriminator: &Discriminator, body: &IfExpressionBody,
|
||||
|
||||
let alternatives = vec![
|
||||
pat.to_alternative(&cond, then_clause, symbol_table),
|
||||
Alternative {
|
||||
tag: None,
|
||||
guard: None,
|
||||
bound_vars: vec![],
|
||||
item: else_clause,
|
||||
},
|
||||
Alternative::default(else_clause),
|
||||
];
|
||||
|
||||
Expr::CaseMatch {
|
||||
@ -217,7 +218,7 @@ impl Pattern {
|
||||
Record(_name, _pairs) => {
|
||||
unimplemented!()
|
||||
},
|
||||
Ignored => unimplemented!(),
|
||||
Ignored => Alternative::default(item),
|
||||
Literal(lit) => match lit {
|
||||
PatternLiteral::NumPattern { neg, num } => {
|
||||
let comparison = Expr::Lit(match (neg, num) {
|
||||
|
Loading…
Reference in New Issue
Block a user