[][src]Trait moore_svlog::Context

pub trait Context<'gcx>: DiagEmitter + QueryDatabase<'gcx> + HasTypeStorage<'gcx> {
    pub fn gcx(&self) -> &GlobalContext<'gcx>;

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

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

pub fn gcx(&self) -> &GlobalContext<'gcx>[src]

Get the global context.

Loading content...

Provided methods

pub fn sess(&self) -> &'gcx Session[src]

Get the compiler session.

pub fn arena(&self) -> &'gcx GlobalArenas<'gcx>[src]

Access the arena into which values are to be allocated.

pub fn tables(&self) -> &GlobalTables<'gcx>[src]

Access the tables.

pub fn unimp<T: HasSpan + HasDesc, R>(&self, node: &T) -> Result<R>[src]

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

pub fn unimp_msg<T: HasSpan + HasDesc, R>(
    &self,
    msg: impl Into<String>,
    node: &T
) -> Result<R>
[src]

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

pub fn alloc_id(&self, span: Span) -> NodeId[src]

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.

pub fn span(&self, node_id: NodeId) -> Span[src]

Return the diagnostic span associated with a ndoe id.

pub fn set_span(&self, node_id: NodeId, span: Span)[src]

Associate a span with a node id.

pub fn set_ast(&self, node_id: NodeId, ast: AstNode<'gcx>)[src]

Associate an AST node with a node id.

pub fn map_ast(&self, ast: AstNode<'gcx>) -> NodeId[src]

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

pub fn map_ast_with_parent(&self, ast: AstNode<'gcx>, parent: NodeId) -> NodeId[src]

Call [map_ast] and [set_parent].

pub fn ast_of(&self, node_id: NodeId) -> Result<AstNode<'gcx>>[src]

Obtain the AST node associated with a node id.

pub fn register_ast(&self, node: &'gcx dyn AnyNode<'gcx>)[src]

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

pub fn ast_for_id(&self, node_id: NodeId) -> &'gcx dyn AnyNode<'gcx>[src]

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

pub fn intern_hir(&self, id: NodeId, hir: HirNode<'gcx>)[src]

Internalize an HIR node.

pub fn intern_hir_with_parent(
    &self,
    id: NodeId,
    hir: HirNode<'gcx>,
    parent: NodeId
)
[src]

Internalize an HIR node.

pub fn interned_hir(&self, id: NodeId) -> HirNode<'gcx>[src]

Lookup an internalized HIR node.

pub fn get_interned_hir(&self, id: NodeId) -> Option<HirNode<'gcx>>[src]

Lookup an internalized HIR node.

pub fn intern_value(&self, value: ValueData<'gcx>) -> Value<'gcx>[src]

Internalize a value.

pub fn intern_param_env(&self, env: ParamEnvData<'gcx>) -> ParamEnv[src]

Internalize a parameter environment.

pub fn param_env_data(&self, env: ParamEnv) -> &'gcx ParamEnvData<'gcx>[src]

Get the ParamEnvData associated with a ParamEnv.

pub fn default_param_env(&self) -> ParamEnv[src]

Get the default parameter environment.

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

pub fn add_param_env_context(&self, env: ParamEnv, context: NodeId)[src]

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.

pub fn param_env_contexts(&self, env: ParamEnv) -> Vec<NodeId>[src]

Get the contexts associated with a parameter environment.

Returns what has previously been added with add_param_env_context.

pub fn set_parent(&self, node_id: NodeId, parent_id: NodeId)[src]

Associate a parent with a node.

Panics if node_id already has a parent assigned.

pub fn parent_node_id(&self, node_id: NodeId) -> Option<NodeId>[src]

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.

pub fn is_parent_of(&self, parent_id: NodeId, child_id: NodeId) -> bool[src]

Check if a node is the parent of another.

pub fn resolve_upwards_or_error(
    &self,
    name: Spanned<Name>,
    start_at: NodeId
) -> Result<NodeId>
[src]

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

pub fn resolve_downwards_or_error(
    &self,
    name: Spanned<Name>,
    start_at: NodeId
) -> Result<NodeId>
[src]

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

pub fn set_lowering_hint(&self, node_id: NodeId, hint: Hint)[src]

Set a lowering hint on a node.

pub fn lowering_hint(&self, node_id: NodeId) -> Option<Hint>[src]

Get a lowering hint on a node.

pub fn constant_int_value_of(
    &self,
    node_id: NodeId,
    env: ParamEnv
) -> Result<&'gcx BigInt>
[src]

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

Loading content...

Implementors

impl<'gcx> Context<'gcx> for GlobalContext<'gcx>[src]

Loading content...