* Checks if a property can be accessed in a location. * The location is given by the `node` parameter. * The node does not need to be a property access. * @param node location where to check property accessibility * @param isSuper whether to consider this a `super
(node, isSuper, isWrite, containingType, property)
| 75159 | * @param property property symbol. |
| 75160 | */ |
| 75161 | function isPropertyAccessible(node, isSuper, isWrite, containingType, property) { |
| 75162 | // Short-circuiting for improved performance. |
| 75163 | if (isTypeAny(containingType)) { |
| 75164 | return true; |
| 75165 | } |
| 75166 | // A #private property access in an optional chain is an error dealt with by the parser. |
| 75167 | // The checker does not check for it, so we need to do our own check here. |
| 75168 | if (property.valueDeclaration && ts.isPrivateIdentifierClassElementDeclaration(property.valueDeclaration)) { |
| 75169 | var declClass_1 = ts.getContainingClass(property.valueDeclaration); |
| 75170 | return !ts.isOptionalChain(node) && !!ts.findAncestor(node, function (parent) { return parent === declClass_1; }); |
| 75171 | } |
| 75172 | return checkPropertyAccessibilityAtLocation(node, isSuper, isWrite, containingType, property); |
| 75173 | } |
| 75174 | /** |
| 75175 | * Return the symbol of the for-in variable declared or referenced by the given for-in statement. |
| 75176 | */ |
no test coverage detected