pub struct Resolver<'db> {
pub data: ResolverData,
pub owning_crate_id: CrateId,
pub settings: CrateSettings,
/* private fields */
}
Expand description
Resolves paths semantically.
Fields§
§data: ResolverData
§owning_crate_id: CrateId
§settings: CrateSettings
Implementations§
source§impl Resolver<'_>
impl Resolver<'_>
sourcepub fn set_feature_config(
&mut self,
element_id: &impl LanguageElementId,
syntax: &impl QueryAttrs,
diagnostics: &mut SemanticDiagnostics,
)
pub fn set_feature_config( &mut self, element_id: &impl LanguageElementId, syntax: &impl QueryAttrs, diagnostics: &mut SemanticDiagnostics, )
Extracts the allowed node from the syntax, and sets it as the allowed features of the resolver.
source§impl<'db> Resolver<'db>
impl<'db> Resolver<'db>
pub fn new( db: &'db dyn SemanticGroup, module_file_id: ModuleFileId, inference_id: InferenceId, ) -> Self
pub fn with_data(db: &'db dyn SemanticGroup, data: ResolverData) -> Self
pub fn inference(&mut self) -> Inference<'_>
sourcepub fn add_generic_param(&mut self, generic_param_id: GenericParamId)
pub fn add_generic_param(&mut self, generic_param_id: GenericParamId)
Adds a generic param to an existing resolver. This is required since a resolver needs to exist before resolving the generic params, and thus, they are added to the Resolver only after they are resolved.
sourcepub fn resolve_concrete_path(
&mut self,
diagnostics: &mut SemanticDiagnostics,
path: impl AsSegments,
item_type: NotFoundItemType,
) -> Maybe<ResolvedConcreteItem>
pub fn resolve_concrete_path( &mut self, diagnostics: &mut SemanticDiagnostics, path: impl AsSegments, item_type: NotFoundItemType, ) -> Maybe<ResolvedConcreteItem>
Resolves a concrete item, given a path. Guaranteed to result in at most one diagnostic. Item not inside a statement.
sourcepub fn resolve_concrete_path_ex(
&mut self,
diagnostics: &mut SemanticDiagnostics,
path: impl AsSegments,
item_type: NotFoundItemType,
statement_env: Option<&mut Environment>,
) -> Maybe<ResolvedConcreteItem>
pub fn resolve_concrete_path_ex( &mut self, diagnostics: &mut SemanticDiagnostics, path: impl AsSegments, item_type: NotFoundItemType, statement_env: Option<&mut Environment>, ) -> Maybe<ResolvedConcreteItem>
Resolves a concrete item, given a path. Guaranteed to result in at most one diagnostic.
sourcepub fn resolve_generic_path(
&mut self,
diagnostics: &mut SemanticDiagnostics,
path: impl AsSegments,
item_type: NotFoundItemType,
statement_env: Option<&mut Environment>,
) -> Maybe<ResolvedGenericItem>
pub fn resolve_generic_path( &mut self, diagnostics: &mut SemanticDiagnostics, path: impl AsSegments, item_type: NotFoundItemType, statement_env: Option<&mut Environment>, ) -> Maybe<ResolvedGenericItem>
Resolves a generic item, given a path. Guaranteed to result in at most one diagnostic.
sourcepub fn resolve_generic_path_with_args(
&mut self,
diagnostics: &mut SemanticDiagnostics,
path: impl AsSegments,
item_type: NotFoundItemType,
statement_env: Option<&mut Environment>,
) -> Maybe<ResolvedGenericItem>
pub fn resolve_generic_path_with_args( &mut self, diagnostics: &mut SemanticDiagnostics, path: impl AsSegments, item_type: NotFoundItemType, statement_env: Option<&mut Environment>, ) -> Maybe<ResolvedGenericItem>
Resolves a generic item, given a concrete item path, while ignoring the generic args. Guaranteed to result in at most one diagnostic.
sourcepub fn prelude_submodule(&self) -> ModuleId
pub fn prelude_submodule(&self) -> ModuleId
Returns the crate’s prelude
submodule.
sourcepub fn specialize_function(
&mut self,
diagnostics: &mut SemanticDiagnostics,
stable_ptr: SyntaxStablePtrId,
generic_function: GenericFunctionId,
generic_args: &[GenericArg],
) -> Maybe<FunctionId>
pub fn specialize_function( &mut self, diagnostics: &mut SemanticDiagnostics, stable_ptr: SyntaxStablePtrId, generic_function: GenericFunctionId, generic_args: &[GenericArg], ) -> Maybe<FunctionId>
Specializes a generic function.
sourcepub fn specialize_type(
&mut self,
diagnostics: &mut SemanticDiagnostics,
stable_ptr: SyntaxStablePtrId,
generic_type: GenericTypeId,
generic_args: &[GenericArg],
) -> Maybe<TypeId>
pub fn specialize_type( &mut self, diagnostics: &mut SemanticDiagnostics, stable_ptr: SyntaxStablePtrId, generic_type: GenericTypeId, generic_args: &[GenericArg], ) -> Maybe<TypeId>
Specializes a generic type.
pub fn impl_lookup_context(&self) -> ImplLookupContext
sourcepub fn resolve_generic_args(
&mut self,
diagnostics: &mut SemanticDiagnostics,
generic_params: &[GenericParam],
generic_args_syntax: &[GenericArg],
stable_ptr: SyntaxStablePtrId,
) -> Maybe<Vec<GenericArgumentId>>
pub fn resolve_generic_args( &mut self, diagnostics: &mut SemanticDiagnostics, generic_params: &[GenericParam], generic_args_syntax: &[GenericArg], stable_ptr: SyntaxStablePtrId, ) -> Maybe<Vec<GenericArgumentId>>
Resolves generic arguments. For each generic argument, if the syntax is provided, it will be resolved by the inference. Otherwise, resolved by type.
sourcepub fn ignore_visibility_checks(&self, module_id: ModuleId) -> bool
pub fn ignore_visibility_checks(&self, module_id: ModuleId) -> bool
Should visibility checks not actually happen for lookups in this module.
Methods from Deref<Target = ResolverData>§
pub fn clone_with_inference_id( &self, db: &dyn SemanticGroup, inference_id: InferenceId, ) -> Self
Trait Implementations§
Auto Trait Implementations§
impl<'db> Freeze for Resolver<'db>
impl<'db> !RefUnwindSafe for Resolver<'db>
impl<'db> !Send for Resolver<'db>
impl<'db> !Sync for Resolver<'db>
impl<'db> Unpin for Resolver<'db>
impl<'db> !UnwindSafe for Resolver<'db>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more