Skip to content

Commit 5206c6a

Browse files
committed
refactor(transformer): rename wrap_in_arrow_function_iife (#8546)
Pure refactor. Rename this function to be more descriptive.
1 parent 61077ca commit 5206c6a

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

crates/oxc_transformer/src/common/arrow_function_converter.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ use oxc_syntax::{
102102
};
103103
use oxc_traverse::{Ancestor, BoundIdentifier, Traverse, TraverseCtx};
104104

105-
use crate::{utils::ast_builder::wrap_arrow_function_iife, EnvOptions};
105+
use crate::{utils::ast_builder::wrap_expression_in_arrow_function_iife, EnvOptions};
106106

107107
type FxIndexMap<K, V> = IndexMap<K, V, FxBuildHasher>;
108108

@@ -419,7 +419,7 @@ impl<'a> Traverse<'a> for ArrowFunctionConverter<'a> {
419419
// prop = (() => { return async () => {} })();
420420
// }
421421
// ```
422-
Some(wrap_arrow_function_iife(ctx.ast.move_expression(expr), ctx))
422+
Some(wrap_expression_in_arrow_function_iife(ctx.ast.move_expression(expr), ctx))
423423
} else {
424424
return;
425425
}

crates/oxc_transformer/src/es2020/optional_chaining.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ use oxc_ast::{ast::*, NONE};
5454
use oxc_span::SPAN;
5555
use oxc_traverse::{Ancestor, BoundIdentifier, MaybeBoundIdentifier, Traverse, TraverseCtx};
5656

57-
use crate::{utils::ast_builder::wrap_arrow_function_iife, TransformCtx};
57+
use crate::{utils::ast_builder::wrap_expression_in_arrow_function_iife, TransformCtx};
5858

5959
#[derive(Debug)]
6060
enum CallContext<'a> {
@@ -283,7 +283,7 @@ impl<'a> OptionalChaining<'a, '_> {
283283
// To insert the temp binding in the correct scope, we wrap the expression with
284284
// an arrow function. During the chain expression transformation, the temp binding
285285
// will be inserted into the arrow function's body.
286-
wrap_arrow_function_iife(ctx.ast.move_expression(expr), ctx)
286+
wrap_expression_in_arrow_function_iife(ctx.ast.move_expression(expr), ctx)
287287
} else {
288288
self.transform_chain_expression_impl(false, expr, ctx)
289289
}
@@ -297,7 +297,7 @@ impl<'a> OptionalChaining<'a, '_> {
297297
) {
298298
*expr = if self.is_inside_function_parameter {
299299
// Same as the above `transform_chain_expression` explanation
300-
wrap_arrow_function_iife(ctx.ast.move_expression(expr), ctx)
300+
wrap_expression_in_arrow_function_iife(ctx.ast.move_expression(expr), ctx)
301301
} else {
302302
// Unfortunately no way to get compiler to see that this branch is provably unreachable.
303303
// We don't want to inline this function, to keep `enter_expression` as small as possible.

crates/oxc_transformer/src/utils/ast_builder.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ pub(crate) fn create_call_call<'a>(
4141
/// with a body block.
4242
///
4343
/// `expr` -> `(() => { return expr; })()`
44-
pub(crate) fn wrap_arrow_function_iife<'a>(
44+
pub(crate) fn wrap_expression_in_arrow_function_iife<'a>(
4545
expr: Expression<'a>,
4646
ctx: &mut TraverseCtx<'a>,
4747
) -> Expression<'a> {

0 commit comments

Comments
 (0)