Fixed tree_walking for the new breadcrumbs.
This commit is contained in:
		
							parent
							
								
									71592a9a32
								
							
						
					
					
						commit
						256dcd03c5
					
				| @ -56,21 +56,15 @@ pub fn walk_path<'a, P>( | ||||
| where | ||||
|     P: Borrow<str>, | ||||
| { | ||||
|     /* | ||||
|     match (breadcrumbs.is_empty(), path.first()) { | ||||
|         (true, _) => return Err(WalkError::CantWalk), | ||||
|         (false, None) => { | ||||
|             return breadcrumbs | ||||
|                 .last() | ||||
|                 .map(|bte| bte.borrow()) | ||||
|                 .ok_or(WalkError::CantWalk) | ||||
|         } | ||||
|         (false, Some(path_first)) if path_first.borrow() == "." => { | ||||
|     match (breadcrumbs.last(), path.first()) { | ||||
|         (None, _) => return Err(WalkError::CantWalk), | ||||
|         (Some(last_elem), None) => return Ok(last_elem.borrow()), | ||||
|         (Some(_), Some(path_first)) if path_first.borrow() == "." => { | ||||
|             let first_non_pseudo_element = get_first_non_pseudo_element(breadcrumbs); | ||||
|             return match first_non_pseudo_element { | ||||
|                 None => Err(WalkError::CantWalk), | ||||
|                 Some(current_context) => { | ||||
|                     match walk_path_from_single_level(current_context.get_ice(), &path[1..]) { | ||||
|                     match walk_path_from_single_level(current_context.borrow(), &path[1..]) { | ||||
|                         // If no walking was done at all or we partially walked
 | ||||
|                         // then stop trying to find anything because '.' restricts
 | ||||
|                         // us to the current scope
 | ||||
| @ -80,9 +74,9 @@ where | ||||
|                 } | ||||
|             }; | ||||
|         } | ||||
|         (false, Some(path_first)) => { | ||||
|             for context in breadcrumbs.ice_iter() { | ||||
|                 match walk_path_from_single_level(context, path) { | ||||
|         (Some(_), Some(path_first)) => { | ||||
|             for context in breadcrumbs.iter().rev() { | ||||
|                 match walk_path_from_single_level(context.borrow(), path) { | ||||
|                     // If no walking was done at all, keep looping
 | ||||
|                     WalkResult::NoWalk => {} | ||||
|                     // If we partially walked then stop trying to find
 | ||||
| @ -97,6 +91,4 @@ where | ||||
|     } | ||||
| 
 | ||||
|     Err(WalkError::CantWalk) | ||||
|      */ | ||||
|     todo!() | ||||
| } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Tom Alexander
						Tom Alexander