Rename "isPartOfExpression" (#18469)
This commit is contained in:
parent
c66e3178ce
commit
f4236ec5c8
|
@ -6576,7 +6576,7 @@ namespace ts {
|
|||
if (!node) return false;
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.Identifier:
|
||||
return (<Identifier>node).escapedText === "arguments" && isPartOfExpression(node);
|
||||
return (<Identifier>node).escapedText === "arguments" && isExpressionNode(node);
|
||||
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
|
@ -12522,7 +12522,7 @@ namespace ts {
|
|||
if (isRightSideOfQualifiedNameOrPropertyAccess(location)) {
|
||||
location = location.parent;
|
||||
}
|
||||
if (isPartOfExpression(location) && !isAssignmentTarget(location)) {
|
||||
if (isExpressionNode(location) && !isAssignmentTarget(location)) {
|
||||
const type = getTypeOfExpression(<Expression>location);
|
||||
if (getExportSymbolOfValueSymbolIfExported(getNodeLinks(location).resolvedSymbol) === symbol) {
|
||||
return type;
|
||||
|
@ -15211,7 +15211,7 @@ namespace ts {
|
|||
// We might be in `a = { b: this.b }`, so keep looking. See `tests/cases/compiler/useBeforeDeclaration_propertyAssignment.ts`.
|
||||
return false;
|
||||
default:
|
||||
return isPartOfExpression(node) ? false : "quit";
|
||||
return isExpressionNode(node) ? false : "quit";
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -23482,7 +23482,7 @@ namespace ts {
|
|||
return typeParameter && typeParameter.symbol;
|
||||
}
|
||||
|
||||
if (isPartOfExpression(entityName)) {
|
||||
if (isExpressionNode(entityName)) {
|
||||
if (nodeIsMissing(entityName)) {
|
||||
// Missing entity name.
|
||||
return undefined;
|
||||
|
@ -23656,7 +23656,7 @@ namespace ts {
|
|||
return typeFromTypeNode;
|
||||
}
|
||||
|
||||
if (isPartOfExpression(node)) {
|
||||
if (isExpressionNode(node)) {
|
||||
return getRegularTypeOfExpression(<Expression>node);
|
||||
}
|
||||
|
||||
|
|
|
@ -1228,7 +1228,7 @@ namespace ts {
|
|||
return false;
|
||||
}
|
||||
|
||||
export function isPartOfExpression(node: Node): boolean {
|
||||
export function isExpressionNode(node: Node): boolean {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.SuperKeyword:
|
||||
case SyntaxKind.NullKeyword:
|
||||
|
@ -1331,7 +1331,7 @@ namespace ts {
|
|||
case SyntaxKind.ExpressionWithTypeArguments:
|
||||
return (<ExpressionWithTypeArguments>parent).expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent);
|
||||
default:
|
||||
return isPartOfExpression(parent);
|
||||
return isExpressionNode(parent);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5381,7 +5381,7 @@ namespace ts {
|
|||
/* @internal */
|
||||
/**
|
||||
* Determines whether a node is an expression based only on its kind.
|
||||
* Use `isPartOfExpression` if not in transforms.
|
||||
* Use `isExpressionNode` if not in transforms.
|
||||
*/
|
||||
export function isExpression(node: Node): node is Expression {
|
||||
return isExpressionKind(skipPartiallyEmittedExpressions(node).kind);
|
||||
|
|
|
@ -52,7 +52,7 @@ class TypeWriterWalker {
|
|||
}
|
||||
|
||||
private *visitNode(node: ts.Node, isSymbolWalk: boolean): IterableIterator<TypeWriterResult> {
|
||||
if (ts.isPartOfExpression(node) || node.kind === ts.SyntaxKind.Identifier) {
|
||||
if (ts.isExpressionNode(node) || node.kind === ts.SyntaxKind.Identifier) {
|
||||
const result = this.writeTypeOrSymbol(node, isSymbolWalk);
|
||||
if (result) {
|
||||
yield result;
|
||||
|
|
|
@ -297,7 +297,7 @@ namespace ts.BreakpointResolver {
|
|||
}
|
||||
}
|
||||
|
||||
if (isPartOfExpression(node)) {
|
||||
if (isExpressionNode(node)) {
|
||||
switch (node.parent.kind) {
|
||||
case SyntaxKind.DoStatement:
|
||||
// Set span as if on while keyword
|
||||
|
|
|
@ -368,7 +368,7 @@ namespace ts.codefix {
|
|||
}
|
||||
|
||||
function inferTypeFromContextualType(node: Expression, checker: TypeChecker, usageContext: UsageContext): void {
|
||||
if (isPartOfExpression(node)) {
|
||||
if (isExpressionNode(node)) {
|
||||
addCandidateType(usageContext, checker.getContextualType(node));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -849,7 +849,7 @@ namespace ts.formatting {
|
|||
}
|
||||
|
||||
static NodeIsInDecoratorContext(node: Node): boolean {
|
||||
while (isPartOfExpression(node)) {
|
||||
while (isExpressionNode(node)) {
|
||||
node = node.parent;
|
||||
}
|
||||
return node.kind === SyntaxKind.Decorator;
|
||||
|
|
|
@ -331,7 +331,7 @@ namespace ts.refactor.extractSymbol {
|
|||
Continue = 1 << 1,
|
||||
Return = 1 << 2
|
||||
}
|
||||
if (!isStatement(nodeToCheck) && !(isPartOfExpression(nodeToCheck) && isExtractableExpression(nodeToCheck))) {
|
||||
if (!isStatement(nodeToCheck) && !(isExpressionNode(nodeToCheck) && isExtractableExpression(nodeToCheck))) {
|
||||
return [createDiagnosticForNode(nodeToCheck, Messages.StatementOrExpressionExpected)];
|
||||
}
|
||||
|
||||
|
@ -491,7 +491,7 @@ namespace ts.refactor.extractSymbol {
|
|||
if (isStatement(node)) {
|
||||
return [node];
|
||||
}
|
||||
else if (isPartOfExpression(node)) {
|
||||
else if (isExpressionNode(node)) {
|
||||
// If our selection is the expression in an ExpressionStatement, expand
|
||||
// the selection to include the enclosing Statement (this stops us
|
||||
// from trying to care about the return value of the extracted function
|
||||
|
|
|
@ -178,7 +178,7 @@ namespace ts {
|
|||
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.ThisKeyword:
|
||||
return !isPartOfExpression(node);
|
||||
return !isExpressionNode(node);
|
||||
case SyntaxKind.ThisType:
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue