pub trait NamespaceWrapper {
Show 20 methods fn resolve_type_with_self(
        &self,
        ty: TypeInfo,
        self_type: TypeId
    ) -> Result<TypeId, ()>;
fn resolve_type_without_self(&self, ty: &TypeInfo) -> TypeId;
fn insert(&self, name: Ident, item: TypedDeclaration) -> CompileResult<()>;
fn insert_module(&self, module_name: String, module_contents: Namespace);
fn insert_module_ref(&self, module_name: String, ix: NamespaceRef);
fn insert_trait_implementation(
        &self,
        trait_name: CallPath,
        type_implementing_for: TypeInfo,
        functions_buf: Vec<TypedFunctionDeclaration>
    ) -> CompileResult<()>;
fn item_import(
        &self,
        from_namespace: Option<NamespaceRef>,
        path: Vec<Ident>,
        item: &Ident,
        alias: Option<Ident>
    ) -> CompileResult<()>;
fn self_import(
        &self,
        from_module: Option<NamespaceRef>,
        path: Vec<Ident>,
        alias: Option<Ident>
    ) -> CompileResult<()>;
fn find_module_relative(
        &self,
        path: &[Ident]
    ) -> CompileResult<NamespaceRef>;
fn find_method_for_type(
        &self,
        type: TypeId,
        method_name: &Ident,
        method_path: &[Ident],
        from_module: Option<NamespaceRef>,
        self_type: TypeId,
        args_buf: &VecDeque<TypedExpression>
    ) -> CompileResult<TypedFunctionDeclaration>;
fn star_import(
        &self,
        from_module: Option<NamespaceRef>,
        path: Vec<Ident>
    ) -> CompileResult<()>;
fn get_methods_for_type(
        &self,
        type: TypeId
    ) -> Vec<TypedFunctionDeclaration>;
fn copy_methods_to_type(&self, old_type: TypeInfo, new_type: TypeInfo);
fn get_name_from_path(
        &self,
        path: &[Ident],
        name: &Ident
    ) -> CompileResult<TypedDeclaration>;
fn get_call_path(
        &self,
        symbol: &CallPath
    ) -> CompileResult<TypedDeclaration>;
fn get_symbol(&self, symbol: &Ident) -> CompileResult<TypedDeclaration>;
fn find_enum(&self, enum_name: &Ident) -> Option<TypedEnumDeclaration>;
fn get_struct_type_fields(
        &self,
        ty: TypeId,
        debug_string: impl Into<String>,
        debug_span: &Span
    ) -> CompileResult<(Vec<OwnedTypedStructField>, String)>;
fn get_tuple_elems(
        &self,
        ty: TypeId,
        debug_string: impl Into<String>,
        debug_span: &Span
    ) -> CompileResult<Vec<TypeId>>;
fn find_subfield_type(
        &self,
        subfield_exp: &[Ident]
    ) -> CompileResult<(TypeId, TypeId)>;
}

Required methods

this function either returns a struct (i.e. custom type), None, denoting the type that is being looked for is actually a generic, not-yet-resolved type.

If a self type is given and anything on this ref chain refers to self, update the chain.

Given a method and a type (plus a self_type to potentially resolve it), find that method in the namespace. Requires args_buf because of some special casing for the standard library where we pull the type from the arguments buffer.

This function will generate a missing method error if the method is not found.

Given a path to a module, create synonyms to every symbol in that module. This is used when an import path contains an asterisk.

Used for calls that look like this: foo::bar::function where foo and bar are the prefixes and function is the suffix

given a declaration that may refer to a variable which contains a struct, find that struct’s fields and name for use in determining if a subfield expression is valid e.g. foo.bar.baz is foo a struct? does it contain a field bar? is foo.bar a struct? does foo.bar contain a field baz? this is the problem this function addresses

Returns a tuple where the first element is the [ResolvedType] of the actual expression, and the second is the [ResolvedType] of its parent, for control-flow analysis.

Implementors