mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 12:19:15 +00:00
fix(transformer): wrap_in_arrow_function_iife take span of input Expression (#8547)
#8530 introduced a small change. Previously the IIFE had the span of the original expression which is being wrapped, but after that PR it got a dummy `SPAN`. Fix that.
This commit is contained in:
parent
5206c6ae06
commit
b552f5cfd3
1 changed files with 3 additions and 2 deletions
|
|
@ -1,6 +1,6 @@
|
|||
use oxc_ast::{ast::*, NONE};
|
||||
use oxc_semantic::ScopeFlags;
|
||||
use oxc_span::SPAN;
|
||||
use oxc_span::{GetSpan, SPAN};
|
||||
use oxc_traverse::TraverseCtx;
|
||||
|
||||
/// `object` -> `object.call`.
|
||||
|
|
@ -48,6 +48,7 @@ pub(crate) fn wrap_expression_in_arrow_function_iife<'a>(
|
|||
let scope_id =
|
||||
ctx.insert_scope_below_expression(&expr, ScopeFlags::Arrow | ScopeFlags::Function);
|
||||
|
||||
let span = expr.span();
|
||||
let kind = FormalParameterKind::ArrowFormalParameters;
|
||||
let params = ctx.ast.formal_parameters(SPAN, kind, ctx.ast.vec(), NONE);
|
||||
let statements = ctx.ast.vec1(ctx.ast.statement_return(SPAN, Some(expr)));
|
||||
|
|
@ -57,7 +58,7 @@ pub(crate) fn wrap_expression_in_arrow_function_iife<'a>(
|
|||
);
|
||||
// IIFE
|
||||
ctx.ast.expression_call(
|
||||
SPAN,
|
||||
span,
|
||||
Expression::ArrowFunctionExpression(arrow),
|
||||
NONE,
|
||||
ctx.ast.vec(),
|
||||
|
|
|
|||
Loading…
Reference in a new issue