ensure numbers without a raw are allocated during codegen (#1950)

This was incorrectly using raw for dynamically generated numbers like in
the minifier (
6e0bd52af1/crates/oxc_minifier/src/compressor/fold.rs (L280)
).

This ensures they are dynamically generated during codegen.

This does not investigate why `just example minifier` does not take the
`if MINIFY` branch.

---------

Co-authored-by: Boshen <boshenc@gmail.com>
This commit is contained in:
Bradley Farias 2024-01-08 21:13:25 -06:00 committed by GitHub
parent bce9060095
commit ff9cf292dc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -947,7 +947,7 @@ fn need_space_before_dot<const MINIFY: bool>(bytes: &[u8], p: &mut Codegen<{ MIN
impl<'a, const MINIFY: bool> Gen<MINIFY> for NumberLiteral<'a> {
#[allow(clippy::cast_sign_loss, clippy::cast_possible_truncation)]
fn gen(&self, p: &mut Codegen<{ MINIFY }>, _ctx: Context) {
if MINIFY {
if MINIFY || self.raw.is_empty() {
p.print_space_before_identifier();
let abs_value = self.value.abs();