mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-23 21:23:20 +00:00
libsyntax: Remove ident_to_str
from the parser, which was returning
`@str` values
This commit is contained in:
parent
cbf9f5f5df
commit
3c9e9d35ac
@ -22,7 +22,6 @@ use codemap::{Span, respan};
|
||||
use parse::parser::Parser;
|
||||
use parse::token;
|
||||
|
||||
use std::str;
|
||||
use std::to_bytes;
|
||||
|
||||
/// The specific types of unsupported syntax
|
||||
@ -178,7 +177,8 @@ impl ParserObsoleteMethods for Parser {
|
||||
fn is_obsolete_ident(&mut self, ident: &str) -> bool {
|
||||
match self.token {
|
||||
token::IDENT(sid, _) => {
|
||||
str::eq_slice(self.id_to_str(sid), ident)
|
||||
let interned_string = token::get_ident(sid.name);
|
||||
interned_string.equiv(&ident)
|
||||
}
|
||||
_ => false
|
||||
}
|
||||
|
@ -531,10 +531,11 @@ impl Parser {
|
||||
// otherwise, eat it.
|
||||
pub fn expect_keyword(&mut self, kw: keywords::Keyword) {
|
||||
if !self.eat_keyword(kw) {
|
||||
let id_str = self.id_to_str(kw.to_ident()).to_str();
|
||||
let id_ident = kw.to_ident();
|
||||
let id_interned_str = token::get_ident(id_ident.name);
|
||||
let token_str = self.this_token_to_str();
|
||||
self.fatal(format!("expected `{}`, found `{}`",
|
||||
id_str,
|
||||
id_interned_str.get(),
|
||||
token_str))
|
||||
}
|
||||
}
|
||||
@ -802,10 +803,6 @@ impl Parser {
|
||||
self.sess.span_diagnostic.handler().abort_if_errors();
|
||||
}
|
||||
|
||||
pub fn id_to_str(&mut self, id: Ident) -> @str {
|
||||
get_ident_interner().get(id.name)
|
||||
}
|
||||
|
||||
pub fn id_to_interned_str(&mut self, id: Ident) -> InternedString {
|
||||
get_ident(id.name)
|
||||
}
|
||||
@ -3440,7 +3437,9 @@ impl Parser {
|
||||
loop {
|
||||
match self.token {
|
||||
token::LIFETIME(lifetime) => {
|
||||
if "static" == self.id_to_str(lifetime) {
|
||||
let lifetime_interned_string =
|
||||
token::get_ident(lifetime.name);
|
||||
if lifetime_interned_string.equiv(&("static")) {
|
||||
result.push(RegionTyParamBound);
|
||||
} else {
|
||||
self.span_err(self.span,
|
||||
@ -4871,7 +4870,6 @@ impl Parser {
|
||||
|
||||
let first_ident = self.parse_ident();
|
||||
let mut path = ~[first_ident];
|
||||
debug!("parsed view path: {}", self.id_to_str(first_ident));
|
||||
match self.token {
|
||||
token::EQ => {
|
||||
// x = foo::bar
|
||||
|
Loading…
Reference in New Issue
Block a user