slige-mirror/compiler/middle/rib.ts
2025-01-28 23:15:59 +01:00

34 lines
982 B
TypeScript

import { DefId, IdentId } from "../ctx.ts";
// https://doc.rust-lang.org/nightly/nightly-rustc/rustc_resolve/late/struct.Rib.html
export type Rib = {
kind: RibKind;
bindings: Map<IdentId, Res>;
};
// https://doc.rust-lang.org/nightly/nightly-rustc/rustc_resolve/late/enum.RibKind.html
export type RibKind =
| { tag: "normal" }
| { tag: "fn" }
| { tag: "item"; defKind: DefKind }
| { tag: "mod" };
// https://doc.rust-lang.org/nightly/nightly-rustc/rustc_resolve/late/enum.RibKind.html
export type Res =
| { tag: "error" }
| { tag: "def"; kind: DefKind; id: DefId }
| { tag: "local"; id: DefId };
// https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/def/enum.DefKind.html
export type DefKind =
| { type: "mod" }
| { type: "struct" }
| { type: "enum" }
| { type: "variant" }
| { type: "ty_alias" }
| { type: "ty_param" }
| { type: "fn" }
| { type: "ctor" }
| { type: "use" }
| { type: "field" };