Skip to content

Commit

Permalink
fix side effect on target
Browse files Browse the repository at this point in the history
  • Loading branch information
mmews committed Feb 8, 2024
1 parent c5e67c1 commit 7ca06d6
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ private Expression convertJSXAttributes(List<JSXAttribute> attrs, List<JSXChild>
List<PropertyNameValuePair> props = new ArrayList<>();
if (attrs.get(0) instanceof JSXSpreadAttribute) {
// The first attribute is a spread object, the target must be {}.
parameters.add(_ObjLit());
} else {
// Otherwise, the target is of the form {foo: true, bar: "Hi"}
int firstSpreadIndex = (!spreadIndices.isEmpty()) ? spreadIndices.get(0) : attrs.size();
Expand All @@ -273,8 +274,7 @@ private Expression convertJSXAttributes(List<JSXAttribute> attrs, List<JSXChild>
props.add(convertJSXAttribute(propAttr));
}
}
ObjectLiteral target = _ObjLit(props.toArray(new PropertyNameValuePair[0]));
parameters.add(target);
parameters.add(_ObjLit(props.toArray(new PropertyNameValuePair[0])));
}

for (int i = 0; i < spreadIndices.size(); i++) {
Expand Down

0 comments on commit 7ca06d6

Please sign in to comment.