mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 12:19:15 +00:00
fix(codegen): use ryu-js for f64 to string
This commit is contained in:
parent
06197b8be4
commit
084ab7602d
2 changed files with 4 additions and 2 deletions
|
|
@ -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 }
|
||||
|
||||
|
|
|
|||
|
|
@ -1184,8 +1184,10 @@ impl<'a, const MINIFY: bool> Gen<MINIFY> for NumericLiteral<'a> {
|
|||
}
|
||||
|
||||
// TODO: refactor this with less allocations
|
||||
// <https://github.com/evanw/esbuild/blob/360d47230813e67d0312ad754cad2b6ee09b151b/internal/js_printer/js_printer.go#L3472>
|
||||
fn print_non_negative_float<const MINIFY: bool>(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'.');
|
||||
|
|
|
|||
Loading…
Reference in a new issue