@@ -493,7 +493,7 @@ impl DisplayWithPartialPaths for PartialScopedSymbol {
493
493
/// A pattern that might match against a symbol stack. Consists of a (possibly empty) list of
494
494
/// partial scoped symbols, along with an optional symbol stack variable.
495
495
#[ repr( C ) ]
496
- #[ derive( Clone , Copy ) ]
496
+ #[ derive( Clone , Copy , Eq , Hash , PartialEq ) ]
497
497
pub struct PartialSymbolStack {
498
498
symbols : ReversibleList < PartialScopedSymbol > ,
499
499
length : u32 ,
@@ -793,24 +793,13 @@ impl PartialSymbolStack {
793
793
unreachable ! ( ) ;
794
794
}
795
795
796
- pub fn equals ( mut self , partials : & mut PartialPaths , mut other : PartialSymbolStack ) -> bool {
797
- while let Some ( self_symbol) = self . pop_front ( partials) {
798
- if let Some ( other_symbol) = other. pop_front ( partials) {
799
- if !self_symbol. equals ( partials, & other_symbol) {
800
- return false ;
801
- }
802
- } else {
803
- return false ;
804
- }
805
- }
806
- if !other. symbols . is_empty ( ) {
807
- return false ;
808
- }
809
- equals_option (
810
- self . variable . into_option ( ) ,
811
- other. variable . into_option ( ) ,
812
- |a, b| a == b,
813
- )
796
+ pub fn equals ( self , _partials : & mut PartialPaths , other : PartialSymbolStack ) -> bool {
797
+ self . symbols == other. symbols
798
+ && equals_option (
799
+ self . variable . into_option ( ) ,
800
+ other. variable . into_option ( ) ,
801
+ |a, b| a == b,
802
+ )
814
803
}
815
804
816
805
pub fn cmp (
@@ -1206,11 +1195,8 @@ impl PartialScopeStack {
1206
1195
self . variable . into_option ( )
1207
1196
}
1208
1197
1209
- pub fn equals ( self , partials : & mut PartialPaths , other : PartialScopeStack ) -> bool {
1210
- self . scopes
1211
- . equals_with ( & mut partials. partial_scope_stacks , other. scopes , |a, b| {
1212
- * a == * b
1213
- } )
1198
+ pub fn equals ( self , _partials : & mut PartialPaths , other : PartialScopeStack ) -> bool {
1199
+ self . scopes == other. scopes
1214
1200
&& equals_option (
1215
1201
self . variable . into_option ( ) ,
1216
1202
other. variable . into_option ( ) ,
@@ -1819,21 +1805,13 @@ impl PartialPath {
1819
1805
self . edges . shadows ( partials, other. edges )
1820
1806
}
1821
1807
1822
- pub fn equals ( & self , partials : & mut PartialPaths , other : & PartialPath ) -> bool {
1808
+ pub fn equals ( & self , _partials : & mut PartialPaths , other : & PartialPath ) -> bool {
1823
1809
self . start_node == other. start_node
1824
1810
&& self . end_node == other. end_node
1825
- && self
1826
- . symbol_stack_precondition
1827
- . equals ( partials, other. symbol_stack_precondition )
1828
- && self
1829
- . symbol_stack_postcondition
1830
- . equals ( partials, other. symbol_stack_postcondition )
1831
- && self
1832
- . scope_stack_precondition
1833
- . equals ( partials, other. scope_stack_precondition )
1834
- && self
1835
- . scope_stack_postcondition
1836
- . equals ( partials, other. scope_stack_postcondition )
1811
+ && self . symbol_stack_precondition == other. symbol_stack_precondition
1812
+ && self . symbol_stack_postcondition == other. symbol_stack_postcondition
1813
+ && self . scope_stack_precondition == other. scope_stack_precondition
1814
+ && self . scope_stack_postcondition == other. scope_stack_postcondition
1837
1815
}
1838
1816
1839
1817
pub fn cmp (
0 commit comments