feat(es/parser): Implement AsRef<str> for IdentLike (#8133)

This commit is contained in:
David Sherret 2023-10-18 13:22:03 +09:00 committed by GitHub
parent 5bb63aa2a2
commit bffe33a270
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -583,6 +583,15 @@ impl From<&'_ str> for IdentLike {
}
}
impl AsRef<str> for IdentLike {
fn as_ref(&self) -> &str {
match self {
IdentLike::Known(k) => (*k).into(),
IdentLike::Other(s) => s.as_ref(),
}
}
}
impl From<Keyword> for Word {
fn from(kwd: Keyword) -> Self {
Word::Keyword(kwd)