fn resolve_symbol(&mut self, name: SharedSymbol, span: Span) -> UniqueSymbol {
        // if we've seen the symbol before but don't know where it's
        // defined
        if let Some(unique_symbol) = self.unresolved_hoists.get(&name) {
            return unique_symbol.item;
        }

        // if we haven't seen the symbol before,
        // we search backwards through scopes and build a hoisting
        // chain
        if let Some(unique_symbol) = self.try_resolve(name) {
            return unique_symbol;
        }

        // if we didn't find it by searching backwards, we mark it
        // as unresolved
        let unique_symbol = self.symbol_table.push(name);
        self.capture_all(unique_symbol);
        self.unresolved_hoists
            .insert(name, Spanned::new(unique_symbol, span));

        // put it in the local scope so we can check for use before
        self.local_scope().locals.push(unique_symbol);
        return unique_symbol;
    }
This function wraps try_resolve,
but checks that the symbol is unresolved first.
passerine/src/compiler/hoist.rs