@@ -2871,8 +2871,10 @@ impl CaseToCompile {
28712871
28722872fn segment_matched_value (
28732873 segment : & TypedPatternBitArraySegment ,
2874- // Override for the segment pattern, if we need to determine the value of
2875- // an assignment segment.
2874+ // If we are compiling an assignment pattern, we still need access to the
2875+ // `type_` and `options` fields of the `segment`, so we must still pass that
2876+ // in above. However, we need to check the correct sub-pattern of the original
2877+ // pattern, so if they are different we set this argument to `Some`.
28762878 pattern : Option < & TypedPattern > ,
28772879) -> BitArrayMatchedValue {
28782880 let pattern = pattern. unwrap_or ( & segment. value ) ;
@@ -2908,8 +2910,10 @@ fn segment_matched_value(
29082910fn segment_size (
29092911 segment : & TypedPatternBitArraySegment ,
29102912 pattern_variables : & HashMap < EcoString , ReadAction > ,
2911- // Override for the segment pattern, if we need to determine the size of an
2912- // assignment segment.
2913+ // If we are compiling an assignment pattern, we still need access to the
2914+ // `type_` and `options` fields of the `segment`, so we must still pass that
2915+ // in above. However, we need to check the correct sub-pattern of the original
2916+ // pattern, so if they are different we set this argument to `Some`.
29132917 pattern : Option < & TypedPattern > ,
29142918) -> ReadSize {
29152919 let pattern = pattern. unwrap_or ( & segment. value ) ;
@@ -2955,7 +2959,7 @@ fn segment_size(
29552959 )
29562960 }
29572961 ast:: Pattern :: String { value, .. } if segment. has_utf32_option ( ) => {
2958- // Each utf32 codepoint is 32 bits
2962+ // Each utf32 code unit is 32 bits
29592963 ReadSize :: ConstantBits (
29602964 length_utf32 ( & convert_string_escape_chars ( value) ) * BigInt :: from ( 32 ) ,
29612965 )
0 commit comments