diff --git a/compiler/middle/lower_ast.ts b/compiler/middle/lower_ast.ts index a87cfb9..632cb24 100644 --- a/compiler/middle/lower_ast.ts +++ b/compiler/middle/lower_ast.ts @@ -91,35 +91,3 @@ export class AstLowerer { return todo(); } } - -// https://doc.rust-lang.org/nightly/nightly-rustc/rustc_resolve/late/struct.Rib.html -type Rib = { - kind: RibKind; - bindings: Map; -}; - -// https://doc.rust-lang.org/nightly/nightly-rustc/rustc_resolve/late/enum.RibKind.html -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 -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 -type DefKind = - | { type: "mod" } - | { type: "struct" } - | { type: "enum" } - | { type: "variant" } - | { type: "ty_alias" } - | { type: "ty_param" } - | { type: "fn" } - | { type: "ctor" } - | { type: "use" } - | { type: "field" }; diff --git a/compiler/middle/rib.ts b/compiler/middle/rib.ts new file mode 100644 index 0000000..937e70a --- /dev/null +++ b/compiler/middle/rib.ts @@ -0,0 +1,33 @@ +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; +}; + +// 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" };