@@ -46,6 +46,15 @@ impl MatchStrictness {
4646 M :: Signature => false ,
4747 }
4848 }
49+
50+ fn should_skip_comment ( & self ) -> bool {
51+ use MatchStrictness as M ;
52+ match self {
53+ M :: Cst | M :: Smart | M :: Ast => false ,
54+ M :: Relaxed | M :: Signature | M :: Template => true ,
55+ }
56+ }
57+
4958 pub ( crate ) fn match_terminal (
5059 & self ,
5160 is_named : bool ,
@@ -62,16 +71,19 @@ impl MatchStrictness {
6271 if is_kind_matched && ( !is_named || text == candidate. text ( ) ) {
6372 return MatchOneNode :: MatchedBoth ;
6473 }
74+ if self . should_skip_comment ( ) && skip_comment ( candidate) {
75+ return MatchOneNode :: SkipCandidate ;
76+ }
6577 let ( skip_goal, skip_candidate) = match self {
6678 M :: Cst => ( false , false ) ,
6779 M :: Smart => ( false , !candidate. is_named ( ) ) ,
6880 M :: Ast => ( !is_named, !candidate. is_named ( ) ) ,
69- M :: Relaxed => ( !is_named, skip_comment_or_unnamed ( candidate) ) ,
81+ M :: Relaxed => ( !is_named, ! candidate. is_named ( ) ) ,
7082 M :: Signature => {
7183 if is_kind_matched {
7284 return MatchOneNode :: MatchedBoth ;
7385 }
74- ( !is_named, skip_comment_or_unnamed ( candidate) )
86+ ( !is_named, ! candidate. is_named ( ) )
7587 }
7688 M :: Template => {
7789 if text == candidate. text ( ) {
0 commit comments