pub fn from_expression(expr: &Expr) -> SymbolGenerator {
        let mut id_map: fnv::FnvHashMap<String, i32> = fnv::FnvHashMap::default();

        let update_id = |id_map: &mut fnv::FnvHashMap<String, i32>, symbol: &Symbol| {
            let id = id_map.entry(symbol.name()).or_insert(0);
            *id = max(*id, symbol.id());
        };

        expr.traverse(&mut |e| match e.kind {
            Let { ref name, .. } => update_id(&mut id_map, name),
            Ident(ref sym) => update_id(&mut id_map, sym),
            Lambda { ref params, .. } => {
                for p in params.iter() {
                    update_id(&mut id_map, &p.name);
                }
            }
            _ => {}
        });

        SymbolGenerator { id_map }
    }
Initialize a SymbolGenerator from all the symbols defined in an expression.
weld/src/util/mod.rs