Some more Patterns work

-at first brush, a pattern is like a single Variant with a list of free
vars
This commit is contained in:
greg 2018-06-24 02:15:08 -07:00
parent 927f427a86
commit 0a02c21e70
2 changed files with 6 additions and 2 deletions

View File

@ -132,7 +132,8 @@ pub struct Guard {
#[derive(Debug, PartialEq, Clone)] #[derive(Debug, PartialEq, Clone)]
pub struct Pattern { pub struct Pattern {
pub free_vars: Vec<Rc<String>>,
pub var: Variant,
} }
#[derive(Debug, PartialEq, Clone)] #[derive(Debug, PartialEq, Clone)]

View File

@ -678,7 +678,10 @@ impl Parser {
parse_method!(pattern(&mut self) -> ParseResult<Pattern> { parse_method!(pattern(&mut self) -> ParseResult<Pattern> {
let identifier = self.identifier()?; let identifier = self.identifier()?;
Ok(Pattern { }) Ok(Pattern {
free_vars: vec![],
var: Variant::UnitStruct(identifier)
})
}); });
parse_method!(block(&mut self) -> ParseResult<Block> { parse_method!(block(&mut self) -> ParseResult<Block> {