drop back to a simple gensym approach for fresh-name.
this is necessary so that the new idents are connected to the original strings. this is important both for error messages, and so that top-level refs get connected to the right things.
This commit is contained in:
parent
7bf75adfd9
commit
d1c01734f3
@ -543,18 +543,9 @@ pub fn gensym_ident(str : &str) -> ast::Ident {
|
||||
ast::Ident::new(gensym(str))
|
||||
}
|
||||
|
||||
|
||||
// create a fresh name. In principle, this is just a
|
||||
// gensym, but for debugging purposes, you'd like the
|
||||
// resulting name to have a suggestive stringify, without
|
||||
// paying the cost of guaranteeing that the name is
|
||||
// truly unique. I'm going to try to strike a balance
|
||||
// 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 : &ast::Ident) -> Name {
|
||||
let num = rand::rng().gen_uint_range(0,0xffff);
|
||||
gensym(fmt!("%s_%u",ident_to_str(src_name),num))
|
||||
// create a fresh name that maps to the same string as the old one.
|
||||
pub fn fresh_name(src : &ast::Ident) -> Name {
|
||||
gensym(ident_to_str(src))
|
||||
}
|
||||
|
||||
// create a fresh mark.
|
||||
|
Loading…
x
Reference in New Issue
Block a user