mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-03 03:42:17 +00:00
simplify StrLiteral::Line
to StrLiteral::PlainLine
when possible
This commit is contained in:
parent
a14a110293
commit
b0be698354
1 changed files with 6 additions and 0 deletions
|
@ -624,6 +624,12 @@ impl<'a> Normalize<'a> for StrLiteral<'a> {
|
||||||
new_segments.push(StrSegment::Plaintext(last_text.into_bump_str()));
|
new_segments.push(StrSegment::Plaintext(last_text.into_bump_str()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if new_segments.len() == 1 {
|
||||||
|
if let StrSegment::Plaintext(t) = new_segments[0] {
|
||||||
|
return StrLiteral::PlainLine(t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
StrLiteral::Line(new_segments.into_bump_slice())
|
StrLiteral::Line(new_segments.into_bump_slice())
|
||||||
}
|
}
|
||||||
StrLiteral::Block(t) => {
|
StrLiteral::Block(t) => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue