Skip to content

Commit a906d6f

Browse files
committed
PR Feedback
1 parent 67dec37 commit a906d6f

File tree

5 files changed

+20
-25
lines changed

5 files changed

+20
-25
lines changed

Diff for: src/compiler/emitter.ts

+14-17
Original file line numberDiff line numberDiff line change
@@ -4199,23 +4199,20 @@ namespace ts {
41994199
pos++;
42004200
}
42014201

4202-
if (start < pos) {
4203-
const textRange: TextRange = { pos: -1, end: -1 };
4204-
if (start === 0) textRange.pos = modifiers.pos;
4205-
if (pos === modifiers.length - 1) textRange.end = modifiers.end;
4206-
emitNodeListItems(
4207-
emit,
4208-
node,
4209-
modifiers,
4210-
lastMode === "modifiers" ? ListFormat.Modifiers : ListFormat.Decorators,
4211-
/*parenthesizerRule*/ undefined,
4212-
start,
4213-
pos - start,
4214-
/*hasTrailingComma*/ false,
4215-
textRange);
4216-
start = pos;
4217-
}
4218-
4202+
const textRange: TextRange = { pos: -1, end: -1 };
4203+
if (start === 0) textRange.pos = modifiers.pos;
4204+
if (pos === modifiers.length - 1) textRange.end = modifiers.end;
4205+
emitNodeListItems(
4206+
emit,
4207+
node,
4208+
modifiers,
4209+
lastMode === "modifiers" ? ListFormat.Modifiers : ListFormat.Decorators,
4210+
/*parenthesizerRule*/ undefined,
4211+
start,
4212+
pos - start,
4213+
/*hasTrailingComma*/ false,
4214+
textRange);
4215+
start = pos;
42194216
lastMode = mode;
42204217
pos++;
42214218
}

Diff for: src/compiler/transformers/declarations.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1557,11 +1557,11 @@ namespace ts {
15571557
return some(statements, isScopeMarker);
15581558
}
15591559

1560-
function ensureModifiers<T extends HasModifiers>(node: T): readonly NonNullable<T["modifiers"]>[number][] | undefined {
1560+
function ensureModifiers<T extends HasModifiers>(node: T): readonly Modifier[] | undefined {
15611561
const currentFlags = getEffectiveModifierFlags(node);
15621562
const newFlags = ensureModifierFlags(node);
15631563
if (currentFlags === newFlags) {
1564-
return visitNodes(node.modifiers, n => tryCast(n, isModifier), isModifier);
1564+
return visitArray(node.modifiers, n => tryCast(n, isModifier), isModifier);
15651565
}
15661566
return factory.createModifiersFromModifierFlags(newFlags);
15671567
}

Diff for: src/compiler/visitorPublic.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@ namespace ts {
116116
}
117117

118118
/* @internal */
119-
export function visitArray<T extends Node>(nodes: readonly T[] | undefined, visitor: Visitor | undefined, test: (node: Node) => node is T, start?: number, count?: number): readonly T[] | undefined {
120-
if (nodes === undefined || visitor === undefined) {
119+
export function visitArray<T extends Node, U extends T>(nodes: readonly T[] | undefined, visitor: Visitor, test: (node: Node) => node is U, start?: number, count?: number): readonly U[] | undefined {
120+
if (nodes === undefined) {
121121
return nodes;
122122
}
123123

@@ -131,7 +131,7 @@ namespace ts {
131131
count = length - start;
132132
}
133133

134-
return visitArrayWorker(nodes, visitor, test, start, count);
134+
return visitArrayWorker(nodes, visitor, test, start, count) as readonly U[];
135135
}
136136

137137
/* @internal */

Diff for: src/services/codefixes/convertToAsyncFunction.ts

-2
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,6 @@ namespace ts.codefix {
8383
}
8484

8585
const pos = skipTrivia(sourceFile.text, moveRangePastModifiers(functionToConvert).pos);
86-
// const pos = functionToConvert.modifiers?.end ?? functionToConvert.getStart(sourceFile);
87-
// const options = functionToConvert.modifiers ? { prefix: " " } : { suffix: " " };
8886
changes.insertModifierAt(sourceFile, pos, SyntaxKind.AsyncKeyword, { suffix: " " });
8987

9088
for (const returnStatement of returnStatements) {

Diff for: src/testRunner/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
{ "path": "../typingsInstallerCore", "prepend": true },
2525
{ "path": "../deprecatedCompat", "prepend": true },
2626
{ "path": "../harness", "prepend": true },
27-
{ "path": "../loggedIO", "prepend": true },
27+
{ "path": "../loggedIO", "prepend": true }
2828
],
2929

3030
"files": [

0 commit comments

Comments
 (0)