diff --git a/crates/swc_ecma_parser/src/token.rs b/crates/swc_ecma_parser/src/token.rs index 2cdca050dd06..8e5444d7b809 100644 --- a/crates/swc_ecma_parser/src/token.rs +++ b/crates/swc_ecma_parser/src/token.rs @@ -583,6 +583,15 @@ impl From<&'_ str> for IdentLike { } } +impl AsRef for IdentLike { + fn as_ref(&self) -> &str { + match self { + IdentLike::Known(k) => (*k).into(), + IdentLike::Other(s) => s.as_ref(), + } + } +} + impl From for Word { fn from(kwd: Keyword) -> Self { Word::Keyword(kwd)