Change Record variant representation
This commit is contained in:
parent
1ce06bc0ef
commit
c225e469ee
@ -84,7 +84,10 @@ pub struct TypeBody(pub Vec<Variant>);
|
||||
pub enum Variant {
|
||||
UnitStruct(Rc<String>),
|
||||
TupleStruct(Rc<String>, Vec<TypeIdentifier>),
|
||||
Record(Rc<String>, Vec<(Rc<String>, TypeIdentifier)>),
|
||||
Record {
|
||||
name: Rc<String>,
|
||||
members: Vec<(Rc<String>, TypeIdentifier)>,
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Clone)]
|
||||
|
@ -368,7 +368,7 @@ impl Parser {
|
||||
},
|
||||
LCurlyBrace => {
|
||||
let typed_identifier_list = delimited!(self, LCurlyBrace, typed_identifier, Comma, RCurlyBrace);
|
||||
Ok(Record(name, typed_identifier_list))
|
||||
Ok(Record {name, members: typed_identifier_list })
|
||||
},
|
||||
_ => Ok(UnitStruct(name))
|
||||
}
|
||||
@ -1346,10 +1346,13 @@ fn a(x) {
|
||||
Singleton(TypeSingletonName { name: rc!(Int), params: vec![] }),
|
||||
Singleton(TypeSingletonName { name: rc!(Option), params: vec![Singleton(TypeSingletonName { name: rc!(a), params: vec![] })] }),
|
||||
]),
|
||||
Record(rc!(Esperanza), vec![
|
||||
Record{
|
||||
name: rc!(Esperanza),
|
||||
members: vec![
|
||||
(rc!(a), Singleton(TypeSingletonName { name: rc!(Int), params: vec![] })),
|
||||
(rc!(b), Singleton(TypeSingletonName { name: rc!(String), params: vec![] })),
|
||||
])
|
||||
]
|
||||
}
|
||||
]),
|
||||
mutable: false
|
||||
}))]));
|
||||
|
Loading…
Reference in New Issue
Block a user