mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 04:08:41 +00:00
refactor(ast): replace AstBuilder::move_statement_vec with move_vec (#4988)
Replace `AstBuilder::move_statement_vec` with a general `move_vec` method which handles any kind of `Vec`.
This commit is contained in:
parent
6ffbd78947
commit
cca7440d4b
2 changed files with 6 additions and 6 deletions
|
|
@ -82,11 +82,6 @@ impl<'a> AstBuilder<'a> {
|
|||
mem::replace(stmt, Statement::EmptyStatement(self.alloc(empty_stmt)))
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn move_statement_vec(self, stmts: &mut Vec<'a, Statement<'a>>) -> Vec<'a, Statement<'a>> {
|
||||
mem::replace(stmts, self.vec())
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn move_assignment_target(self, target: &mut AssignmentTarget<'a>) -> AssignmentTarget<'a> {
|
||||
let dummy = self.simple_assignment_target_identifier_reference(Span::default(), "");
|
||||
|
|
@ -105,6 +100,11 @@ impl<'a> AstBuilder<'a> {
|
|||
mem::replace(decl, empty_decl)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn move_vec<T>(self, vec: &mut Vec<'a, T>) -> Vec<'a, T> {
|
||||
mem::replace(vec, self.vec())
|
||||
}
|
||||
|
||||
/* ---------- Constructors ---------- */
|
||||
|
||||
/// `void 0`
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ impl<'a> TypeScript<'a> {
|
|||
// every time a namespace declaration is encountered.
|
||||
let mut new_stmts = self.ctx.ast.vec();
|
||||
|
||||
for stmt in self.ctx.ast.move_statement_vec(&mut program.body) {
|
||||
for stmt in self.ctx.ast.move_vec(&mut program.body) {
|
||||
match stmt {
|
||||
Statement::TSModuleDeclaration(decl) => {
|
||||
if !decl.declare {
|
||||
|
|
|
|||
Loading…
Reference in a new issue