From 9e6df37b54bdcde025b4fcd419cb585590f7d41f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EB=8F=99=EC=9C=A4=20=28Donny=29?= Date: Mon, 16 Oct 2023 19:14:08 +0900 Subject: [PATCH] fix test --- crates/swc_ecma_parser/src/token.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/crates/swc_ecma_parser/src/token.rs b/crates/swc_ecma_parser/src/token.rs index 8323e42b5f08..673d3796dc0e 100644 --- a/crates/swc_ecma_parser/src/token.rs +++ b/crates/swc_ecma_parser/src/token.rs @@ -500,6 +500,14 @@ pub enum IdentLike { Other(JsWord), } +impl From<&'_ str> for IdentLike { + fn from(s: &str) -> Self { + s.parse::() + .map(Self::Known) + .unwrap_or_else(|_| Self::Other(s.into())) + } +} + impl IdentLike { pub(crate) fn from_str(atoms: &mut AtomStore, s: &str) -> IdentLike { s.parse::()