mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Make 'getIndentString' just use a loop. (#41221)
* Make 'getIndentString' just use a loop. * Added test. * Accepted baselines.
This commit is contained in:
@@ -3849,8 +3849,10 @@ namespace ts {
|
||||
|
||||
const indentStrings: string[] = ["", " "];
|
||||
export function getIndentString(level: number) {
|
||||
if (indentStrings[level] === undefined) {
|
||||
indentStrings[level] = getIndentString(level - 1) + indentStrings[1];
|
||||
// prepopulate cache
|
||||
const singleLevel = indentStrings[1];
|
||||
for (let current = indentStrings.length; current <= level; current++) {
|
||||
indentStrings.push(indentStrings[current - 1] + singleLevel);
|
||||
}
|
||||
return indentStrings[level];
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user