Skip to content

Commit 8845187

Browse files
committed
removed unused abstraction over paths and value_paths
1 parent 67100dd commit 8845187

File tree

4 files changed

+14
-25
lines changed

4 files changed

+14
-25
lines changed

src/libsyntax/ast.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,10 @@ pub struct Lifetime {
105105
ident: ident
106106
}
107107
108+
// a "Path" is essentially Rust's notion of a name;
109+
// for instance: core::cmp::Eq . It's represented
110+
// as a sequence of identifiers, along with a bunch
111+
// of supporting information.
108112
#[auto_encode]
109113
#[auto_decode]
110114
#[deriving_eq]

src/libsyntax/ext/tt/transcribe.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ struct TtFrame {
3636
pub struct TtReader {
3737
sp_diag: span_handler,
3838
interner: @ident_interner,
39+
// the unzipped tree:
3940
cur: @mut TtFrame,
4041
/* for MBE-style macro transcription */
4142
interpolations: std::oldmap::HashMap<ident, @named_match>,

src/libsyntax/parse/common.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,6 @@ pub impl Parser {
119119
id: self.get_id() })
120120
}
121121

122-
fn parse_value_ident(&self) -> ast::ident {
123-
return self.parse_ident();
124-
}
125-
126122
// consume token 'tok' if it exists. Returns true if the given
127123
// token was present, false otherwise.
128124
fn eat(&self, tok: &token::Token) -> bool {

src/libsyntax/parse/parser.rs

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -893,16 +893,9 @@ pub impl Parser {
893893
codemap::spanned { node: lit, span: mk_sp(lo, self.last_span.hi) }
894894
}
895895

896-
fn parse_path_without_tps(&self) -> @path {
897-
self.parse_path_without_tps_(|p| p.parse_ident(),
898-
|p| p.parse_ident())
899-
}
900-
901-
fn parse_path_without_tps_(
902-
&self,
903-
parse_ident: fn(&Parser) -> ident,
904-
parse_last_ident: fn(&Parser) -> ident
905-
) -> @path {
896+
// parse a path that doesn't have type parameters attached
897+
fn parse_path_without_tps(&self)
898+
-> @ast::path {
906899
maybe_whole!(self, nt_path);
907900
let lo = self.span.lo;
908901
let global = self.eat(&token::MOD_SEP);
@@ -913,10 +906,10 @@ pub impl Parser {
913906
&& self.look_ahead(1u) == token::MOD_SEP;
914907

915908
if is_not_last {
916-
ids.push(parse_ident(self));
909+
ids.push(self.parse_ident());
917910
self.expect(&token::MOD_SEP);
918911
} else {
919-
ids.push(parse_last_ident(self));
912+
ids.push(self.parse_ident());
920913
break;
921914
}
922915
}
@@ -927,12 +920,7 @@ pub impl Parser {
927920
types: ~[] }
928921
}
929922

930-
fn parse_value_path(&self) -> @path {
931-
self.parse_path_without_tps_(|p| p.parse_ident(),
932-
|p| p.parse_value_ident())
933-
}
934-
935-
fn parse_path_with_tps(&self, colons: bool) -> @path {
923+
fn parse_path_with_tps(&self, colons: bool) -> @ast::path {
936924
debug!("parse_path_with_tps(colons=%b)", colons);
937925

938926
maybe_whole!(self, nt_path);
@@ -2282,7 +2270,7 @@ pub impl Parser {
22822270
}
22832271

22842272
if is_plain_ident(&*self.token) && cannot_be_enum_or_struct {
2285-
let name = self.parse_value_path();
2273+
let name = self.parse_path_without_tps();
22862274
let sub;
22872275
if self.eat(&token::AT) {
22882276
sub = Some(self.parse_pat(refutable));
@@ -2355,7 +2343,7 @@ pub impl Parser {
23552343
*self.last_span,
23562344
~"expected identifier, found path");
23572345
}
2358-
let name = self.parse_value_path();
2346+
let name = self.parse_path_without_tps();
23592347
let sub = if self.eat(&token::AT) {
23602348
Some(self.parse_pat(refutable))
23612349
} else { None };
@@ -2453,7 +2441,7 @@ pub impl Parser {
24532441

24542442
// Potential trouble: if we allow macros with paths instead of
24552443
// idents, we'd need to look ahead past the whole path here...
2456-
let pth = self.parse_value_path();
2444+
let pth = self.parse_path_without_tps();
24572445
self.bump();
24582446

24592447
let id = if *self.token == token::LPAREN {

0 commit comments

Comments
 (0)