about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorJohn Clements <clements@racket-lang.org>2013-06-25 11:40:51 -0700
committerJohn Clements <clements@racket-lang.org>2013-09-06 13:35:06 -0700
commitfa6c981606b89ebed80b0dd5e829d86cdb3078d8 (patch)
treef2c690f19fd740604139ce9cf8d080218bff4e1c /src/libsyntax/parse
parent7fd5bdcb9a6d090276c0366f2c55975c153ac088 (diff)
downloadrust-fa6c981606b89ebed80b0dd5e829d86cdb3078d8.tar.gz
rust-fa6c981606b89ebed80b0dd5e829d86cdb3078d8.zip
add hygiene support fns, move them around.
also adds test cases
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/token.rs10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs
index 591b4b10bd3..8de597733ae 100644
--- a/src/libsyntax/parse/token.rs
+++ b/src/libsyntax/parse/token.rs
@@ -552,9 +552,9 @@ pub fn gensym_ident(str : &str) -> ast::Ident {
 // by using a gensym with a name that has a random number
 // at the end. So, the gensym guarantees the uniqueness,
 // and the int helps to avoid confusion.
-pub fn fresh_name(src_name : &str) -> Name {
+pub fn fresh_name(src_name : &ast::Ident) -> Name {
     let num = rand::rng().gen_uint_range(0,0xffff);
-   gensym(fmt!("%s_%u",src_name,num))
+    gensym(fmt!("%s_%u",ident_to_str(src_name),num))
 }
 
 /**
@@ -697,9 +697,5 @@ pub fn is_reserved_keyword(tok: &Token) -> bool {
 #[cfg(test)]
 mod test {
     use super::*;
-    #[test] fn t1() {
-        let a = fresh_name("ghi");
-        printfln!("interned name: %u,\ntextual name: %s\n",
-                  a, interner_get(a));
-    }
+
 }