@@ -374,8 +374,8 @@ check_leading_kw_at_start (const S &segment, bool condition)
374
374
template <Namespace N>
375
375
template <typename S>
376
376
tl::optional<typename std::vector<S>::const_iterator>
377
- ForeverStack<N>::find_starting_point (const std::vector<S> &segments,
378
- Node &starting_point)
377
+ ForeverStack<N>::find_starting_point (
378
+ const std::vector<S> &segments, std::reference_wrapper< Node> &starting_point)
379
379
{
380
380
auto iterator = segments.begin ();
381
381
@@ -412,14 +412,15 @@ ForeverStack<N>::find_starting_point (const std::vector<S> &segments,
412
412
}
413
413
if (seg.is_super_path_seg ())
414
414
{
415
- if (starting_point.is_root ())
415
+ if (starting_point.get (). is_root ())
416
416
{
417
417
rust_error_at (seg.get_locus (), ErrorCode::E0433 ,
418
418
" too many leading %<super%> keywords" );
419
419
return tl::nullopt;
420
420
}
421
421
422
- starting_point = find_closest_module (starting_point.parent .value ());
422
+ starting_point
423
+ = find_closest_module (starting_point.get ().parent .value ());
423
424
continue ;
424
425
}
425
426
@@ -494,12 +495,12 @@ ForeverStack<N>::resolve_path (const std::vector<S> &segments)
494
495
if (segments.size () == 1 )
495
496
return get (segments.back ().as_string ());
496
497
497
- auto starting_point = cursor ();
498
+ std::reference_wrapper<Node> starting_point = cursor ();
498
499
499
500
return find_starting_point (segments, starting_point)
500
501
.and_then ([this , &segments, &starting_point] (
501
502
typename std::vector<S>::const_iterator iterator) {
502
- return resolve_segments (starting_point, segments, iterator);
503
+ return resolve_segments (starting_point. get () , segments, iterator);
503
504
})
504
505
.and_then ([&segments] (Node final_node) {
505
506
return final_node.rib .get (segments.back ().as_string ());
0 commit comments