You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: stmt.rs
    path of file: ./repos/stc/crates/stc_ts_ordering/src
    
    the code of the file until where you have to start completion: //! Dependency analyzer for statements.

use fxhash::{FxHashMap, FxHashSet};
use rnode::{Visit, VisitWith};
use stc_ts_ast_rnode::{
    RBindingIdent, RDecl, RExportNamedSpecifier, RExpr, RForInStmt, RForOfStmt, RIdent, RJSXElementName, RJSXObject, RMemberExpr,
    RMemberProp, RModuleDecl, RModuleExportName, RModuleItem, RNamedExport, ROptChainBase, ROptChainExpr, RProp, RStmt, RTsEntityName,
    RTsExprWithTypeArgs, RTsFnType, RTsIndexSignature, RTsModuleDecl, RTsModuleName, RTsTypeRef, RVarDecl, RVarDeclOrExpr, RVarDeclOrPat,
    RVarDeclarator,
};
use stc_ts_types::{Id, IdCtx};
use stc_ts_utils::{find_ids_in_pat, AsModuleDecl};

use crate::types::Sortable;

#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct TypedId {
    pub kind: IdCtx,
    pub id: Id,
}

impl Sortable for RStmt {
    type Id = TypedId;

    fn precedence(&self) -> u8 {
        match self {
            RStmt::Decl(RDecl::TsModule(box RTsModuleDecl { global: true, .. })) => 255,
            _ => 0,
        }
    }

    fn get_decls(&self) -> FxHashMap<Self::Id, FxHashSet<Self::Id>> {
        ids_declared_by(self)
    }

    fn uses(&self) -> FxHashSet<Self::Id> {
        deps_of(self)
    }
}

impl Sortable for RModuleItem {
    type Id = TypedId;

    fn precedence(&self) -> u8 {
        match self {
            RModuleItem::Stmt(s) => s.precedence(),
            _ => 0,
        }
    }

    fn get_decls(&self) -> FxHashMap<Self::Id, FxHashSet<Self::Id>> {
        ids_declared_by(self)
    }

    fn uses(&self) -> FxHashSet<Self::Id> {
        deps_of(self)
    }
}

fn deps_of<T>(e: &T) -> FxHashSet<TypedId>
where
    T: VisitWith<DepAnalyzer>,
{
    let mut v = DepAnalyzer::default();
    e.visit_with(&mut v);
    v.used
}

fn vars_declared_by_var_decl(v: &RVarDecl) -> FxHashMap<TypedId, FxHashSet<TypedId>> {
    let mut map = FxHashMap::<_, FxHashSet<_>>::default();
    for decl in &v.decls {
        let vars = find_ids_in_pat(&decl.name);

        // Get deps of name.
        let mut type_ids = deps_of(&decl.name);

        // Exclude the variables we are defining.
        for var in vars.iter().cloned() {
            type_ids.remove(&TypedId { kind: IdCtx::Var, id: var });
        }

        let used_ids = deps
    
fn ids_declared_by_decl(d: &RDecl) -> FxHashMap<TypedId, FxHashSet<TypedId>> {
    let mut map = FxHashMap::default();
    match d {
        RDecl::Class(c) => {
            let used_ids = deps_of(&c.class);
            map.insert(
                TypedId {
                    kind: IdCtx::Type,
                    id: c.ident.clone().into(),
                },
                used_ids.clone(),
            );
            map.insert(
                TypedId {
                    kind: IdCtx::Var,
                    id: c.ident.clone().into(),
                },
                used_ids,
            );
            map
        }
        RDecl::Fn(f) => {
            let used_ids = deps_of(&f.function);
            map.insert(
                TypedId {
                    kind: IdCtx::Var,
                    id: f.ident.clone().into(),
                },
                used_ids,
            );
            map
        }
        RDecl::Var(v) => vars_declared_by_var_decl(v),
        RDecl::TsEnum(e) => {
            map.insert(
                TypedId {
                    kind: IdCtx::Type,
                    id: e.id.clone().into(),
                },
                Default::default(),
            );
            map.insert(
                TypedId {
                    kind: IdCtx::Var,
                    id: e.id.clone().into(),
                },
                Default::default(),
            );
            map
        }
        RDecl::TsModule(box RTsModuleDecl {
            id: RTsModuleName::Ident(i),
            ..
        }) => {
            map.insert(
                TypedId {
                    kind: IdCtx::Var,
                    id: i.clone().into(),
                },
                Default::default(),
            );
            map
        }

        RDecl::TsInterface(i) => {
            let mut deps = deps_of(&i.extends);
            deps.extend(deps_of(&i.type_params));
            map.insert(
                TypedId {
                    kind: IdCtx::Type,
                    id: i.id.clone().into(),
                },
                deps,
            );
            map
        }

        RDecl::TsTypeAlias(a) => {
            let deps = deps_of(&a.type_ann);
            map.insert(
                TypedId {
                    kind: IdCtx::Type,
                    id: a.id.clone().into(),
                },
                deps,
            );

            map
        }

        RDecl::TsModule(_) => Default::default(),
    }
}