mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 12:19:15 +00:00
fix(minifier): Unknown.fromCharCode should not be treated as String.fromCharCode (#8709)
This commit is contained in:
parent
bf895eb90d
commit
d982cdba85
1 changed files with 3 additions and 1 deletions
|
|
@ -245,7 +245,7 @@ impl<'a> PeepholeOptimizations {
|
|||
) -> Option<Expression<'a>> {
|
||||
let Expression::Identifier(ident) = object else { return None };
|
||||
let ctx = Ctx(ctx);
|
||||
if !ctx.is_global_reference(ident) {
|
||||
if ident.name != "String" || !ctx.is_global_reference(ident) {
|
||||
return None;
|
||||
}
|
||||
let args = &ce.arguments;
|
||||
|
|
@ -1422,6 +1422,8 @@ mod test {
|
|||
test_same("String.fromCharCode(x)");
|
||||
test("x = String.fromCharCode('x')", "x = '\\0'");
|
||||
test("x = String.fromCharCode('0.5')", "x = '\\0'");
|
||||
|
||||
test_same("x = Unknown.fromCharCode('0.5')");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
Loading…
Reference in a new issue