[−][src]Trait moore_svlog::Context
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.
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]
&self,
msg: impl Into<String>,
node: &T
) -> Result<R>
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]
&self,
id: NodeId,
hir: HirNode<'gcx>,
parent: NodeId
)
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]
&self,
name: Spanned<Name>,
start_at: NodeId
) -> Result<NodeId>
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]
&self,
name: Spanned<Name>,
start_at: NodeId
) -> Result<NodeId>
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]
&self,
node_id: NodeId,
env: ParamEnv
) -> Result<&'gcx BigInt>
Compute the constant value of a node and make sure it is an integer.