pub fn resolve_internal(id : Ident,
                        table : &mut SCTable,
                        resolve_table : &mut ResolveTable) -> Name {
    let key = (id.name,id.ctxt);
    match resolve_table.contains_key(&key) {
        false => {
            let resolved = {
                match table.table[id.ctxt] {
                    EmptyCtxt => id.name,
                    // ignore marks here:
                    Mark(_,subctxt) =>
                        resolve_internal(Ident{name:id.name, ctxt: subctxt},table,resolve_table),
                    // do the rename if necessary:
                    Rename(Ident{name,ctxt},toname,subctxt) => {
                        let resolvedfrom =
                            resolve_internal(Ident{name:name,ctxt:ctxt},table,resolve_table);
                        let resolvedthis =
                            resolve_internal(Ident{name:id.name,ctxt:subctxt},table,resolve_table);
                        if ((resolvedthis == resolvedfrom)
                            && (marksof(ctxt,resolvedthis,table)
                                == marksof(subctxt,resolvedthis,table))) {
                            toname
                        } else {
                            resolvedthis
                        }
                    }
                    IllegalCtxt() => fail!(~"expected resolvable context, got IllegalCtxt")
                }
            };
            resolve_table.insert(key,resolved);
            resolved
        }
        true => {
            // it's guaranteed to be there, because we just checked that it was
            // there and we never remove anything from the table:
            *(resolve_table.find(&key).unwrap())
        }
    }
}
// Resolve a syntax object to a name, per MTWT.
// adding memoization to possibly resolve 500+ seconds in resolve for librustc (!)
// FIXME #4536 : currently pub to allow testing
Resolve a syntax object to a name, per MTWT.
adding memoization to possibly resolve 500+ seconds in resolve for librustc (!)
FIXME #4536 : currently pub to allow testing
Resolve a syntax object to a name per MTWT . adding memoization to possibly resolve 500 + seconds in resolve for librustc ( ! ) FIXME #4536 : currently pub to allow testing
pub fn resolve_internal(id : Ident,
                        table : &mut SCTable,
                        resolve_table : &mut ResolveTable) -> Name {
    let key = (id.name,id.ctxt);
    match resolve_table.contains_key(&key) {
        false => {
            let resolved = {
                match table.table[id.ctxt] {
                    EmptyCtxt => id.name,
                    // ignore marks here:
                    Mark(_,subctxt) =>
                        resolve_internal(Ident{name:id.name, ctxt: subctxt},table,resolve_table),
                    // do the rename if necessary:
                    Rename(Ident{name,ctxt},toname,subctxt) => {
                        let resolvedfrom =
                            resolve_internal(Ident{name:name,ctxt:ctxt},table,resolve_table);
                        let resolvedthis =
                            resolve_internal(Ident{name:id.name,ctxt:subctxt},table,resolve_table);
                        if ((resolvedthis == resolvedfrom)
                            && (marksof(ctxt,resolvedthis,table)
                                == marksof(subctxt,resolvedthis,table))) {
                            toname
                        } else {
                            resolvedthis
                        }
                    }
                    IllegalCtxt() => fail!(~"expected resolvable context, got IllegalCtxt")
                }
            };
            resolve_table.insert(key,resolved);
            resolved
        }
        true => {
            // it's guaranteed to be there, because we just checked that it was
            // there and we never remove anything from the table:
            *(resolve_table.find(&key).unwrap())
        }
    }
}
pub fn resolve_internal ( id : Ident , table : & mut SCTable , resolve_table : & mut ResolveTable ) -> Name { let key = ( id . name , id . ctxt ) ; match resolve_table . contains_key ( & key ) { false => { let resolved = { match table . table [ id . ctxt ] { EmptyCtxt => id . name , // ignore marks here: Mark ( _ , subctxt ) => resolve_internal ( Ident { name : id . name , ctxt : subctxt } , table , resolve_table ) , // do the rename if necessary: Rename ( Ident { name , ctxt } , toname , subctxt ) => { let resolvedfrom = resolve_internal ( Ident { name : name , ctxt : ctxt } , table , resolve_table ) ; let resolvedthis = resolve_internal ( Ident { name : id . name , ctxt : subctxt } , table , resolve_table ) ; if ( ( resolvedthis == resolvedfrom ) && ( marksof ( ctxt , resolvedthis , table ) == marksof ( subctxt , resolvedthis , table ) ) ) { toname } else { resolvedthis } } IllegalCtxt ( ) => fail ! ( " " ) } } ; resolve_table . insert ( key , resolved ) ; resolved } true => { // it's guaranteed to be there, because we just checked that it was // there and we never remove anything from the table: * ( resolve_table . find ( & key ) . unwrap ( ) ) } } }
Resolve a syntax object to a name, per MTWT.
Resolve a syntax object to a name per MTWT .
id
Ident
table
&mut SCTable
resolve_table
&mut ResolveTable
id
Ident
table
&mut SCTable
resolve_table
&mut ResolveTable