From d0a2649ef606d1093aecd078d31412a5e71b1b51 Mon Sep 17 00:00:00 2001 From: overlookmotel Date: Wed, 18 Dec 2024 15:02:01 +0000 Subject: [PATCH] perf(ast): `move_expression` and `move_statement` produce dummy with no span --- crates/oxc_ast/src/ast_builder_impl.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/oxc_ast/src/ast_builder_impl.rs b/crates/oxc_ast/src/ast_builder_impl.rs index 7ea077656e4ca9..3b29825da9bbda 100644 --- a/crates/oxc_ast/src/ast_builder_impl.rs +++ b/crates/oxc_ast/src/ast_builder_impl.rs @@ -9,7 +9,7 @@ use std::{borrow::Cow, mem}; use oxc_allocator::{Allocator, Box, FromIn, String, Vec}; -use oxc_span::{Atom, GetSpan, Span, SPAN}; +use oxc_span::{Atom, Span, SPAN}; use oxc_syntax::{number::NumberBase, operator::UnaryOperator, scope::ScopeId}; use crate::{ast::*, AstBuilder}; @@ -115,14 +115,14 @@ impl<'a> AstBuilder<'a> { /// Moves the expression out by replacing it with an [`Expression::NullLiteral`]. #[inline] pub fn move_expression(self, expr: &mut Expression<'a>) -> Expression<'a> { - let null_expr = self.expression_null_literal(expr.span()); + let null_expr = self.expression_null_literal(SPAN); mem::replace(expr, null_expr) } /// Moves the statement out by replacing it with a [`Statement::EmptyStatement`]. #[inline] pub fn move_statement(self, stmt: &mut Statement<'a>) -> Statement<'a> { - let empty_stmt = self.empty_statement(stmt.span()); + let empty_stmt = self.empty_statement(SPAN); mem::replace(stmt, Statement::EmptyStatement(self.alloc(empty_stmt))) }