From 777352e2baa1da518cd1c7310b28c0267b785e9d Mon Sep 17 00:00:00 2001 From: overlookmotel Date: Tue, 23 Jan 2024 04:35:41 +0000 Subject: [PATCH] fix(transformer): always create valid identifiers (#2131) I'm not familiar with the transformer, so not 100% sure what this function does. But from the name `create_valid_identifier`, I'm guessing that `-` is a mistake - it's not a valid character to have in identifiers. If I've misunderstood, please feel free to close this. --- crates/oxc_transformer/src/es2015/function_name.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/oxc_transformer/src/es2015/function_name.rs b/crates/oxc_transformer/src/es2015/function_name.rs index 635ef35d1..bf779b200 100644 --- a/crates/oxc_transformer/src/es2015/function_name.rs +++ b/crates/oxc_transformer/src/es2015/function_name.rs @@ -162,7 +162,7 @@ fn create_valid_identifier( // } let id = Atom::from( - atom.chars().map(|c| if is_identifier_part(c) { c } else { '-' }).collect::(), + atom.chars().map(|c| if is_identifier_part(c) { c } else { '_' }).collect::(), ); let id = if id == "" {