Trait moore_svlog::QueryDatabase [−][src]
pub trait QueryDatabase<'a> {
type Context: Context<'a>;
Show 69 methods
fn context(&self) -> &Self::Context;
fn storage(&self) -> &QueryStorage<'a>;
fn handle_cycle(&self) -> ! { ... }
fn before_query(&self, tag: &QueryTag<'a>) { ... }
fn after_query(&self, tag: &QueryTag<'a>) { ... }
fn hir_of(&self, node_id: NodeId) -> Result<HirNode<'a>> { ... }
fn hir_of_module(&self, ast: &'a Module<'a>) -> Result<&'a Module<'a>> { ... }
fn hir_of_interface(
&self,
ast: &'a Interface<'a>
) -> Result<&'a Interface<'a>> { ... }
fn hir_of_expr(&self, arg0: Ref<'a, Expr<'a>>) -> Result<&'a Expr<'a>> { ... }
fn accessed_nodes(
&self,
node_id: NodeId,
env: ParamEnv
) -> Result<Arc<AccessTable>> { ... }
fn inst_details(
&self,
arg0: Ref<'a, Inst<'a>>,
env: ParamEnv
) -> Result<Arc<InstDetails<'a>>> { ... }
fn inst_target_details(
&self,
arg0: Ref<'a, InstTarget<'a>>,
env: ParamEnv
) -> Result<Arc<InstTargetDetails<'a>>> { ... }
fn mir_assignment_from_procedural(
&self,
origin: NodeId,
lhs: NodeId,
rhs: NodeId,
env: ParamEnv,
span: Span,
kind: AssignKind
) -> &'a Assignment<'a> { ... }
fn mir_assignment_from_concurrent(
&self,
arg0: Ref<'a, Assign>,
env: ParamEnv
) -> &'a Assignment<'a> { ... }
fn mir_simplify_assignment(
&self,
arg0: Ref<'a, Assignment<'a>>
) -> Vec<&'a Assignment<'a>>ⓘ { ... }
fn mir_lvalue(&self, expr_id: NodeId, env: ParamEnv) -> &'a Lvalue<'a> { ... }
fn mir_rvalue(&self, expr_id: NodeId, env: ParamEnv) -> &'a Rvalue<'a> { ... }
fn param_env(&self, src: ParamEnvSource<'a>) -> Result<ParamEnv> { ... }
fn map_pattern(
&self,
arg0: Ref<'a, Expr<'a>>,
env: ParamEnv
) -> Result<Arc<PatternMapping<'a>>> { ... }
fn canonicalize_ports(
&self,
node: &'a dyn PortedNode<'a>
) -> &'a PortList<'a> { ... }
fn port_mapping(
&self,
node: &'a dyn PortedNode<'a>,
outer_env: ParamEnv,
inner_env: ParamEnv,
arg3: Ref<'a, InstName<'a>>,
pos: &'a [PosParam],
named: &'a [NamedParam],
has_wildcard_port: bool
) -> Result<Arc<PortMapping<'a>>> { ... }
fn local_rib(&self, node_id: NodeId) -> Result<&'a Rib> { ... }
fn hierarchical_rib(&self, node_id: NodeId) -> Result<&'a Rib> { ... }
fn resolve_upwards(
&self,
name: Name,
start_at: NodeId
) -> Result<Option<NodeId>> { ... }
fn resolve_downwards(
&self,
name: Name,
start_at: NodeId
) -> Result<Option<NodeId>> { ... }
fn resolve_node(&self, node_id: NodeId, env: ParamEnv) -> Result<NodeId> { ... }
fn struct_def(&self, node_id: NodeId) -> Result<Arc<StructDef>> { ... }
fn resolve_field_access(
&self,
node_id: NodeId,
env: ParamEnv
) -> Result<(usize, &'a StructMember<'a>)> { ... }
fn generated_scope(&self, node: &'a dyn ScopedNode<'a>) -> &'a Scope<'a> { ... }
fn scope_location(&self, node: &'a dyn AnyNode<'a>) -> ScopeLocation<'a> { ... }
fn resolve_local(
&self,
name: Name,
at: ScopeLocation<'a>,
skip_imports: bool
) -> Result<Option<&'a Def<'a>>> { ... }
fn resolve_local_or_error(
&self,
name: Spanned<Name>,
at: ScopeLocation<'a>,
skip_imports: bool
) -> Result<&'a Def<'a>> { ... }
fn resolve_namespace(
&self,
name: Name,
inside: &'a dyn ScopedNode<'a>
) -> Option<&'a Def<'a>> { ... }
fn resolve_namespace_or_error(
&self,
name: Spanned<Name>,
inside: &'a dyn ScopedNode<'a>
) -> Result<&'a Def<'a>> { ... }
fn resolve_hierarchical(
&self,
name: Name,
inside: &'a dyn ScopedNode<'a>
) -> Option<&'a Def<'a>> { ... }
fn resolve_hierarchical_or_error(
&self,
name: Spanned<Name>,
inside: &'a dyn ScopedNode<'a>
) -> Result<&'a Def<'a>> { ... }
fn resolve_imported_scope(
&self,
node: &'a ImportItem<'a>
) -> Result<&'a dyn ScopedNode<'a>> { ... }
fn nameck(&self, node: &'a dyn AnyNode<'a>) -> bool { ... }
fn resolve_inst_target(&self, inst: &'a Inst<'a>) -> Result<InstTarget<'a>> { ... }
fn disamb_kind(&self, arg0: Ref<'a, dyn AnyNode<'a>>) -> Kind { ... }
fn disamb_type_or_expr(
&self,
arg0: Ref<'a, TypeOrExpr<'a>>
) -> Result<&'a TypeOrExpr<'a>> { ... }
fn type_of(
&self,
node_id: NodeId,
env: ParamEnv
) -> Result<&'a UnpackedType<'a>> { ... }
fn type_of_int_port(
&self,
arg0: Ref<'a, IntPort<'a>>,
env: ParamEnv
) -> &'a UnpackedType<'a> { ... }
fn type_of_ext_port(
&self,
arg0: Ref<'a, ExtPort<'a>>,
env: ParamEnv
) -> &'a UnpackedType<'a> { ... }
fn type_of_port_decl(
&self,
arg0: Ref<'a, VarDeclName<'a>>,
env: ParamEnv
) -> &'a UnpackedType<'a> { ... }
fn type_of_var_decl(
&self,
arg0: Ref<'a, VarDeclName<'a>>,
env: ParamEnv
) -> &'a UnpackedType<'a> { ... }
fn type_of_net_decl(
&self,
arg0: Ref<'a, VarDeclName<'a>>,
env: ParamEnv
) -> &'a UnpackedType<'a> { ... }
fn type_of_struct_member(
&self,
arg0: Ref<'a, VarDeclName<'a>>,
env: ParamEnv
) -> &'a UnpackedType<'a> { ... }
fn type_of_value_param(
&self,
arg0: Ref<'a, ParamValueDecl<'a>>,
env: ParamEnv
) -> &'a UnpackedType<'a> { ... }
fn type_of_inst(
&self,
arg0: Ref<'a, Inst<'a>>,
env: ParamEnv
) -> &'a UnpackedType<'a> { ... }
fn map_to_type(
&self,
arg0: Ref<'a, dyn AnyNode<'a>>,
env: ParamEnv
) -> Option<&'a UnpackedType<'a>> { ... }
fn map_to_type_or_error(
&self,
ast: Ref<'a, dyn AnyNode<'a>>,
env: ParamEnv
) -> &'a UnpackedType<'a> { ... }
fn packed_type_from_ast(
&self,
ast: Ref<'a, Type<'a>>,
env: ParamEnv,
implicit_default: Option<PackedCore<'a>>
) -> &'a UnpackedType<'a> { ... }
fn unpacked_type_from_ast(
&self,
ast_type: Ref<'a, Type<'a>>,
arg1: Ref<'a, [TypeDim<'a>]>,
env: ParamEnv,
implicit_default: Option<PackedCore<'a>>
) -> &'a UnpackedType<'a> { ... }
fn type_of_expr(
&self,
expr: Ref<'a, Expr<'a>>,
env: ParamEnv
) -> &'a UnpackedType<'a> { ... }
fn cast_type(&self, node_id: NodeId, env: ParamEnv) -> Option<CastType<'a>> { ... }
fn cast_expr_type(
&self,
arg0: Ref<'a, Expr<'a>>,
env: ParamEnv
) -> CastType<'a> { ... }
fn self_determined_type(
&self,
node_id: NodeId,
env: ParamEnv
) -> Option<&'a UnpackedType<'a>> { ... }
fn need_self_determined_type(
&self,
node_id: NodeId,
env: ParamEnv
) -> &'a UnpackedType<'a> { ... }
fn operation_type(
&self,
node_id: NodeId,
env: ParamEnv
) -> Option<&'a UnpackedType<'a>> { ... }
fn need_operation_type(
&self,
node_id: NodeId,
env: ParamEnv
) -> &'a UnpackedType<'a> { ... }
fn type_context(
&self,
onto: NodeId,
env: ParamEnv
) -> Option<TypeContext<'a>> { ... }
fn need_type_context(
&self,
node_id: NodeId,
env: ParamEnv
) -> TypeContext<'a> { ... }
fn constant_value_of(&self, node_id: NodeId, env: ParamEnv) -> Value<'a> { ... }
fn const_mir_rvalue_int(
&self,
mir: Ref<'a, Rvalue<'a>>
) -> Result<&'a BigInt> { ... }
fn const_mir_rvalue_string(
&self,
mir: Ref<'a, Rvalue<'a>>
) -> Result<&'a Vec<u8>> { ... }
fn const_mir_rvalue(&self, arg0: Ref<'a, Rvalue<'a>>) -> Value<'a> { ... }
fn is_constant(&self, node_id: NodeId) -> Result<bool> { ... }
fn type_default_value(&self, ty: &'a UnpackedType<'a>) -> Value<'a> { ... }
}
Expand description
A collection of compiler queries.
Associated Types
Required methods
Get the context that is passed to compiler query implementations.
fn storage(&self) -> &QueryStorage<'a>
fn storage(&self) -> &QueryStorage<'a>
Get the query caches and runtime data.
Provided methods
fn handle_cycle(&self) -> !
fn handle_cycle(&self) -> !
Called when a query cycle is detected.
fn before_query(&self, tag: &QueryTag<'a>)
fn before_query(&self, tag: &QueryTag<'a>)
Called before a query is executed.
fn after_query(&self, tag: &QueryTag<'a>)
fn after_query(&self, tag: &QueryTag<'a>)
Called after a query is executed.
fn hir_of_module(&self, ast: &'a Module<'a>) -> Result<&'a Module<'a>>
fn hir_of_module(&self, ast: &'a Module<'a>) -> Result<&'a Module<'a>>
Lower a module to HIR.
fn hir_of_interface(&self, ast: &'a Interface<'a>) -> Result<&'a Interface<'a>>
fn hir_of_interface(&self, ast: &'a Interface<'a>) -> Result<&'a Interface<'a>>
Lower an interface to HIR.
Lower an AST expression to HIR.
fn accessed_nodes(
&self,
node_id: NodeId,
env: ParamEnv
) -> Result<Arc<AccessTable>>
fn accessed_nodes(
&self,
node_id: NodeId,
env: ParamEnv
) -> Result<Arc<AccessTable>>
Determine the nodes accessed by another node.
fn inst_details(
&self,
arg0: Ref<'a, Inst<'a>>,
env: ParamEnv
) -> Result<Arc<InstDetails<'a>>>
fn inst_details(
&self,
arg0: Ref<'a, Inst<'a>>,
env: ParamEnv
) -> Result<Arc<InstDetails<'a>>>
Compute the details of an instantiation.
fn inst_target_details(
&self,
arg0: Ref<'a, InstTarget<'a>>,
env: ParamEnv
) -> Result<Arc<InstTargetDetails<'a>>>
fn inst_target_details(
&self,
arg0: Ref<'a, InstTarget<'a>>,
env: ParamEnv
) -> Result<Arc<InstTargetDetails<'a>>>
Compute the details of an instantiated module or interface.
fn mir_assignment_from_procedural(
&self,
origin: NodeId,
lhs: NodeId,
rhs: NodeId,
env: ParamEnv,
span: Span,
kind: AssignKind
) -> &'a Assignment<'a>
fn mir_assignment_from_procedural(
&self,
origin: NodeId,
lhs: NodeId,
rhs: NodeId,
env: ParamEnv,
span: Span,
kind: AssignKind
) -> &'a Assignment<'a>
Lower a procedural assign statement.
fn mir_assignment_from_concurrent(
&self,
arg0: Ref<'a, Assign>,
env: ParamEnv
) -> &'a Assignment<'a>
fn mir_assignment_from_concurrent(
&self,
arg0: Ref<'a, Assign>,
env: ParamEnv
) -> &'a Assignment<'a>
Lower a concurrent assign statement.
fn mir_simplify_assignment(
&self,
arg0: Ref<'a, Assignment<'a>>
) -> Vec<&'a Assignment<'a>>ⓘ
fn mir_simplify_assignment(
&self,
arg0: Ref<'a, Assignment<'a>>
) -> Vec<&'a Assignment<'a>>ⓘ
Simplify an MIR assignment to potentially multiple simple MIR assignments.
This eliminates assignments to compound Lvalue
objects, for example
concatenations, and replaces them with multiple assignments to each of the
individual concatenation fields.
fn mir_lvalue(&self, expr_id: NodeId, env: ParamEnv) -> &'a Lvalue<'a>
fn mir_lvalue(&self, expr_id: NodeId, env: ParamEnv) -> &'a Lvalue<'a>
Lower an expression to an lvalue in the MIR.
fn mir_rvalue(&self, expr_id: NodeId, env: ParamEnv) -> &'a Rvalue<'a>
fn mir_rvalue(&self, expr_id: NodeId, env: ParamEnv) -> &'a Rvalue<'a>
Lower an expression to an rvalue in the MIR.
fn param_env(&self, src: ParamEnvSource<'a>) -> Result<ParamEnv>
fn param_env(&self, src: ParamEnvSource<'a>) -> Result<ParamEnv>
Compute the parameter bindings for an instantiation.
fn map_pattern(
&self,
arg0: Ref<'a, Expr<'a>>,
env: ParamEnv
) -> Result<Arc<PatternMapping<'a>>>
fn map_pattern(
&self,
arg0: Ref<'a, Expr<'a>>,
env: ParamEnv
) -> Result<Arc<PatternMapping<'a>>>
Determine the mapping of a named or positional '{...}
pattern.
fn canonicalize_ports(&self, node: &'a dyn PortedNode<'a>) -> &'a PortList<'a>
fn canonicalize_ports(&self, node: &'a dyn PortedNode<'a>) -> &'a PortList<'a>
Resolve the ports of a module or interface to a canonical list.
This is a fairly complex process due to the many degrees of freedom in SV. Mainly we identify if the item uses an ANSI or non-ANSI style and then go ahead and create the external and internal views of the ports.
fn port_mapping(
&self,
node: &'a dyn PortedNode<'a>,
outer_env: ParamEnv,
inner_env: ParamEnv,
arg3: Ref<'a, InstName<'a>>,
pos: &'a [PosParam],
named: &'a [NamedParam],
has_wildcard_port: bool
) -> Result<Arc<PortMapping<'a>>>
fn port_mapping(
&self,
node: &'a dyn PortedNode<'a>,
outer_env: ParamEnv,
inner_env: ParamEnv,
arg3: Ref<'a, InstName<'a>>,
pos: &'a [PosParam],
named: &'a [NamedParam],
has_wildcard_port: bool
) -> Result<Arc<PortMapping<'a>>>
Compute the port assignments for an instantiation.
Determine the local rib that applies to a node.
This will return either the rib the node itself generates, or the next rib up the hierarchy.
fn hierarchical_rib(&self, node_id: NodeId) -> Result<&'a Rib>
fn hierarchical_rib(&self, node_id: NodeId) -> Result<&'a Rib>
Determine the hierarchical rib of a node.
This will return a rib containing the hierarchical names exposed by a node.
Resolve a name upwards through the ribs.
This is equivalent to performing regular scoped namespace lookup.
Resolve a name downwards.
This is equivalent to performing a hierarchical name lookup.
Resolve a node to its target.
Obtain the details of a struct definition.
fn resolve_field_access(
&self,
node_id: NodeId,
env: ParamEnv
) -> Result<(usize, &'a StructMember<'a>)>
fn resolve_field_access(
&self,
node_id: NodeId,
env: ParamEnv
) -> Result<(usize, &'a StructMember<'a>)>
Resolve the field name in a field access expression.
Returns the index of the field that is actually being accessed, and a reference to the member itself.
fn generated_scope(&self, node: &'a dyn ScopedNode<'a>) -> &'a Scope<'a>
fn generated_scope(&self, node: &'a dyn ScopedNode<'a>) -> &'a Scope<'a>
Determine the scope generated by a node.
fn scope_location(&self, node: &'a dyn AnyNode<'a>) -> ScopeLocation<'a>
fn scope_location(&self, node: &'a dyn AnyNode<'a>) -> ScopeLocation<'a>
Determine the location of a node within its enclosing scope.
fn resolve_local(
&self,
name: Name,
at: ScopeLocation<'a>,
skip_imports: bool
) -> Result<Option<&'a Def<'a>>>
fn resolve_local(
&self,
name: Name,
at: ScopeLocation<'a>,
skip_imports: bool
) -> Result<Option<&'a Def<'a>>>
Resolve a local name in a scope.
This traverses up the scope tree until a definition with visibility LOCAL
is found. Returns None
if no such name exists.
fn resolve_local_or_error(
&self,
name: Spanned<Name>,
at: ScopeLocation<'a>,
skip_imports: bool
) -> Result<&'a Def<'a>>
fn resolve_local_or_error(
&self,
name: Spanned<Name>,
at: ScopeLocation<'a>,
skip_imports: bool
) -> Result<&'a Def<'a>>
Resolve a local name in a scope or emit an error.
Calls resolve_local
. Either returns Ok
if a node was found, or Err
after emitting a diagnostic error message.
fn resolve_namespace(
&self,
name: Name,
inside: &'a dyn ScopedNode<'a>
) -> Option<&'a Def<'a>>
fn resolve_namespace(
&self,
name: Name,
inside: &'a dyn ScopedNode<'a>
) -> Option<&'a Def<'a>>
Resolve a name in a scope as a namespace lookup.
This checks if the scope contains a definition with visibility
NAMESPACE
. Returns None
if no such name exists.
fn resolve_namespace_or_error(
&self,
name: Spanned<Name>,
inside: &'a dyn ScopedNode<'a>
) -> Result<&'a Def<'a>>
fn resolve_namespace_or_error(
&self,
name: Spanned<Name>,
inside: &'a dyn ScopedNode<'a>
) -> Result<&'a Def<'a>>
Resolve a name in a scope as a namespace lookup or emit an error.
Calls resolve_namespace
. Either returns Ok
if a node was found, or Err
after emitting a diagnostic error message.
fn resolve_hierarchical(
&self,
name: Name,
inside: &'a dyn ScopedNode<'a>
) -> Option<&'a Def<'a>>
fn resolve_hierarchical(
&self,
name: Name,
inside: &'a dyn ScopedNode<'a>
) -> Option<&'a Def<'a>>
Resolve a name in a scope as a hierarchical lookup.
This checks if the scope contains a definition with visibility
HIERARCHICAL
. Returns None
if no such name exists.
fn resolve_hierarchical_or_error(
&self,
name: Spanned<Name>,
inside: &'a dyn ScopedNode<'a>
) -> Result<&'a Def<'a>>
fn resolve_hierarchical_or_error(
&self,
name: Spanned<Name>,
inside: &'a dyn ScopedNode<'a>
) -> Result<&'a Def<'a>>
Resolve a name in a scope as a hierarchical lookup or emit an error.
Calls resolve_hierarchical
. Either returns Ok
if a node was found, or
Err
after emitting a diagnostic error message.
fn resolve_imported_scope(
&self,
node: &'a ImportItem<'a>
) -> Result<&'a dyn ScopedNode<'a>>
fn resolve_imported_scope(
&self,
node: &'a ImportItem<'a>
) -> Result<&'a dyn ScopedNode<'a>>
Resolve an import to the scope it imports.
This function emits a diagnostic if the target of the import has no scope. Being a query, this ensures that the error is only produced once.
Recursively resolves names throughout the AST.
Returns true
if all names resolved successfully, false
otherwise. This
function helps in triggering name resolution errors at a defined point in
the compilation.
fn resolve_inst_target(&self, inst: &'a Inst<'a>) -> Result<InstTarget<'a>>
fn resolve_inst_target(&self, inst: &'a Inst<'a>) -> Result<InstTarget<'a>>
Resolve the target of an instantiation.
fn disamb_kind(&self, arg0: Ref<'a, dyn AnyNode<'a>>) -> Kind
fn disamb_kind(&self, arg0: Ref<'a, dyn AnyNode<'a>>) -> Kind
Determine the kind of a node.
fn disamb_type_or_expr(
&self,
arg0: Ref<'a, TypeOrExpr<'a>>
) -> Result<&'a TypeOrExpr<'a>>
fn disamb_type_or_expr(
&self,
arg0: Ref<'a, TypeOrExpr<'a>>
) -> Result<&'a TypeOrExpr<'a>>
Disambiguate a type or expression.
Determine the type of a node.
fn type_of_int_port(
&self,
arg0: Ref<'a, IntPort<'a>>,
env: ParamEnv
) -> &'a UnpackedType<'a>
fn type_of_int_port(
&self,
arg0: Ref<'a, IntPort<'a>>,
env: ParamEnv
) -> &'a UnpackedType<'a>
Determine the type of an internal port.
fn type_of_ext_port(
&self,
arg0: Ref<'a, ExtPort<'a>>,
env: ParamEnv
) -> &'a UnpackedType<'a>
fn type_of_ext_port(
&self,
arg0: Ref<'a, ExtPort<'a>>,
env: ParamEnv
) -> &'a UnpackedType<'a>
Determine the type of an external port.
fn type_of_port_decl(
&self,
arg0: Ref<'a, VarDeclName<'a>>,
env: ParamEnv
) -> &'a UnpackedType<'a>
fn type_of_port_decl(
&self,
arg0: Ref<'a, VarDeclName<'a>>,
env: ParamEnv
) -> &'a UnpackedType<'a>
Determine the type of a port declaration.
fn type_of_var_decl(
&self,
arg0: Ref<'a, VarDeclName<'a>>,
env: ParamEnv
) -> &'a UnpackedType<'a>
fn type_of_var_decl(
&self,
arg0: Ref<'a, VarDeclName<'a>>,
env: ParamEnv
) -> &'a UnpackedType<'a>
Determine the type of a variable declaration.
fn type_of_net_decl(
&self,
arg0: Ref<'a, VarDeclName<'a>>,
env: ParamEnv
) -> &'a UnpackedType<'a>
fn type_of_net_decl(
&self,
arg0: Ref<'a, VarDeclName<'a>>,
env: ParamEnv
) -> &'a UnpackedType<'a>
Determine the type of a net declaration.
fn type_of_struct_member(
&self,
arg0: Ref<'a, VarDeclName<'a>>,
env: ParamEnv
) -> &'a UnpackedType<'a>
fn type_of_struct_member(
&self,
arg0: Ref<'a, VarDeclName<'a>>,
env: ParamEnv
) -> &'a UnpackedType<'a>
Determine the type of a struct member.
fn type_of_value_param(
&self,
arg0: Ref<'a, ParamValueDecl<'a>>,
env: ParamEnv
) -> &'a UnpackedType<'a>
fn type_of_value_param(
&self,
arg0: Ref<'a, ParamValueDecl<'a>>,
env: ParamEnv
) -> &'a UnpackedType<'a>
Determine the type of a value parameter.
fn type_of_inst(
&self,
arg0: Ref<'a, Inst<'a>>,
env: ParamEnv
) -> &'a UnpackedType<'a>
fn type_of_inst(
&self,
arg0: Ref<'a, Inst<'a>>,
env: ParamEnv
) -> &'a UnpackedType<'a>
Determine the type of an instance.
fn map_to_type(
&self,
arg0: Ref<'a, dyn AnyNode<'a>>,
env: ParamEnv
) -> Option<&'a UnpackedType<'a>>
fn map_to_type(
&self,
arg0: Ref<'a, dyn AnyNode<'a>>,
env: ParamEnv
) -> Option<&'a UnpackedType<'a>>
Map an AST node to the type it represents.
Returns None
if the given AST node does not evaluate to a type.
fn map_to_type_or_error(
&self,
ast: Ref<'a, dyn AnyNode<'a>>,
env: ParamEnv
) -> &'a UnpackedType<'a>
fn map_to_type_or_error(
&self,
ast: Ref<'a, dyn AnyNode<'a>>,
env: ParamEnv
) -> &'a UnpackedType<'a>
Map an AST node to the type it represents.
Returns None
if the given AST node does not evaluate to a type.
fn packed_type_from_ast(
&self,
ast: Ref<'a, Type<'a>>,
env: ParamEnv,
implicit_default: Option<PackedCore<'a>>
) -> &'a UnpackedType<'a>
fn packed_type_from_ast(
&self,
ast: Ref<'a, Type<'a>>,
env: ParamEnv,
implicit_default: Option<PackedCore<'a>>
) -> &'a UnpackedType<'a>
Map a type node in the AST to an packed type.
This is the first half of type computation, and is concerned with the type information that is usually carried on the left of a declaration name. In a separate step, the declarations extend this packed type with the unpacked dimensions provided on the right of the declaration name.
Note that this function nevertheless returns an UnpackedType
, since the
AST can contain types like string
and event
, which don’t map to the
PackedType
struct.
If an implicit default is present, implicit types are expanded to that core type. Otherwise the mapping fails with a diagnostic.
fn unpacked_type_from_ast(
&self,
ast_type: Ref<'a, Type<'a>>,
arg1: Ref<'a, [TypeDim<'a>]>,
env: ParamEnv,
implicit_default: Option<PackedCore<'a>>
) -> &'a UnpackedType<'a>
fn unpacked_type_from_ast(
&self,
ast_type: Ref<'a, Type<'a>>,
arg1: Ref<'a, [TypeDim<'a>]>,
env: ParamEnv,
implicit_default: Option<PackedCore<'a>>
) -> &'a UnpackedType<'a>
Map a type node and unpacked dimensions in the AST to an unpacked type.
This is the second half of type computation. Maps the given type to a packed type first, then applies the given dimensions as unpacked dimensions.
If an implicit default is present, implicit types are expanded to that core type. Otherwise the mapping fails with a diagnostic.
fn type_of_expr(
&self,
expr: Ref<'a, Expr<'a>>,
env: ParamEnv
) -> &'a UnpackedType<'a>
fn type_of_expr(
&self,
expr: Ref<'a, Expr<'a>>,
env: ParamEnv
) -> &'a UnpackedType<'a>
Determine the type of an expression.
Get the cast type of a node.
Get the cast type of an expression.
fn self_determined_type(
&self,
node_id: NodeId,
env: ParamEnv
) -> Option<&'a UnpackedType<'a>>
fn self_determined_type(
&self,
node_id: NodeId,
env: ParamEnv
) -> Option<&'a UnpackedType<'a>>
Get the self-determined type of a node.
fn need_self_determined_type(
&self,
node_id: NodeId,
env: ParamEnv
) -> &'a UnpackedType<'a>
fn need_self_determined_type(
&self,
node_id: NodeId,
env: ParamEnv
) -> &'a UnpackedType<'a>
Require a node to have a self-determined type.
Emits an error if the node has no self-determined type.
fn operation_type(
&self,
node_id: NodeId,
env: ParamEnv
) -> Option<&'a UnpackedType<'a>>
fn operation_type(
&self,
node_id: NodeId,
env: ParamEnv
) -> Option<&'a UnpackedType<'a>>
Get the operation type of an expression.
fn need_operation_type(
&self,
node_id: NodeId,
env: ParamEnv
) -> &'a UnpackedType<'a>
fn need_operation_type(
&self,
node_id: NodeId,
env: ParamEnv
) -> &'a UnpackedType<'a>
Require a node to have an operation type.
Emits an error if the node has no operation type.
fn type_context(&self, onto: NodeId, env: ParamEnv) -> Option<TypeContext<'a>>
fn type_context(&self, onto: NodeId, env: ParamEnv) -> Option<TypeContext<'a>>
Get the type context of a node.
fn need_type_context(&self, node_id: NodeId, env: ParamEnv) -> TypeContext<'a>
fn need_type_context(&self, node_id: NodeId, env: ParamEnv) -> TypeContext<'a>
Get the type context of a node.
fn constant_value_of(&self, node_id: NodeId, env: ParamEnv) -> Value<'a>
fn constant_value_of(&self, node_id: NodeId, env: ParamEnv) -> Value<'a>
Determine the constant value of a node.
Determine the constant integer value of an MIR rvalue.
Emits a diagnostic if the value is not an integer.
Determine the constant string value of an MIR rvalue.
Emits a diagnostic if the value is not a string.
fn const_mir_rvalue(&self, arg0: Ref<'a, Rvalue<'a>>) -> Value<'a>
fn const_mir_rvalue(&self, arg0: Ref<'a, Rvalue<'a>>) -> Value<'a>
Determine the constant value of an MIR rvalue.
fn is_constant(&self, node_id: NodeId) -> Result<bool>
fn is_constant(&self, node_id: NodeId) -> Result<bool>
Check if a node has a constant value.
fn type_default_value(&self, ty: &'a UnpackedType<'a>) -> Value<'a>
fn type_default_value(&self, ty: &'a UnpackedType<'a>) -> Value<'a>
Determine the default value of a type.