fn resolve_possibly_assoc_item(&mut self,
                                   id: NodeId,
                                   maybe_qself: Option<&QSelf>,
                                   path: &Path,
                                   namespace: Namespace)
                                   -> Option<PathResolution> {
        let max_assoc_types;

        match maybe_qself {
            Some(qself) => {
                if qself.position == 0 {
                    // FIXME: Create some fake resolution that can't possibly be a type.
                    return Some(PathResolution {
                        base_def: Def::Mod(self.definitions.local_def_id(ast::CRATE_NODE_ID)),
                        depth: path.segments.len(),
                    });
                }
                max_assoc_types = path.segments.len() - qself.position;
                // Make sure the trait is valid.
                let _ = self.resolve_trait_reference(id, path, max_assoc_types);
            }
            None => {
                max_assoc_types = path.segments.len();
            }
        }

        let mut resolution = self.with_no_errors(|this| {
            this.resolve_path(id, path, 0, namespace).ok()
        });
        for depth in 1..max_assoc_types {
            if resolution.is_some() {
                break;
            }
            self.with_no_errors(|this| {
                let partial_resolution = this.resolve_path(id, path, depth, TypeNS).ok();
                if let Some(Def::Mod(..)) = partial_resolution.map(|r| r.base_def) {
                    // Modules cannot have associated items
                } else {
                    resolution = partial_resolution;
                }
            });
        }
        resolution
    }
/// Handles paths that may refer to associated items
Handles paths that may refer to associated items
Handles paths that may refer to associated items
fn resolve_possibly_assoc_item(&mut self,
                                   id: NodeId,
                                   maybe_qself: Option<&QSelf>,
                                   path: &Path,
                                   namespace: Namespace)
                                   -> Option<PathResolution> {
        let max_assoc_types;
        match maybe_qself {
            Some(qself) => {
                if qself.position == 0 {
                    // FIXME: Create some fake resolution that can't possibly be a type.
                    return Some(PathResolution {
                        base_def: Def::Mod(self.definitions.local_def_id(ast::CRATE_NODE_ID)),
                        depth: path.segments.len(),
                    });
                }
                max_assoc_types = path.segments.len() - qself.position;
                // Make sure the trait is valid.
                let _ = self.resolve_trait_reference(id, path, max_assoc_types);
            }
            None => {
                max_assoc_types = path.segments.len();
            }
        }
        let mut resolution = self.with_no_errors(|this| {
            this.resolve_path(id, path, 0, namespace).ok()
        });
        for depth in 1..max_assoc_types {
            if resolution.is_some() {
                break;
            }
            self.with_no_errors(|this| {
                let partial_resolution = this.resolve_path(id, path, depth, TypeNS).ok();
                if let Some(Def::Mod(..)) = partial_resolution.map(|r| r.base_def) {
                    // Modules cannot have associated items
                } else {
                    resolution = partial_resolution;
                }
            });
        }
        resolution
    }
fn resolve_possibly_assoc_item ( & mut self , id : NodeId , maybe_qself : Option < & QSelf > , path : & Path , namespace : Namespace ) -> Option < PathResolution > { let max_assoc_types ; match maybe_qself { Some ( qself ) => { if qself . position == 0 { // FIXME: Create some fake resolution that can't possibly be a type. return Some ( PathResolution { base_def : Def :: Mod ( self . definitions . local_def_id ( ast :: CRATE_NODE_ID ) ) , depth : path . segments . len ( ) , } ) ; } max_assoc_types = path . segments . len ( ) - qself . position ; // Make sure the trait is valid. let _ = self . resolve_trait_reference ( id , path , max_assoc_types ) ; } None => { max_assoc_types = path . segments . len ( ) ; } } let mut resolution = self . with_no_errors ( | this | { this . resolve_path ( id , path , 0 , namespace ) . ok ( ) } ) ; for depth in 1 .. max_assoc_types { if resolution . is_some ( ) { break ; } self . with_no_errors ( | this | { let partial_resolution = this . resolve_path ( id , path , depth , TypeNS ) . ok ( ) ; if let Some ( Def :: Mod ( .. ) ) = partial_resolution . map ( | r | r . base_def ) { // Modules cannot have associated items } else { resolution = partial_resolution ; } } ) ; } resolution }
Handles paths that may refer to associated items
Handles paths that may refer to associated items
&mut self
id
NodeId
maybe_qself
Option<&QSelf>
path
&Path
namespace
Namespace
&mut self
id
NodeId
maybe_qself
Option<&QSelf>
path
&Path
namespace
Namespace