Trait moore_svlog::Context[][src]

pub trait Context<'gcx>: DiagEmitter + QueryDatabase<'gcx> + HasTypeStorage<'gcx> {
Show 33 methods fn gcx(&self) -> &GlobalContext<'gcx>; fn sess(&self) -> &'gcx Session { ... }
fn arena(&self) -> &'gcx GlobalArenas<'gcx> { ... }
fn tables(&self) -> &GlobalTables<'gcx> { ... }
fn unimp<T: HasSpan + HasDesc, R>(&self, node: &T) -> Result<R> { ... }
fn unimp_msg<T: HasSpan + HasDesc, R>(
        &self,
        msg: impl Into<String>,
        node: &T
    ) -> Result<R> { ... }
fn alloc_id(&self, span: Span) -> NodeId { ... }
fn span(&self, node_id: NodeId) -> Span { ... }
fn set_span(&self, node_id: NodeId, span: Span) { ... }
fn set_ast(&self, node_id: NodeId, ast: AstNode<'gcx>) { ... }
fn map_ast(&self, ast: AstNode<'gcx>) -> NodeId { ... }
fn map_ast_with_parent(&self, ast: AstNode<'gcx>, parent: NodeId) -> NodeId { ... }
fn ast_of(&self, node_id: NodeId) -> Result<AstNode<'gcx>> { ... }
fn register_ast(&self, node: &'gcx dyn AnyNode<'gcx>) { ... }
fn ast_for_id(&self, node_id: NodeId) -> &'gcx dyn AnyNode<'gcx> { ... }
fn intern_hir(&self, id: NodeId, hir: HirNode<'gcx>) { ... }
fn intern_hir_with_parent(
        &self,
        id: NodeId,
        hir: HirNode<'gcx>,
        parent: NodeId
    ) { ... }
fn interned_hir(&self, id: NodeId) -> HirNode<'gcx> { ... }
fn get_interned_hir(&self, id: NodeId) -> Option<HirNode<'gcx>> { ... }
fn intern_value(&self, value: ValueData<'gcx>) -> Value<'gcx> { ... }
fn intern_param_env(&self, env: ParamEnvData<'gcx>) -> ParamEnv { ... }
fn param_env_data(&self, env: ParamEnv) -> &'gcx ParamEnvData<'gcx> { ... }
fn default_param_env(&self) -> ParamEnv { ... }
fn add_param_env_context(&self, env: ParamEnv, context: NodeId) { ... }
fn param_env_contexts(&self, env: ParamEnv) -> Vec<NodeId>
Notable traits for Vec<u8, A>
impl<A> Write for Vec<u8, A> where
    A: Allocator
{ ... }
fn set_parent(&self, node_id: NodeId, parent_id: NodeId) { ... }
fn parent_node_id(&self, node_id: NodeId) -> Option<NodeId> { ... }
fn is_parent_of(&self, parent_id: NodeId, child_id: NodeId) -> bool { ... }
fn resolve_upwards_or_error(
        &self,
        name: Spanned<Name>,
        start_at: NodeId
    ) -> Result<NodeId> { ... }
fn resolve_downwards_or_error(
        &self,
        name: Spanned<Name>,
        start_at: NodeId
    ) -> Result<NodeId> { ... }
fn set_lowering_hint(&self, node_id: NodeId, hint: Hint) { ... }
fn lowering_hint(&self, node_id: NodeId) -> Option<Hint> { ... }
fn constant_int_value_of(
        &self,
        node_id: NodeId,
        env: ParamEnv
    ) -> Result<&'gcx BigInt> { ... }
}
Expand description

The fundamental compiler context.

This trait represents the context within which most compiler operations take place. It is implemented by GlobalContext and also provides access to the global context via the gcx() method.

Required methods

Get the global context.

Provided methods

Get the compiler session.

Access the arena into which values are to be allocated.

Access the tables.

Emit an internal compiler error that a node is not implemented.

Emit an internal compiler error and message that a node is not implemented. Same as [unimp], but the caller can provide a message prefix.

Allocate a new node id.

The provided span is used primarily for diagnostic messages and is supposed to easily identify the node to the user in case of an error.

Return the diagnostic span associated with a ndoe id.

Associate a span with a node id.

Associate an AST node with a node id.

Allocate a node id for an AST node and associate that id with the node.

Call [map_ast] and [set_parent].

Obtain the AST node associated with a node id.

Register an ast::AnyNode for later retrieval by ID.

Obtain an ast::AnyNode associated with a node id.

Internalize an HIR node.

Internalize an HIR node.

Lookup an internalized HIR node.

Lookup an internalized HIR node.

Internalize a value.

Internalize a parameter environment.

Get the ParamEnvData associated with a ParamEnv.

Get the default parameter environment.

This is useful for instantiations without any parameter assignment, e.g. for the top-level module.

Associate a context with a param env.

A context in this sense is the node that the param env relates to. Usually this is the node that actually generated the param env, e.g. a module instantiation.

Get the contexts associated with a parameter environment.

Returns what has previously been added with add_param_env_context.

Associate a parent with a node.

Panics if node_id already has a parent assigned.

Find the parent node of a node.

Returns None if the node has no parent. Pretty much every node has a parent, assigned more or less in lexographical order.

Check if a node is the parent of another.

Resolve a name upwards or emit a diagnostic if nothing is found.

Resolve a name downwards or emit a diagnostic if nothing is found.

Set a lowering hint on a node.

Get a lowering hint on a node.

Compute the constant value of a node and make sure it is an integer.

Implementors