Skip to content

Remove unused code in parser. #27447

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 1, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 0 additions & 31 deletions src/libsyntax/parse/obsolete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,8 @@
//!
//! Obsolete syntax that becomes too hard to parse can be removed.

use ast::{Expr, ExprTup};
use codemap::Span;
use parse::parser;
use parse::token;
use ptr::P;

/// The specific types of unsupported syntax
#[derive(Copy, Clone, PartialEq, Eq, Hash)]
Expand All @@ -29,17 +26,12 @@ pub enum ObsoleteSyntax {
pub trait ParserObsoleteMethods {
/// Reports an obsolete syntax non-fatal error.
fn obsolete(&mut self, sp: Span, kind: ObsoleteSyntax);
/// Reports an obsolete syntax non-fatal error, and returns
/// a placeholder expression
fn obsolete_expr(&mut self, sp: Span, kind: ObsoleteSyntax) -> P<Expr>;
fn report(&mut self,
sp: Span,
kind: ObsoleteSyntax,
kind_str: &str,
desc: &str,
error: bool);
fn is_obsolete_ident(&mut self, ident: &str) -> bool;
fn eat_obsolete_ident(&mut self, ident: &str) -> bool;
}

impl<'a> ParserObsoleteMethods for parser::Parser<'a> {
Expand All @@ -61,13 +53,6 @@ impl<'a> ParserObsoleteMethods for parser::Parser<'a> {
self.report(sp, kind, kind_str, desc, error);
}

/// Reports an obsolete syntax non-fatal error, and returns
/// a placeholder expression
fn obsolete_expr(&mut self, sp: Span, kind: ObsoleteSyntax) -> P<Expr> {
self.obsolete(sp, kind);
self.mk_expr(sp.lo, sp.hi, ExprTup(vec![]))
}

fn report(&mut self,
sp: Span,
kind: ObsoleteSyntax,
Expand All @@ -89,20 +74,4 @@ impl<'a> ParserObsoleteMethods for parser::Parser<'a> {
self.obsolete_set.insert(kind);
}
}

fn is_obsolete_ident(&mut self, ident: &str) -> bool {
match self.token {
token::Ident(sid, _) => sid.name == ident,
_ => false,
}
}

fn eat_obsolete_ident(&mut self, ident: &str) -> bool {
if self.is_obsolete_ident(ident) {
panictry!(self.bump());
true
} else {
false
}
}
}