Skip to content

Commit f4236ec

Browse files
author
Andy
authored
Rename "isPartOfExpression" (microsoft#18469)
1 parent c66e317 commit f4236ec

8 files changed

Lines changed: 15 additions & 15 deletions

File tree

src/compiler/checker.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6576,7 +6576,7 @@ namespace ts {
65766576
if (!node) return false;
65776577
switch (node.kind) {
65786578
case SyntaxKind.Identifier:
6579-
return (<Identifier>node).escapedText === "arguments" && isPartOfExpression(node);
6579+
return (<Identifier>node).escapedText === "arguments" && isExpressionNode(node);
65806580

65816581
case SyntaxKind.PropertyDeclaration:
65826582
case SyntaxKind.MethodDeclaration:
@@ -12522,7 +12522,7 @@ namespace ts {
1252212522
if (isRightSideOfQualifiedNameOrPropertyAccess(location)) {
1252312523
location = location.parent;
1252412524
}
12525-
if (isPartOfExpression(location) && !isAssignmentTarget(location)) {
12525+
if (isExpressionNode(location) && !isAssignmentTarget(location)) {
1252612526
const type = getTypeOfExpression(<Expression>location);
1252712527
if (getExportSymbolOfValueSymbolIfExported(getNodeLinks(location).resolvedSymbol) === symbol) {
1252812528
return type;
@@ -15211,7 +15211,7 @@ namespace ts {
1521115211
// We might be in `a = { b: this.b }`, so keep looking. See `tests/cases/compiler/useBeforeDeclaration_propertyAssignment.ts`.
1521215212
return false;
1521315213
default:
15214-
return isPartOfExpression(node) ? false : "quit";
15214+
return isExpressionNode(node) ? false : "quit";
1521515215
}
1521615216
});
1521715217
}
@@ -23482,7 +23482,7 @@ namespace ts {
2348223482
return typeParameter && typeParameter.symbol;
2348323483
}
2348423484

23485-
if (isPartOfExpression(entityName)) {
23485+
if (isExpressionNode(entityName)) {
2348623486
if (nodeIsMissing(entityName)) {
2348723487
// Missing entity name.
2348823488
return undefined;
@@ -23656,7 +23656,7 @@ namespace ts {
2365623656
return typeFromTypeNode;
2365723657
}
2365823658

23659-
if (isPartOfExpression(node)) {
23659+
if (isExpressionNode(node)) {
2366023660
return getRegularTypeOfExpression(<Expression>node);
2366123661
}
2366223662

src/compiler/utilities.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1228,7 +1228,7 @@ namespace ts {
12281228
return false;
12291229
}
12301230

1231-
export function isPartOfExpression(node: Node): boolean {
1231+
export function isExpressionNode(node: Node): boolean {
12321232
switch (node.kind) {
12331233
case SyntaxKind.SuperKeyword:
12341234
case SyntaxKind.NullKeyword:
@@ -1331,7 +1331,7 @@ namespace ts {
13311331
case SyntaxKind.ExpressionWithTypeArguments:
13321332
return (<ExpressionWithTypeArguments>parent).expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent);
13331333
default:
1334-
return isPartOfExpression(parent);
1334+
return isExpressionNode(parent);
13351335
}
13361336
}
13371337

@@ -5381,7 +5381,7 @@ namespace ts {
53815381
/* @internal */
53825382
/**
53835383
* Determines whether a node is an expression based only on its kind.
5384-
* Use `isPartOfExpression` if not in transforms.
5384+
* Use `isExpressionNode` if not in transforms.
53855385
*/
53865386
export function isExpression(node: Node): node is Expression {
53875387
return isExpressionKind(skipPartiallyEmittedExpressions(node).kind);

src/harness/typeWriter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class TypeWriterWalker {
5252
}
5353

5454
private *visitNode(node: ts.Node, isSymbolWalk: boolean): IterableIterator<TypeWriterResult> {
55-
if (ts.isPartOfExpression(node) || node.kind === ts.SyntaxKind.Identifier) {
55+
if (ts.isExpressionNode(node) || node.kind === ts.SyntaxKind.Identifier) {
5656
const result = this.writeTypeOrSymbol(node, isSymbolWalk);
5757
if (result) {
5858
yield result;

src/services/breakpoints.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ namespace ts.BreakpointResolver {
297297
}
298298
}
299299

300-
if (isPartOfExpression(node)) {
300+
if (isExpressionNode(node)) {
301301
switch (node.parent.kind) {
302302
case SyntaxKind.DoStatement:
303303
// Set span as if on while keyword

src/services/codefixes/inferFromUsage.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ namespace ts.codefix {
368368
}
369369

370370
function inferTypeFromContextualType(node: Expression, checker: TypeChecker, usageContext: UsageContext): void {
371-
if (isPartOfExpression(node)) {
371+
if (isExpressionNode(node)) {
372372
addCandidateType(usageContext, checker.getContextualType(node));
373373
}
374374
}

src/services/formatting/rules.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,7 @@ namespace ts.formatting {
849849
}
850850

851851
static NodeIsInDecoratorContext(node: Node): boolean {
852-
while (isPartOfExpression(node)) {
852+
while (isExpressionNode(node)) {
853853
node = node.parent;
854854
}
855855
return node.kind === SyntaxKind.Decorator;

src/services/refactors/extractSymbol.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ namespace ts.refactor.extractSymbol {
331331
Continue = 1 << 1,
332332
Return = 1 << 2
333333
}
334-
if (!isStatement(nodeToCheck) && !(isPartOfExpression(nodeToCheck) && isExtractableExpression(nodeToCheck))) {
334+
if (!isStatement(nodeToCheck) && !(isExpressionNode(nodeToCheck) && isExtractableExpression(nodeToCheck))) {
335335
return [createDiagnosticForNode(nodeToCheck, Messages.StatementOrExpressionExpected)];
336336
}
337337

@@ -491,7 +491,7 @@ namespace ts.refactor.extractSymbol {
491491
if (isStatement(node)) {
492492
return [node];
493493
}
494-
else if (isPartOfExpression(node)) {
494+
else if (isExpressionNode(node)) {
495495
// If our selection is the expression in an ExpressionStatement, expand
496496
// the selection to include the enclosing Statement (this stops us
497497
// from trying to care about the return value of the extracted function

src/services/utilities.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ namespace ts {
178178

179179
switch (node.kind) {
180180
case SyntaxKind.ThisKeyword:
181-
return !isPartOfExpression(node);
181+
return !isExpressionNode(node);
182182
case SyntaxKind.ThisType:
183183
return true;
184184
}

0 commit comments

Comments
 (0)