ast: Add the "Self" type in preparation for cl-typeck
This commit is contained in:
parent
e3f08ac013
commit
5484d96e7d
@ -187,6 +187,7 @@ pub struct Ty {
|
||||
pub enum TyKind {
|
||||
Never,
|
||||
Empty,
|
||||
SelfTy,
|
||||
Path(Path),
|
||||
Tuple(TyTuple),
|
||||
Ref(TyRef),
|
||||
|
@ -214,6 +214,7 @@ mod display {
|
||||
match &self.kind {
|
||||
TyKind::Never => "!".fmt(f),
|
||||
TyKind::Empty => "()".fmt(f),
|
||||
TyKind::SelfTy => "Self".fmt(f),
|
||||
TyKind::Path(v) => v.fmt(f),
|
||||
TyKind::Tuple(v) => v.fmt(f),
|
||||
TyKind::Ref(v) => v.fmt(f),
|
||||
|
@ -676,6 +676,10 @@ impl<'t> Parser<'t> {
|
||||
self.consume_peeked();
|
||||
TyKind::Never
|
||||
}
|
||||
Type::Keyword(Keyword::SelfTy) => {
|
||||
self.consume_peeked();
|
||||
TyKind::SelfTy
|
||||
}
|
||||
Type::Amp | Type::AmpAmp => self.tyref()?.into(),
|
||||
Type::LParen => self.tytuple()?.into(),
|
||||
Type::Keyword(Keyword::Fn) => self.tyfn()?.into(),
|
||||
|
Loading…
Reference in New Issue
Block a user