sway_core/decl_engine/
mod.rs

1//! The [DeclEngine](engine::DeclEngine) allows the compiler to add a layer of
2//! separation between [AST nodes](crate::semantic_analysis::ast_node) and
3//! declarations.
4//!
5//! As an interface, you can think of the [DeclEngine](engine::DeclEngine) as a
6//! mapping from [DeclId](id::DeclId) to [DeclWrapper](wrapper::DeclWrapper).
7//! When a [DeclWrapper](wrapper::DeclWrapper) is inserted into the
8//! [DeclEngine](engine::DeclEngine), a [DeclId](id::DeclId) is generated, which
9//! is then used to refer to the declaration.
10
11pub mod associated_item_decl_id;
12#[allow(clippy::module_inception)]
13pub(crate) mod engine;
14pub mod id;
15pub(crate) mod interface_decl_id;
16pub(crate) mod mapping;
17pub(crate) mod parsed_engine;
18pub mod parsed_id;
19pub(crate) mod r#ref;
20pub(crate) mod replace_decls;
21
22use std::collections::BTreeMap;
23
24pub(crate) use associated_item_decl_id::*;
25pub use engine::*;
26pub(crate) use id::*;
27pub use interface_decl_id::*;
28pub(crate) use mapping::*;
29pub use parsed_engine::*;
30pub use r#ref::*;
31pub(crate) use replace_decls::*;
32use sway_types::Ident;
33
34use crate::{
35    language::ty::{TyTraitInterfaceItem, TyTraitItem},
36    TypeId,
37};
38
39pub(crate) type InterfaceItemMap = BTreeMap<(Ident, TypeId), TyTraitInterfaceItem>;
40pub(crate) type ItemMap = BTreeMap<(Ident, TypeId), TyTraitItem>;