mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 04:08:41 +00:00
feat(ast): add AstBulder::move_property_key (#7998)
Add `AstBuilder::move_property_key` method, same as the rest of `move_*` methods.
This commit is contained in:
parent
d1b7181452
commit
63a95e4aa2
1 changed files with 6 additions and 0 deletions
|
|
@ -134,6 +134,12 @@ impl<'a> AstBuilder<'a> {
|
|||
mem::replace(target, dummy.into())
|
||||
}
|
||||
|
||||
/// Moves the property key out by replacing it with a [`PropertyKey::NullLiteral`].
|
||||
pub fn move_property_key(self, key: &mut PropertyKey<'a>) -> PropertyKey<'a> {
|
||||
let null_expr = PropertyKey::from(self.expression_null_literal(SPAN));
|
||||
mem::replace(key, null_expr)
|
||||
}
|
||||
|
||||
/// Move a declaration out by replacing it with an empty [`Declaration::VariableDeclaration`].
|
||||
#[inline]
|
||||
pub fn move_declaration(self, decl: &mut Declaration<'a>) -> Declaration<'a> {
|
||||
|
|
|
|||
Loading…
Reference in a new issue