mirror of
https://github.com/oxc-project/oxc.git
synced 2026-11-04 10:29:58 +00:00
perf(parser): reuse shorthand assignment target identifiers (#28504)
Reuse the parsed shorthand identifier when building assignment targets, avoiding duplicate node construction. AI-assisted implementation.
This commit is contained in:
1 parent
444f24ad82
commit
babf44cc96
1 file changed
+2
-5
@@ -228,11 +228,8 @@ impl<'a, C: Config> CoverGrammar<'a, ObjectExpression<'a>, C> for ObjectAssignme
|
||||
impl<'a, C: Config> CoverGrammar<'a, ObjectProperty<'a>, C> for AssignmentTargetProperty<'a> {
|
||||
fn cover(property: ObjectProperty<'a>, p: &mut ParserImpl<'a, C>) -> Self {
|
||||
if property.shorthand {
|
||||
let binding = match property.key {
|
||||
PropertyKey::StaticIdentifier(ident) => {
|
||||
let ident = ident.unbox();
|
||||
IdentifierReference::new(ident.span, ident.name, p)
|
||||
}
|
||||
let binding = match property.value {
|
||||
Expression::Identifier(ident) => ident.unbox(),
|
||||
_ => return p.unexpected(),
|
||||
};
|
||||
// convert `CoverInitializedName`
|
||||
|
||||
Reference in new issue
Block a user