Skip to content

Commit fef8350

Browse files
GearsDatapackslpil
authored andcommitted
Tweak comment wording
1 parent a17dcc1 commit fef8350

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

compiler-core/src/exhaustiveness.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2871,8 +2871,10 @@ impl CaseToCompile {
28712871

28722872
fn 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(
29082910
fn 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
)

compiler-core/src/strings.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,7 @@ pub fn length_utf16(string: &str) -> usize {
161161
length
162162
}
163163

164-
/// Gets the number of UTF-32 codepoints in a string (also known as the number of
165-
/// characters).
164+
/// Gets the number of UTF-32 codepoints in a string
166165
pub fn length_utf32(string: &str) -> usize {
167166
string.chars().count()
168167
}

0 commit comments

Comments
 (0)