diff options
| author | John Clements <clements@racket-lang.org> | 2013-06-03 23:00:49 -0700 |
|---|---|---|
| committer | John Clements <clements@racket-lang.org> | 2013-06-05 12:01:38 -0700 |
| commit | 04a691a511d0203b1f521960f845e623cc45d261 (patch) | |
| tree | 06693e51a145e83c36ab9dab9728946fa2c7634d /src/libsyntax/parse | |
| parent | 320359547126b1a317d49ed68102d1b6e8be5ca2 (diff) | |
| download | rust-04a691a511d0203b1f521960f845e623cc45d261.tar.gz rust-04a691a511d0203b1f521960f845e623cc45d261.zip | |
token_to_ident takes argument by reference
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/parse/token.rs | 10 |
2 files changed, 7 insertions, 7 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 54845849ebb..2fd0a7e33ff 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -3980,7 +3980,7 @@ impl Parser { match *self.token { token::LIT_STR(s) => { self.bump(); - let the_string = ident_to_str(s); + let the_string = ident_to_str(&s); let mut words = ~[]; for str::each_word(*the_string) |s| { words.push(s) } let mut abis = AbiSet::empty(); @@ -4542,7 +4542,7 @@ impl Parser { match *self.token { token::LIT_STR(s) => { self.bump(); - ident_to_str(s) + ident_to_str(&s) } _ => self.fatal("expected string literal") } diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index 400d52d5a52..ef889d5e4bc 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -178,20 +178,20 @@ pub fn to_str(in: @ident_interner, t: &Token) -> ~str { } LIT_INT_UNSUFFIXED(i) => { i.to_str() } LIT_FLOAT(ref s, t) => { - let mut body = copy *ident_to_str(*s); + let mut body = copy *ident_to_str(s); if body.ends_with(".") { body += "0"; // `10.f` is not a float literal } body + ast_util::float_ty_to_str(t) } LIT_FLOAT_UNSUFFIXED(ref s) => { - let mut body = copy *ident_to_str(*s); + let mut body = copy *ident_to_str(s); if body.ends_with(".") { body += "0"; // `10.f` is not a float literal } body } - LIT_STR(ref s) => { ~"\"" + str::escape_default(*ident_to_str(*s)) + "\"" } + LIT_STR(ref s) => { ~"\"" + str::escape_default(*ident_to_str(s)) + "\"" } /* Name components */ IDENT(s, _) => copy *in.get(s.name), @@ -199,7 +199,7 @@ pub fn to_str(in: @ident_interner, t: &Token) -> ~str { UNDERSCORE => ~"_", /* Other */ - DOC_COMMENT(ref s) => copy *ident_to_str(*s), + DOC_COMMENT(ref s) => copy *ident_to_str(s), EOF => ~"<eof>", INTERPOLATED(ref nt) => { match nt { @@ -545,7 +545,7 @@ pub fn interner_get(name : Name) -> @~str { } // maps an identifier to the string that it corresponds to -pub fn ident_to_str(id : ast::ident) -> @~str { +pub fn ident_to_str(id : &ast::ident) -> @~str { interner_get(id.name) } |
