Add the feature gate for the super let
experiment.
This commit is contained in:
parent
2a06022951
commit
40b1f4899a
7 changed files with 39 additions and 1 deletions
|
@ -73,7 +73,20 @@ impl<'a> Parser<'a> {
|
|||
});
|
||||
}
|
||||
|
||||
let stmt = if self.token.is_keyword(kw::Let) {
|
||||
let stmt = if self.token.is_keyword(kw::Super) && self.is_keyword_ahead(1, &[kw::Let]) {
|
||||
self.collect_tokens(None, attrs, force_collect, |this, attrs| {
|
||||
this.expect_keyword(exp!(Super))?;
|
||||
this.psess.gated_spans.gate(sym::super_let, this.prev_token.span);
|
||||
this.expect_keyword(exp!(Let))?;
|
||||
let local = this.parse_local(attrs)?; // FIXME(mara): implement super let
|
||||
let trailing = Trailing::from(capture_semi && this.token == token::Semi);
|
||||
Ok((
|
||||
this.mk_stmt(lo.to(this.prev_token.span), StmtKind::Let(local)),
|
||||
trailing,
|
||||
UsePreAttrPos::No,
|
||||
))
|
||||
})?
|
||||
} else if self.token.is_keyword(kw::Let) {
|
||||
self.collect_tokens(None, attrs, force_collect, |this, attrs| {
|
||||
this.expect_keyword(exp!(Let))?;
|
||||
let local = this.parse_local(attrs)?;
|
||||
|
|
|
@ -114,6 +114,7 @@ pub enum TokenType {
|
|||
KwSelfUpper,
|
||||
KwStatic,
|
||||
KwStruct,
|
||||
KwSuper,
|
||||
KwTrait,
|
||||
KwTry,
|
||||
KwType,
|
||||
|
@ -250,6 +251,7 @@ impl TokenType {
|
|||
KwSelfUpper,
|
||||
KwStatic,
|
||||
KwStruct,
|
||||
KwSuper,
|
||||
KwTrait,
|
||||
KwTry,
|
||||
KwType,
|
||||
|
@ -324,6 +326,7 @@ impl TokenType {
|
|||
TokenType::KwSelfUpper => Some(kw::SelfUpper),
|
||||
TokenType::KwStatic => Some(kw::Static),
|
||||
TokenType::KwStruct => Some(kw::Struct),
|
||||
TokenType::KwSuper => Some(kw::Super),
|
||||
TokenType::KwTrait => Some(kw::Trait),
|
||||
TokenType::KwTry => Some(kw::Try),
|
||||
TokenType::KwType => Some(kw::Type),
|
||||
|
@ -549,6 +552,7 @@ macro_rules! exp {
|
|||
(SelfUpper) => { exp!(@kw, SelfUpper, KwSelfUpper) };
|
||||
(Static) => { exp!(@kw, Static, KwStatic) };
|
||||
(Struct) => { exp!(@kw, Struct, KwStruct) };
|
||||
(Super) => { exp!(@kw, Super, KwSuper) };
|
||||
(Trait) => { exp!(@kw, Trait, KwTrait) };
|
||||
(Try) => { exp!(@kw, Try, KwTry) };
|
||||
(Type) => { exp!(@kw, Type, KwType) };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue