mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
refactor(transformer/arrow-functions): pass ArenaBox as function param (#7169)
Follow-on after stack up to #7148. Small optimization. `ArrowFunctionExpression` is 56 bytes, whereas `ArenaBox<ArrowFunctionExpression>` is 8 bytes. So it's preferable to pass the `ArenaBox<ArrowFunctionExpression>` to `transform_arrow_function_expression` and call `unbox` on it there instead of unboxing *before* passing to the function.
This commit is contained in:
parent
38a6df6f66
commit
c307e1b7e8
1 changed files with 3 additions and 2 deletions
|
|
@ -277,7 +277,7 @@ impl<'a> Traverse<'a> for ArrowFunctionConverter<'a> {
|
||||||
unreachable!()
|
unreachable!()
|
||||||
};
|
};
|
||||||
|
|
||||||
*expr = Self::transform_arrow_function_expression(arrow_function_expr.unbox(), ctx);
|
*expr = Self::transform_arrow_function_expression(arrow_function_expr, ctx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -414,9 +414,10 @@ impl<'a> ArrowFunctionConverter<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn transform_arrow_function_expression(
|
fn transform_arrow_function_expression(
|
||||||
arrow_function_expr: ArrowFunctionExpression<'a>,
|
arrow_function_expr: ArenaBox<'a, ArrowFunctionExpression<'a>>,
|
||||||
ctx: &mut TraverseCtx<'a>,
|
ctx: &mut TraverseCtx<'a>,
|
||||||
) -> Expression<'a> {
|
) -> Expression<'a> {
|
||||||
|
let arrow_function_expr = arrow_function_expr.unbox();
|
||||||
let scope_id = arrow_function_expr.scope_id();
|
let scope_id = arrow_function_expr.scope_id();
|
||||||
let flags = ctx.scopes_mut().get_flags_mut(scope_id);
|
let flags = ctx.scopes_mut().get_flags_mut(scope_id);
|
||||||
*flags &= !ScopeFlags::Arrow;
|
*flags &= !ScopeFlags::Arrow;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue