diff --git a/crates/oxc_codegen/Cargo.toml b/crates/oxc_codegen/Cargo.toml index 44d88d92c477a..3a9f3934d43d7 100644 --- a/crates/oxc_codegen/Cargo.toml +++ b/crates/oxc_codegen/Cargo.toml @@ -23,7 +23,7 @@ doctest = false oxc_ast = { workspace = true } oxc_span = { workspace = true } oxc_allocator = { workspace = true } -oxc_syntax = { workspace = true } +oxc_syntax = { workspace = true, features = ["to_js_string"] } oxc_sourcemap = { workspace = true } oxc_mangler = { workspace = true } diff --git a/crates/oxc_codegen/src/gen.rs b/crates/oxc_codegen/src/gen.rs index d6605ed117b5e..0093e69e48ea2 100644 --- a/crates/oxc_codegen/src/gen.rs +++ b/crates/oxc_codegen/src/gen.rs @@ -1184,8 +1184,10 @@ impl<'a, const MINIFY: bool> Gen for NumericLiteral<'a> { } // TODO: refactor this with less allocations +// fn print_non_negative_float(value: f64, _p: &Codegen<{ MINIFY }>) -> String { - let mut result = value.to_string(); + use oxc_syntax::number::ToJsString; + let mut result = value.to_js_string(); let chars = result.as_bytes(); let len = chars.len(); let dot = chars.iter().position(|&c| c == b'.');