mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
refactor(transformer/react-jsx): use extend instead of for-in with push (#1236)
This commit is contained in:
parent
47ba874f4f
commit
d62631e239
1 changed files with 2 additions and 4 deletions
|
|
@ -335,7 +335,7 @@ impl<'a> ReactJsx<'a> {
|
|||
}
|
||||
|
||||
// The object properties for the second argument of `React.createElement`
|
||||
let mut properties = self.ast.new_vec_with_capacity(0);
|
||||
let mut properties = self.ast.new_vec();
|
||||
|
||||
if let Some(attributes) = attributes {
|
||||
// TODO: compute the correct capacity for both runtimes
|
||||
|
|
@ -585,9 +585,7 @@ impl<'a> ReactJsx<'a> {
|
|||
}
|
||||
JSXAttributeItem::SpreadAttribute(attr) => match &attr.argument {
|
||||
Expression::ObjectExpression(expr) if !expr.has_proto() => {
|
||||
for object_property in &expr.properties {
|
||||
properties.push(self.ast.copy(object_property));
|
||||
}
|
||||
properties.extend(self.ast.copy(&expr.properties));
|
||||
}
|
||||
expr => {
|
||||
let argument = self.ast.copy(expr);
|
||||
|
|
|
|||
Loading…
Reference in a new issue