Skip to content

Commit 2905f41

Browse files
Merge pull request microsoft#3557 from Microsoft/spreadStackOverflow
Don't use spread operator when pushing arrays onto other arrays.
2 parents 6db4faf + ede80c1 commit 2905f41

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

src/services/services.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1789,11 +1789,6 @@ namespace ts {
17891789
sourceFile.moduleName = moduleName;
17901790
}
17911791

1792-
// Store syntactic diagnostics
1793-
if (diagnostics && sourceFile.parseDiagnostics) {
1794-
diagnostics.push(...sourceFile.parseDiagnostics);
1795-
}
1796-
17971792
let newLine = getNewLineCharacter(options);
17981793

17991794
// Output
@@ -1815,9 +1810,8 @@ namespace ts {
18151810

18161811
var program = createProgram([inputFileName], options, compilerHost);
18171812

1818-
if (diagnostics) {
1819-
diagnostics.push(...program.getCompilerOptionsDiagnostics());
1820-
}
1813+
addRange(/*to*/ diagnostics, /*from*/ sourceFile.parseDiagnostics);
1814+
addRange(/*to*/ diagnostics, /*from*/ program.getCompilerOptionsDiagnostics());
18211815

18221816
// Emit
18231817
program.emit();
@@ -4188,7 +4182,7 @@ namespace ts {
41884182
var result: DefinitionInfo[] = [];
41894183
forEach((<UnionType>type).types, t => {
41904184
if (t.symbol) {
4191-
result.push(...getDefinitionFromSymbol(t.symbol, node));
4185+
addRange(/*to*/ result, /*from*/ getDefinitionFromSymbol(t.symbol, node));
41924186
}
41934187
});
41944188
return result;

0 commit comments

Comments
 (0)