Skip to content

Commit 63a95e4

Browse files
committed
feat(ast): add AstBulder::move_property_key (#7998)
Add `AstBuilder::move_property_key` method, same as the rest of `move_*` methods.
1 parent d1b7181 commit 63a95e4

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

crates/oxc_ast/src/ast_builder_impl.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,12 @@ impl<'a> AstBuilder<'a> {
134134
mem::replace(target, dummy.into())
135135
}
136136

137+
/// Moves the property key out by replacing it with a [`PropertyKey::NullLiteral`].
138+
pub fn move_property_key(self, key: &mut PropertyKey<'a>) -> PropertyKey<'a> {
139+
let null_expr = PropertyKey::from(self.expression_null_literal(SPAN));
140+
mem::replace(key, null_expr)
141+
}
142+
137143
/// Move a declaration out by replacing it with an empty [`Declaration::VariableDeclaration`].
138144
#[inline]
139145
pub fn move_declaration(self, decl: &mut Declaration<'a>) -> Declaration<'a> {

0 commit comments

Comments
 (0)