Skip to content

Commit 860f554

Browse files
committed
refactor: rename things
1 parent 024934e commit 860f554

File tree

1 file changed

+31
-31
lines changed

1 file changed

+31
-31
lines changed

‎src/compiler/transformers/doExpression.ts‎

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@ namespace ts {
7171
return signals;
7272
}
7373
//#endregion
74-
return transformSourceFile(node);
74+
return visitSourceFile(node);
7575

76-
function transformSourceFile(node: SourceFile) {
76+
function visitSourceFile(node: SourceFile) {
7777
if (node.isDeclarationFile) return node;
7878
if ((node.transformFlags & TransformFlags.ContainsESNext) === 0) {
7979
return node;
@@ -86,11 +86,11 @@ namespace ts {
8686
function visitor(node: ConciseBody): ConciseBody;
8787
function visitor(node: Node): VisitResult<Node>;
8888
function visitor(node: Node): VisitResult<Node> {
89-
if (isFunctionLikeDeclaration(node)) return transformFunctionLikeDeclaration(node);
90-
if (isIterationStatement(node, /** lookInLabeledStatements */ false)) return transformIterationStatement(node);
91-
if (isClassLike(node)) return transformClassLike(node);
89+
if (isFunctionLikeDeclaration(node)) return visitFunctionLikeDeclaration(node);
90+
if (isIterationStatement(node, /** lookInLabeledStatements */ false)) return visitIterationStatement(node);
91+
if (isClassLike(node)) return visitClassLike(node);
9292

93-
if (isSuperProperty(node)) return transformSuperPropertyExpression(node);
93+
if (isSuperProperty(node)) return visitSuperPropertyExpression(node);
9494

9595
switch (node.kind) {
9696
// No need to handle new.target.
@@ -99,32 +99,32 @@ namespace ts {
9999

100100
// Same for super() call.
101101
case SyntaxKind.CallExpression:
102-
return transformCallExpression(node as CallExpression);
102+
return visitCallExpression(node as CallExpression);
103103
case SyntaxKind.DoExpression:
104-
return transformDoExpression(node as DoExpression);
104+
return visitDoExpression(node as DoExpression);
105105
case SyntaxKind.LabeledStatement:
106-
return transformLabelledStatement(node as LabeledStatement);
106+
return visitLabelledStatement(node as LabeledStatement);
107107
case SyntaxKind.TryStatement:
108-
return transformTryStatement(node as TryStatement);
108+
return visitTryStatement(node as TryStatement);
109109
case SyntaxKind.CatchClause:
110-
return transfromCatchClause(node as CatchClause);
110+
return visitCatchClause(node as CatchClause);
111111
case SyntaxKind.ExpressionStatement:
112-
return transformExpressionStatement(node as ExpressionStatement);
112+
return visitExpressionStatement(node as ExpressionStatement);
113113
case SyntaxKind.Block:
114-
return transformBlock(node as Block, /** directChildOfDoExpr */ false);
114+
return visitBlock(node as Block, /** directChildOfDoExpr */ false);
115115
case SyntaxKind.SwitchStatement:
116-
return transformSwitch(node as SwitchStatement);
116+
return visitSwitch(node as SwitchStatement);
117117
case SyntaxKind.Identifier:
118-
return transformIdentifier(node as Identifier);
118+
return visitIdentifier(node as Identifier);
119119
case SyntaxKind.ReturnStatement:
120120
case SyntaxKind.BreakStatement:
121121
case SyntaxKind.ContinueStatement:
122-
return transformControlFlow(node as ReturnStatement | BreakStatement | ContinueStatement);
122+
return visitControlFlow(node as ReturnStatement | BreakStatement | ContinueStatement);
123123
default:
124124
return visitEachChild(node, visitor, context);
125125
}
126126
}
127-
function transformFunctionLikeDeclaration<T extends FunctionLikeDeclaration>(node: T): Node {
127+
function visitFunctionLikeDeclaration<T extends FunctionLikeDeclaration>(node: T): Node {
128128
return startControlFlowContext(() => {
129129
currentReturnContext = { type: ControlFlow.Return, signal: undefined };
130130
return visitEachChild(node, child => {
@@ -149,7 +149,7 @@ namespace ts {
149149
return nextBody;
150150
}
151151
}
152-
function transformIterationStatement<T extends IterationStatement>(node: T): Node {
152+
function visitIterationStatement<T extends IterationStatement>(node: T): Node {
153153
const label = node.parent && isLabeledStatement(node.parent) ? node.parent.label : undefined;
154154
return startIterationContext(label, () => {
155155
return visitEachChild(node, child => {
@@ -183,10 +183,10 @@ namespace ts {
183183
return result;
184184
}
185185
}
186-
function transformClassLike<T extends ClassExpression | ClassDeclaration>(node: T): T {
186+
function visitClassLike<T extends ClassExpression | ClassDeclaration>(node: T): T {
187187
return startControlFlowContext(() => visitEachChild(node, visitor, context));
188188
}
189-
function transformLabelledStatement(node: LabeledStatement): Node {
189+
function visitLabelledStatement(node: LabeledStatement): Node {
190190
// why it will be undefined?
191191
if (!node.statement) return visitEachChild(node, visitor, context);
192192
if (isIterationStatement(node.statement, /** lookInLabeledStatements */ false)) return visitEachChild(node, visitor, context);
@@ -225,7 +225,7 @@ namespace ts {
225225
* }
226226
* ```
227227
*/
228-
function transfromCatchClause(node: CatchClause): CatchClause {
228+
function visitCatchClause(node: CatchClause): CatchClause {
229229
if (!currentReturnContext?.signal && !hasSignal(currentBreakContext) && !hasSignal(currentContinueContext)) return visitEachChild(node, visitor, context);
230230
node = visitEachChild(node, visitor, context);
231231

@@ -248,7 +248,7 @@ namespace ts {
248248
});
249249
return factory.updateCatchClause(node, factory.createVariableDeclaration(catch_e), factory.updateBlock(node.block, newStatements));
250250
}
251-
function transformTryStatement(node: TryStatement): TryStatement {
251+
function visitTryStatement(node: TryStatement): TryStatement {
252252
if (!currentDoContext) return visitEachChild(node, visitor, context);
253253
return visitEachChild(node, child => {
254254
if (child === node.finallyBlock) {
@@ -261,15 +261,15 @@ namespace ts {
261261
return visitor(child);
262262
}, context);
263263
}
264-
function transformSwitch(node: SwitchStatement): SwitchStatement {
264+
function visitSwitch(node: SwitchStatement): SwitchStatement {
265265
// TODO:
266266
return visitEachChild(node, visitor, context);
267267
}
268268

269269
/**
270270
* Turn "return val" into "throw ((operand = val), signal)"
271271
*/
272-
function transformControlFlow(node: ReturnStatement | ContinueStatement | BreakStatement) {
272+
function visitControlFlow(node: ReturnStatement | ContinueStatement | BreakStatement) {
273273
if (!currentDoContext || currentDoContext.isAsync) return visitEachChild(node, visitor, context);
274274
if (isReturnStatement(node)) {
275275
if (!currentReturnContext) return visitEachChild(node, visitor, context);
@@ -296,7 +296,7 @@ namespace ts {
296296
}
297297
}
298298

299-
function transformDoExpression(node: DoExpression) {
299+
function visitDoExpression(node: DoExpression) {
300300
const hasAwait = Boolean(node.transformFlags & TransformFlags.ContainsAwait);
301301
const hasYield = Boolean(node.transformFlags & TransformFlags.ContainsYield);
302302
const oldContext = currentDoContext;
@@ -308,7 +308,7 @@ namespace ts {
308308
shouldTrack: false,
309309
remapExpression: new Map(),
310310
};
311-
const nextBlock = transformBlock(node.block, /** directChildOfDoExpr */ true);
311+
const nextBlock = visitBlock(node.block, /** directChildOfDoExpr */ true);
312312
localContext.remapExpression.forEach(([temp, init]) => {
313313
context.hoistVariableDeclaration(temp);
314314
context.addInitializationStatement(factory.createExpressionStatement(factory.createAssignment(temp, init)));
@@ -318,12 +318,12 @@ namespace ts {
318318
return createDoExpressionExecutor(nextBlock, localContext.completionValue, hasAwait, hasYield);
319319
}
320320

321-
function transformExpressionStatement(node: ExpressionStatement) {
321+
function visitExpressionStatement(node: ExpressionStatement) {
322322
const result = visitEachChild(node, visitor, context);
323323
if (!currentDoContext?.shouldTrack) return result;
324324
return factory.updateExpressionStatement(result, factory.createAssignment(currentDoContext.completionValue, result.expression));
325325
}
326-
function transformBlock(node: Block, directChildOfDoExpr: boolean) {
326+
function visitBlock(node: Block, directChildOfDoExpr: boolean) {
327327
if (!currentDoContext) return visitEachChild(node, visitor, context);
328328
const lastMeaningfulNode = findLast(node.statements, (node) =>
329329
node.kind === SyntaxKind.ExpressionStatement ||
@@ -347,15 +347,15 @@ namespace ts {
347347
}, context);
348348
}
349349

350-
function transformIdentifier(node: Identifier) {
350+
function visitIdentifier(node: Identifier) {
351351
if (!currentDoContext?.hasYield) return node;
352352
if (context.getEmitResolver().isArgumentsLocalBinding(node)) {
353353
const ARG = "arguments";
354354
return remapExpression(currentDoContext.remapExpression, ARG, () => node, id => id);
355355
}
356356
return node;
357357
}
358-
function transformSuperPropertyExpression(node: SuperProperty) {
358+
function visitSuperPropertyExpression(node: SuperProperty) {
359359
if (!currentDoContext?.hasYield) return visitEachChild(node, visitor, context);
360360
if (isElementAccessExpression(node)) {
361361
return remapExpression(currentDoContext.remapExpression, "super_dynamic", () => {
@@ -388,7 +388,7 @@ namespace ts {
388388

389389
};
390390
}
391-
function transformCallExpression(node: CallExpression) {
391+
function visitCallExpression(node: CallExpression) {
392392
if (!currentDoContext?.hasYield) return visitEachChild(node, visitor, context);
393393
const inner = skipParentheses(node.expression);
394394
if (isSuperProperty(inner)) {

0 commit comments

Comments
 (0)