Trait stc_ts_file_analyzer::loader::Load
source · [−]pub trait Load: 'static + Send + Sync {
fn module_id(&self, base: &Arc<FileName>, src: &str) -> Option<ModuleId>;
fn is_in_same_circular_group(&self, base: &Arc<FileName>, src: &str) -> bool;
fn load_circular_dep(
&self,
base: &Arc<FileName>,
src: &str,
partial: &ModuleTypeData
) -> VResult<Type>;
fn load_non_circular_dep(
&self,
base: &Arc<FileName>,
src: &str
) -> VResult<Type>;
fn declare_module(&self, name: &JsWord, module: Type) -> ModuleId;
}
Expand description
TODO(kdy1): Refactor after merging https://github.com/dudykr/stc/pull/601
Group of circular imports are handled by one thread. This
Required Methods
Note: This method called within a thread
sourcefn load_circular_dep(
&self,
base: &Arc<FileName>,
src: &str,
partial: &ModuleTypeData
) -> VResult<Type>
fn load_circular_dep(
&self,
base: &Arc<FileName>,
src: &str,
partial: &ModuleTypeData
) -> VResult<Type>
This method can be called multiple time for same module.
Also note that this method is called within a single thread.
partial
denotes the types and variables which the [Analyzer] succeed
processing, with resolved imports.
Returned value must be Type::Arc of Type::Module
Note: This method is called in parallel.
Returned value must be Type::Arc of Type::Module
sourcefn declare_module(&self, name: &JsWord, module: Type) -> ModuleId
fn declare_module(&self, name: &JsWord, module: Type) -> ModuleId
module
should be Type::Arc of Type::Module.