Skip to content

Commit de8b2fa

Browse files
ahejlsbergmhegazy
authored andcommitted
Optimize spread to not generate x.slice() when x is an array literal
1 parent a4294a6 commit de8b2fa

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/compiler/emitter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1383,7 +1383,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
13831383
e = (<SpreadElementExpression>e).expression;
13841384
emitParenthesizedIf(e, /*parenthesized*/ group === 0 && needsParenthesisForPropertyAccessOrInvocation(e));
13851385
pos++;
1386-
if (pos === length && group === 0 && alwaysCopy) {
1386+
if (pos === length && group === 0 && alwaysCopy && e.kind !== SyntaxKind.ArrayLiteralExpression) {
13871387
write(".slice()");
13881388
}
13891389
}

0 commit comments

Comments
 (0)