From 010f659c875f69b7bdb9babf3473139a65794e80 Mon Sep 17 00:00:00 2001 From: underfin <2218301630@qq.com> Date: Wed, 24 Jan 2024 17:20:23 +0800 Subject: [PATCH] fix: test --- crates/oxc_codegen/src/gen.rs | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/crates/oxc_codegen/src/gen.rs b/crates/oxc_codegen/src/gen.rs index 9a2febf2dc967..8895f613bb2a5 100644 --- a/crates/oxc_codegen/src/gen.rs +++ b/crates/oxc_codegen/src/gen.rs @@ -95,7 +95,7 @@ impl Gen for Directive { // A Use Strict Directive may not contain an EscapeSequence or LineContinuation. // So here should print original `directive` value, the `expression` value is escaped str. // See https://github.com/babel/babel/blob/main/packages/babel-generator/src/generators/base.ts#L64 - print_origin_str(self.directive.as_str(), p); + p.print_str(self.directive.as_str().to_string().as_bytes()); p.print_semicolon(); } } @@ -1164,24 +1164,6 @@ fn print_str(s: &str, p: &mut Codegen<{ MINIFY }>) { p.print(quote as u8); } -fn print_origin_str(s: &str, p: &mut Codegen<{ MINIFY }>) { - p.print(b'\''); - for c in s.chars() { - match c { - // Allow `U+2028` and `U+2029` in string literals - // - // - LS => p.print_str(b"\\u2028"), - PS => p.print_str(b"\\u2029"), - '\u{a0}' => { - p.print_str(b"\\xA0"); - } - _ => p.print_str(c.to_string().as_bytes()), - } - } - p.print(b'\''); -} - impl Gen for StringLiteral { fn gen(&self, p: &mut Codegen<{ MINIFY }>, _ctx: Context) { print_str(self.value.as_str(), p);