Skip to content

Commit 4ff66c8

Browse files
LuLaValvaDylanPiercey
authored andcommitted
refactor: move logic to calling side of addNumericPropertiesUntil
1 parent cab5759 commit 4ff66c8

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

packages/runtime-tags/src/translator/util/references.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ export function trackParamsReferences(
271271
section,
272272
paramsBinding,
273273
undefined,
274-
addNumericPropertiesUntil(undefined, i - 1),
274+
i > 0 ? addNumericPropertiesUntil(undefined, i - 1) : undefined,
275275
);
276276
} else if (t.isLVal(param)) {
277277
createBindingsAndTrackReferences(
@@ -532,10 +532,10 @@ function createBindingsAndTrackReferences(
532532
i++;
533533
if (element) {
534534
if (element.type === "RestElement") {
535-
excludeProperties = addNumericPropertiesUntil(
536-
excludeProperties,
537-
i - 1,
538-
);
535+
excludeProperties =
536+
i > 0
537+
? addNumericPropertiesUntil(excludeProperties, i - 1)
538+
: undefined;
539539
createBindingsAndTrackReferences(
540540
element.argument,
541541
type,
@@ -1702,7 +1702,7 @@ function setCanonicalExtra(extra: t.NodeExtra, merged: t.NodeExtra) {
17021702

17031703
function addNumericPropertiesUntil(props: Opt<string>, len: number) {
17041704
let result = props;
1705-
for (let i = len; i-- >= 0; ) {
1705+
for (let i = len; i--; ) {
17061706
result = propsUtil.add(result, i + "");
17071707
}
17081708
return result;

0 commit comments

Comments
 (0)