fix(codegen): print raw if value is number is Infinity (#4676)

This commit is contained in:
Boshen 2024-08-06 03:24:40 +00:00
parent 3987665490
commit 4a5695416d
3 changed files with 3 additions and 5 deletions

View file

@ -50,8 +50,7 @@ fn main() -> std::io::Result<()> {
let ret = Parser::new(&allocator, &printed, source_type).parse();
if !ret.errors.is_empty() {
for error in ret.errors {
let error = error.with_source_code(source_text.to_string());
println!("{error:?}");
println!("{:?}", error.with_source_code(printed.to_string()));
}
return Ok(());
}

View file

@ -1192,7 +1192,7 @@ impl<'a, const MINIFY: bool> Gen<MINIFY> for NumericLiteral<'a> {
let bytes = result.as_str();
p.print_str(bytes);
need_space_before_dot(bytes, p);
} else if self.value == f64::INFINITY {
} else if self.value == f64::INFINITY && self.raw.is_empty() {
p.print_str("Infinity");
need_space_before_dot("Infinity", p);
} else {

View file

@ -2,5 +2,4 @@ commit: d8086f14
codegen_typescript Summary:
AST Parsed : 6456/6456 (100.00%)
Positive Passed: 6455/6456 (99.98%)
Normal failed: "compiler/deferredConditionalTypes2.ts"
Positive Passed: 6456/6456 (100.00%)