Subpattern field
This commit is contained in:
parent
e57d33eae7
commit
fef66e345b
@ -58,14 +58,15 @@ pub enum Expr {
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Alternative {
|
||||
pub tag: Option<usize>,
|
||||
pub guard: Option<Expr>, //TODO should be a vec
|
||||
pub subpatterns: Vec<Alternative>,
|
||||
pub guard: Option<Expr>,
|
||||
pub bound_vars: Vec<Option<Rc<String>>>, //remember that order matters here
|
||||
pub item: Vec<Stmt>,
|
||||
}
|
||||
|
||||
impl Alternative {
|
||||
fn default(item: Vec<Stmt>) -> Alternative {
|
||||
Alternative { tag: None, guard: None, bound_vars: vec![], item }
|
||||
Alternative { tag: None, subpatterns: vec![], guard: None, bound_vars: vec![], item }
|
||||
}
|
||||
}
|
||||
|
||||
@ -216,9 +217,13 @@ impl Pattern {
|
||||
}).collect();
|
||||
*/
|
||||
|
||||
let guard = None;
|
||||
let subpatterns = vec![];
|
||||
|
||||
Alternative {
|
||||
tag: Some(tag),
|
||||
guard: None,
|
||||
subpatterns,
|
||||
guard,
|
||||
bound_vars,
|
||||
item,
|
||||
}
|
||||
@ -251,6 +256,7 @@ impl Pattern {
|
||||
});
|
||||
Alternative {
|
||||
tag: None,
|
||||
subpatterns: vec![],
|
||||
guard,
|
||||
bound_vars: vec![],
|
||||
item
|
||||
@ -268,6 +274,7 @@ impl Pattern {
|
||||
});
|
||||
Alternative {
|
||||
tag: None,
|
||||
subpatterns: vec![],
|
||||
guard,
|
||||
bound_vars: vec![],
|
||||
item
|
||||
@ -277,6 +284,7 @@ impl Pattern {
|
||||
Some(symbol) => handle_symbol(symbol, &vec![], item),
|
||||
None => Alternative {
|
||||
tag: None,
|
||||
subpatterns: vec![],
|
||||
guard: None,
|
||||
bound_vars: vec![Some(var.clone())],
|
||||
item
|
||||
|
Loading…
Reference in New Issue
Block a user