fix(es/minifier): Fix unicode handling (#5875)

This commit is contained in:
Donny/강동윤 2022-09-15 23:45:33 +09:00 committed by GitHub
parent 5cf78b0213
commit c3fa96b21b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 2 deletions

View File

@ -200,6 +200,7 @@ impl Pure<'_> {
|| (!c.contains("\\n") && !c.contains("\\r")))
&& !c.contains("\\0")
&& !c.contains("\\x")
&& !c.contains("\\u")
{
let value = c
.replace("\\`", "`")

View File

@ -10029,3 +10029,12 @@ fn issue_5645() {
run_exec_test(src, config, false);
}
#[test]
fn issue_5799() {
let src = r###"
console.log(`\u2014`)
"###;
run_default_exec_test(src);
}

View File

@ -2395,8 +2395,22 @@ impl ExprCtx {
});
}
Expr::TaggedTpl { .. } => unimplemented!("add_effects for tagged template literal"),
Expr::Tpl { .. } => unimplemented!("add_effects for template literal"),
Expr::TaggedTpl(TaggedTpl {
tag,
tpl: Tpl { exprs, .. },
..
}) => {
self.extract_side_effects_to(to, *tag);
exprs
.into_iter()
.for_each(|e| self.extract_side_effects_to(to, *e));
}
Expr::Tpl(Tpl { exprs, .. }) => {
exprs
.into_iter()
.for_each(|e| self.extract_side_effects_to(to, *e));
}
Expr::Class(ClassExpr { .. }) => unimplemented!("add_effects for class expression"),
Expr::JSXMember(..)