Skip to content

Commit

Permalink
rename String::TripleQuoted to String::Verbatim
Browse files Browse the repository at this point in the history
Summary: This reflects its more general usage in sigil strings too

Reviewed By: robertoaloi

Differential Revision: D58672066

fbshipit-source-id: 434be714c48c6c85b0e6957bde84d545d27b6999
  • Loading branch information
alanz authored and facebook-github-bot committed Jun 27, 2024
1 parent 6392db3 commit ba6e272
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions crates/hir/src/body/lower.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2484,7 +2484,7 @@ impl<'a> Ctx<'a> {
let contents: String = str.clone().into();
if let Some(_rest) = s.strip_prefix("\"\"\"") {
// Triple Quoted String. Verbatim String
Some(literal(Literal::String(StringVariant::TripleQuoted(
Some(literal(Literal::String(StringVariant::Verbatim(
str.text().to_string(),
))))
} else if let Some(_rest) = s.strip_prefix("~\"\"\"") {
Expand Down Expand Up @@ -2608,7 +2608,7 @@ impl<'a> Ctx<'a> {
if let Literal::String(str) = string {
let segs = match str {
StringVariant::Normal(s) => s.into(),
StringVariant::TripleQuoted(s) => s.into(),
StringVariant::Verbatim(s) => s.into(),
};
Some(Term::Binary(segs))
} else {
Expand Down
2 changes: 1 addition & 1 deletion crates/hir/src/body/pretty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,7 @@ impl<'a> Printer<'a> {
fn print_literal(&mut self, lit: &Literal) -> fmt::Result {
match lit {
Literal::String(StringVariant::Normal(string)) => write!(self, "{:?}", string),
Literal::String(StringVariant::TripleQuoted(string)) => {
Literal::String(StringVariant::Verbatim(string)) => {
write!(self, "{}", string)
}
Literal::Char(char) => write!(self, "${}", char),
Expand Down
4 changes: 2 additions & 2 deletions crates/hir/src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,14 @@ pub enum Literal {
#[derive(Debug, Clone, Eq, PartialEq, Hash)]
pub enum StringVariant {
Normal(String),
TripleQuoted(String),
Verbatim(String),
}

impl StringVariant {
pub fn chars(&self) -> Chars<'_> {
match self {
StringVariant::Normal(s) => s.chars(),
StringVariant::TripleQuoted(s) => s.chars(),
StringVariant::Verbatim(s) => s.chars(),
}
}
}
Expand Down

0 comments on commit ba6e272

Please sign in to comment.