@@ -770,7 +770,6 @@ pub struct sg_partial_symbol_stack {
770
770
/// The handle of the first element in the partial symbol stack, or SG_LIST_EMPTY_HANDLE if the
771
771
/// list is empty, or 0 if the list is null.
772
772
pub cells : sg_partial_symbol_stack_cell_handle ,
773
- pub direction : sg_deque_direction ,
774
773
pub length : u32 ,
775
774
/// The symbol stack variable representing the unknown content of a partial symbol stack, or 0
776
775
/// if the variable is missing. (If so, this partial symbol stack can only match a symbol
@@ -854,13 +853,12 @@ pub extern "C" fn sg_partial_path_arena_add_partial_symbol_stacks(
854
853
} else {
855
854
PartialSymbolStack :: from_variable ( variables[ i] . try_into ( ) . unwrap ( ) )
856
855
} ;
857
- for j in 0 ..length {
856
+ for j in ( 0 ..length) . rev ( ) {
858
857
let symbol = symbols_slice[ j] . into ( ) ;
859
- stack. push_back ( partials, symbol) ;
858
+ stack. push_front ( partials, symbol) ;
860
859
}
861
- // We pushed the edges onto the list in reverse order. Requesting a forwards iterator
862
- // before we return ensures that it will also be available in forwards order.
863
- let _ = stack. iter ( partials) ;
860
+ // We ensure that the list will also be available in reverse order.
861
+ stack. ensure_both_directions ( partials) ;
864
862
out[ i] = stack. into ( ) ;
865
863
unsafe { symbols = symbols. add ( length) } ;
866
864
}
@@ -880,7 +878,6 @@ pub struct sg_partial_scope_stack {
880
878
/// The handle of the first element in the partial scope stack, or SG_LIST_EMPTY_HANDLE if the
881
879
/// list is empty, or 0 if the list is null.
882
880
pub cells : sg_partial_scope_stack_cell_handle ,
883
- pub direction : sg_deque_direction ,
884
881
pub length : u32 ,
885
882
/// The scope stack variable representing the unknown content of a partial scope stack, or 0 if
886
883
/// the variable is missing. (If so, this partial scope stack can only match a scope stack
@@ -964,13 +961,12 @@ pub extern "C" fn sg_partial_path_arena_add_partial_scope_stacks(
964
961
} else {
965
962
PartialScopeStack :: from_variable ( variables[ i] . try_into ( ) . unwrap ( ) )
966
963
} ;
967
- for j in 0 ..length {
964
+ for j in ( 0 ..length) . rev ( ) {
968
965
let node = scopes_slice[ j] . into ( ) ;
969
- stack. push_back ( partials, node) ;
966
+ stack. push_front ( partials, node) ;
970
967
}
971
- // We pushed the edges onto the list in reverse order. Requesting a forwards iterator
972
- // before we return ensures that it will also be available in forwards order.
973
- let _ = stack. iter_scopes ( partials) ;
968
+ // We ensure that the list will also be available in reverse order.
969
+ stack. ensure_both_directions ( partials) ;
974
970
out[ i] = stack. into ( ) ;
975
971
unsafe { scopes = scopes. add ( length) } ;
976
972
}
@@ -1077,9 +1073,8 @@ pub extern "C" fn sg_partial_path_arena_add_partial_path_edge_lists(
1077
1073
let edge: PartialPathEdge = edges_slice[ j] . into ( ) ;
1078
1074
list. push_back ( partials, edge) ;
1079
1075
}
1080
- // We pushed the edges onto the list in reverse order. Requesting a forwards iterator
1081
- // before we return ensures that it will also be available in forwards order.
1082
- let _ = list. iter ( partials) ;
1076
+ // We ensure that the list will also be available in reverse order.
1077
+ list. ensure_both_directions ( partials) ;
1083
1078
out[ i] = list. into ( ) ;
1084
1079
unsafe { edges = edges. add ( length) } ;
1085
1080
}
@@ -1182,7 +1177,7 @@ pub extern "C" fn sg_partial_path_arena_find_partial_paths_in_file(
1182
1177
graph,
1183
1178
file,
1184
1179
& AtomicUsizeCancellationFlag ( cancellation_flag) ,
1185
- |_graph, partials, mut path| {
1180
+ |_graph, partials, path| {
1186
1181
path. ensure_both_directions ( partials) ;
1187
1182
partial_path_list. partial_paths . push ( path) ;
1188
1183
} ,
0 commit comments