Skip to content

Commit bffe33a

Browse files
authored
feat(es/parser): Implement AsRef<str> for IdentLike (#8133)
1 parent 5bb63aa commit bffe33a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

crates/swc_ecma_parser/src/token.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,15 @@ impl From<&'_ str> for IdentLike {
583583
}
584584
}
585585

586+
impl AsRef<str> for IdentLike {
587+
fn as_ref(&self) -> &str {
588+
match self {
589+
IdentLike::Known(k) => (*k).into(),
590+
IdentLike::Other(s) => s.as_ref(),
591+
}
592+
}
593+
}
594+
586595
impl From<Keyword> for Word {
587596
fn from(kwd: Keyword) -> Self {
588597
Word::Keyword(kwd)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy