Skip to content

Commit 451089e

Browse files
Rename isWrite -> writing (#43405)
1 parent 2ac888b commit 451089e

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/compiler/checker.ts

+11-11
Original file line numberDiff line numberDiff line change
@@ -9013,7 +9013,7 @@ namespace ts {
90139013

90149014
function getTypeOfSetAccessor(symbol: Symbol): Type | undefined {
90159015
const links = getSymbolLinks(symbol);
9016-
return links.writeType || (links.writeType = getTypeOfAccessorsWorker(symbol, /*isWrite*/ true));
9016+
return links.writeType || (links.writeType = getTypeOfAccessorsWorker(symbol, /*writing*/ true));
90179017
}
90189018

90199019
function getTypeOfAccessorsWorker(symbol: Symbol, writing = false): Type | undefined {
@@ -9033,12 +9033,12 @@ namespace ts {
90339033
return type;
90349034
}
90359035

9036-
function resolveTypeOfAccessors(symbol: Symbol, isWrite = false) {
9036+
function resolveTypeOfAccessors(symbol: Symbol, writing = false) {
90379037
const getter = getDeclarationOfKind<AccessorDeclaration>(symbol, SyntaxKind.GetAccessor);
90389038
const setter = getDeclarationOfKind<AccessorDeclaration>(symbol, SyntaxKind.SetAccessor);
90399039

90409040
// For write operations, prioritize type annotations on the setter
9041-
if (isWrite) {
9041+
if (writing) {
90429042
const setterParameterType = getAnnotatedAccessorType(setter);
90439043
if (setterParameterType) {
90449044
const flags = getCheckFlags(symbol);
@@ -26618,9 +26618,9 @@ namespace ts {
2661826618
*/
2661926619
function checkPropertyAccessibility(
2662026620
node: PropertyAccessExpression | QualifiedName | PropertyAccessExpression | VariableDeclaration | ParameterDeclaration | ImportTypeNode | PropertyAssignment | ShorthandPropertyAssignment | BindingElement,
26621-
isSuper: boolean, isWrite: boolean, type: Type, prop: Symbol, reportError = true): boolean {
26621+
isSuper: boolean, writing: boolean, type: Type, prop: Symbol, reportError = true): boolean {
2662226622

26623-
const flags = getDeclarationModifierFlagsFromSymbol(prop, isWrite);
26623+
const flags = getDeclarationModifierFlagsFromSymbol(prop, writing);
2662426624
const errorNode = node.kind === SyntaxKind.QualifiedName ? node.right :
2662526625
node.kind === SyntaxKind.ImportType ? node :
2662626626
node.kind === SyntaxKind.BindingElement && node.propertyName ? node.propertyName : node.name;
@@ -26995,14 +26995,14 @@ namespace ts {
2699526995
checkPropertyNotUsedBeforeDeclaration(prop, node, right);
2699626996
markPropertyAsReferenced(prop, node, isSelfTypeAccess(left, parentSymbol));
2699726997
getNodeLinks(node).resolvedSymbol = prop;
26998-
const isWrite = isWriteAccess(node);
26999-
checkPropertyAccessibility(node, left.kind === SyntaxKind.SuperKeyword, isWrite, apparentType, prop);
26998+
const writing = isWriteAccess(node);
26999+
checkPropertyAccessibility(node, left.kind === SyntaxKind.SuperKeyword, writing, apparentType, prop);
2700027000
if (isAssignmentToReadonlyEntity(node as Expression, prop, assignmentKind)) {
2700127001
error(right, Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property, idText(right));
2700227002
return errorType;
2700327003
}
2700427004

27005-
propType = isThisPropertyAccessInConstructor(node, prop) ? autoType : isWrite ? getSetAccessorTypeOfSymbol(prop) : getTypeOfSymbol(prop);
27005+
propType = isThisPropertyAccessInConstructor(node, prop) ? autoType : writing ? getSetAccessorTypeOfSymbol(prop) : getTypeOfSymbol(prop);
2700627006
}
2700727007

2700827008
return getFlowTypeOfAccessExpression(node, prop, propType, right, checkMode);
@@ -27394,7 +27394,7 @@ namespace ts {
2739427394
const declClass = getContainingClass(prop.valueDeclaration);
2739527395
return !isOptionalChain(node) && !!findAncestor(node, parent => parent === declClass);
2739627396
}
27397-
return checkPropertyAccessibility(node, isSuper, /*isWrite*/ false, type, prop, /* reportError */ false);
27397+
return checkPropertyAccessibility(node, isSuper, /*writing*/ false, type, prop, /* reportError */ false);
2739827398
}
2739927399
// In js files properties of unions are allowed in completion
2740027400
return isInJSFile(node) && (type.flags & TypeFlags.Union) !== 0 && (<UnionType>type).types.some(elementType => isValidPropertyAccessWithType(node, isSuper, propertyName, elementType));
@@ -31033,7 +31033,7 @@ namespace ts {
3103331033
const prop = getPropertyOfType(objectLiteralType, text);
3103431034
if (prop) {
3103531035
markPropertyAsReferenced(prop, property, rightIsThis);
31036-
checkPropertyAccessibility(property, /*isSuper*/ false, /*isWrite*/ true, objectLiteralType, prop);
31036+
checkPropertyAccessibility(property, /*isSuper*/ false, /*writing*/ true, objectLiteralType, prop);
3103731037
}
3103831038
}
3103931039
const elementType = getIndexedAccessType(objectLiteralType, exprType, /*noUncheckedIndexedAccessCandidate*/ undefined, name, /*aliasSymbol*/ undefined, /*aliasTypeArguments*/ undefined, AccessFlags.ExpressionPosition);
@@ -34996,7 +34996,7 @@ namespace ts {
3499634996
const property = getPropertyOfType(parentType, nameText);
3499734997
if (property) {
3499834998
markPropertyAsReferenced(property, /*nodeForCheckWriteOnly*/ undefined, /*isSelfTypeAccess*/ false); // A destructuring is never a write-only reference.
34999-
checkPropertyAccessibility(node, !!parent.initializer && parent.initializer.kind === SyntaxKind.SuperKeyword, /*isWrite*/ false, parentType, property);
34999+
checkPropertyAccessibility(node, !!parent.initializer && parent.initializer.kind === SyntaxKind.SuperKeyword, /*writing*/ false, parentType, property);
3500035000
}
3500135001
}
3500235002
}

0 commit comments

Comments
 (0)