mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
refactor(rust): backport v1.82.0 changes to main branch first (#6690)
This commit is contained in:
parent
ce25c450fc
commit
1a90ec4b85
2 changed files with 35 additions and 38 deletions
|
|
@ -846,8 +846,7 @@ impl<'a> Gen for ExportNamedDeclaration<'a> {
|
||||||
if self.export_kind.is_type() {
|
if self.export_kind.is_type() {
|
||||||
p.print_str("type ");
|
p.print_str("type ");
|
||||||
}
|
}
|
||||||
match &self.declaration {
|
if let Some(decl) = &self.declaration {
|
||||||
Some(decl) => {
|
|
||||||
match decl {
|
match decl {
|
||||||
Declaration::VariableDeclaration(decl) => decl.print(p, ctx),
|
Declaration::VariableDeclaration(decl) => decl.print(p, ctx),
|
||||||
Declaration::FunctionDeclaration(decl) => decl.print(p, ctx),
|
Declaration::FunctionDeclaration(decl) => decl.print(p, ctx),
|
||||||
|
|
@ -869,8 +868,7 @@ impl<'a> Gen for ExportNamedDeclaration<'a> {
|
||||||
p.print_soft_newline();
|
p.print_soft_newline();
|
||||||
p.needs_semicolon = false;
|
p.needs_semicolon = false;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
None => {
|
|
||||||
p.print_ascii_byte(b'{');
|
p.print_ascii_byte(b'{');
|
||||||
if !self.specifiers.is_empty() {
|
if !self.specifiers.is_empty() {
|
||||||
p.print_soft_space();
|
p.print_soft_space();
|
||||||
|
|
@ -887,7 +885,6 @@ impl<'a> Gen for ExportNamedDeclaration<'a> {
|
||||||
p.print_semicolon_after_statement();
|
p.print_semicolon_after_statement();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Gen for TSExportAssignment<'a> {
|
impl<'a> Gen for TSExportAssignment<'a> {
|
||||||
|
|
|
||||||
|
|
@ -300,7 +300,7 @@ impl<'a, 'b> PeepholeFoldConstants {
|
||||||
| (ValueType::Boolean, ValueType::Boolean) => {
|
| (ValueType::Boolean, ValueType::Boolean) => {
|
||||||
let left_number = ctx.get_number_value(left)?;
|
let left_number = ctx.get_number_value(left)?;
|
||||||
let right_number = ctx.get_number_value(right)?;
|
let right_number = ctx.get_number_value(right)?;
|
||||||
let Ok(value) = TryInto::<f64>::try_into(left_number + right_number) else { return None };
|
let value = left_number + right_number;
|
||||||
// Float if value has a fractional part, otherwise Decimal
|
// Float if value has a fractional part, otherwise Decimal
|
||||||
let number_base = if is_exact_int64(value) { NumberBase::Decimal } else { NumberBase::Float };
|
let number_base = if is_exact_int64(value) { NumberBase::Decimal } else { NumberBase::Float };
|
||||||
// todo: add raw &str
|
// todo: add raw &str
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue