Simplify use of keyword symbols

This commit is contained in:
Vadim Petrochenkov
2019-05-11 17:41:37 +03:00
parent 37ff5d388f
commit 59a382122f
58 changed files with 502 additions and 534 deletions

View File

@@ -14,7 +14,7 @@ use syntax::parse::lexer::comments;
use syntax::parse::{self, token, ParseSess};
use syntax::tokenstream::{self, DelimSpan, IsJoint::*, TokenStream, TreeAndJoint};
use syntax_pos::hygiene::{SyntaxContext, Transparency};
use syntax_pos::symbol::{keywords, Symbol};
use syntax_pos::symbol::{kw, Symbol};
use syntax_pos::{BytePos, FileName, MultiSpan, Pos, SourceFile, Span};
trait FromInternal<T> {
@@ -142,7 +142,7 @@ impl FromInternal<(TreeAndJoint, &'_ ParseSess, &'_ mut Vec<Self>)>
Question => op!('?'),
SingleQuote => op!('\''),
Ident(ident, false) if ident.name == keywords::DollarCrate.name() =>
Ident(ident, false) if ident.name == kw::DollarCrate =>
tt!(Ident::dollar_crate()),
Ident(ident, is_raw) => tt!(Ident::new(ident.name, is_raw)),
Lifetime(ident) => {
@@ -347,7 +347,7 @@ impl Ident {
}
fn dollar_crate(span: Span) -> Ident {
// `$crate` is accepted as an ident only if it comes from the compiler.
Ident { sym: keywords::DollarCrate.name(), is_raw: false, span }
Ident { sym: kw::DollarCrate, is_raw: false, span }
}
}