fn try_result(&self, ns: Namespace, allow_private_imports: bool)
                  -> Option<ResolveResult<&'a NameBinding<'a>>> {
        match self.binding {
            Some(binding) if !binding.is_glob_import() =>
                return Some(Success(binding)),
            _ => {} // Items and single imports are not shadowable
        };

        // Check if a single import can still define the name.
        match self.single_imports {
            SingleImports::None => {},
            SingleImports::AtLeastOne => return Some(Indeterminate),
            SingleImports::MaybeOne(directive) => {
                // If (1) we don't allow private imports, (2) no public single import can define
                // the name, and (3) no public glob has defined the name, the resolution depends
                // on whether more globs can define the name.
                if !allow_private_imports && directive.vis != ty::Visibility::Public &&
                   !self.binding.map(NameBinding::is_pseudo_public).unwrap_or(false) {
                    return None;
                }

                let target_module = match directive.target_module.get() {
                    Some(target_module) => target_module,
                    None => return Some(Indeterminate),
                };
                let name = match directive.subclass {
                    SingleImport { source, .. } => source,
                    GlobImport { .. } => unreachable!(),
                };
                match target_module.resolve_name(name, ns, false) {
                    Failed(_) => {}
                    _ => return Some(Indeterminate),
                }
            }
        }

        self.binding.map(Success)
    }
// Returns Some(the resolution of the name), or None if the resolution depends
// on whether more globs can define the name.
Returns Some(the resolution of the name), or None if the resolution depends
on whether more globs can define the name.
Returns Some ( the resolution of the name ) or None if the resolution depends on whether more globs can define the name .
fn try_result(&self, ns: Namespace, allow_private_imports: bool)
                  -> Option<ResolveResult<&'a NameBinding<'a>>> {
        match self.binding {
            Some(binding) if !binding.is_glob_import() =>
                return Some(Success(binding)),
            _ => {} // Items and single imports are not shadowable
        };
        // Check if a single import can still define the name.
        match self.single_imports {
            SingleImports::None => {},
            SingleImports::AtLeastOne => return Some(Indeterminate),
            SingleImports::MaybeOne(directive) => {
                // If (1) we don't allow private imports, (2) no public single import can define
                // the name, and (3) no public glob has defined the name, the resolution depends
                // on whether more globs can define the name.
                if !allow_private_imports && directive.vis != ty::Visibility::Public &&
                   !self.binding.map(NameBinding::is_pseudo_public).unwrap_or(false) {
                    return None;
                }
                let target_module = match directive.target_module.get() {
                    Some(target_module) => target_module,
                    None => return Some(Indeterminate),
                };
                let name = match directive.subclass {
                    SingleImport { source, .. } => source,
                    GlobImport { .. } => unreachable!(),
                };
                match target_module.resolve_name(name, ns, false) {
                    Failed(_) => {}
                    _ => return Some(Indeterminate),
                }
            }
        }
        self.binding.map(Success)
    }
fn try_result ( & self , ns : Namespace , allow_private_imports : bool ) -> Option < ResolveResult < & ' a NameBinding < ' a > > > { match self . binding { Some ( binding ) if ! binding . is_glob_import ( ) => return Some ( Success ( binding ) ) , _ => { } // Items and single imports are not shadowable } ; // Check if a single import can still define the name. match self . single_imports { SingleImports :: None => { } , SingleImports :: AtLeastOne => return Some ( Indeterminate ) , SingleImports :: MaybeOne ( directive ) => { // If (1) we don't allow private imports, (2) no public single import can define // the name, and (3) no public glob has defined the name, the resolution depends // on whether more globs can define the name. if ! allow_private_imports && directive . vis != ty :: Visibility :: Public && ! self . binding . map ( NameBinding :: is_pseudo_public ) . unwrap_or ( false ) { return None ; } let target_module = match directive . target_module . get ( ) { Some ( target_module ) => target_module , None => return Some ( Indeterminate ) , } ; let name = match directive . subclass { SingleImport { source , .. } => source , GlobImport { .. } => unreachable ! ( ) , } ; match target_module . resolve_name ( name , ns , false ) { Failed ( _ ) => { } _ => return Some ( Indeterminate ) , } } } self . binding . map ( Success ) }
Returns Some(the resolution of the name), or None if the resolution depends
on whether more globs can define the name.
Returns Some ( the resolution of the name ) or None if the resolution depends on whether more globs can define the name .
&self
ns
Namespace
allow_private_imports
bool
&self
ns
Namespace
allow_private_imports
bool