From 51eb770e3643ba1e2eb741e78c21c33f11129474 Mon Sep 17 00:00:00 2001 From: overlookmotel Date: Wed, 8 Jan 2025 19:39:16 +0000 Subject: [PATCH] Shorten code --- .../src/common/arrow_function_converter.rs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/crates/oxc_transformer/src/common/arrow_function_converter.rs b/crates/oxc_transformer/src/common/arrow_function_converter.rs index 92083584fbd498..6903eceb22e991 100644 --- a/crates/oxc_transformer/src/common/arrow_function_converter.rs +++ b/crates/oxc_transformer/src/common/arrow_function_converter.rs @@ -1009,19 +1009,14 @@ impl<'a> ArrowFunctionConverter<'a> { Self::adjust_binding_scope(target_scope_id, &arguments_var, ctx); - let ident = - ctx.create_unbound_ident_reference(SPAN, Atom::from("arguments"), ReferenceFlags::Read); - let mut init = Expression::Identifier(ctx.ast.alloc(ident)); + let mut init = + ctx.create_unbound_ident_expr(SPAN, Atom::from("arguments"), ReferenceFlags::Read); // Top level may not have `arguments`, so we need to check it. // `typeof arguments === "undefined" ? void 0 : arguments;` if ctx.scopes().root_scope_id() == target_scope_id { - let ident = ctx.create_unbound_ident_reference( - SPAN, - Atom::from("arguments"), - ReferenceFlags::Read, - ); - let argument = Expression::Identifier(ctx.ast.alloc(ident)); + let argument = + ctx.create_unbound_ident_expr(SPAN, Atom::from("arguments"), ReferenceFlags::Read); let typeof_arguments = ctx.ast.expression_unary(SPAN, UnaryOperator::Typeof, argument); let undefined_literal = ctx.ast.expression_string_literal(SPAN, "undefined", None); let test = ctx.ast.expression_binary(