MCPcopy Create free account
hub / github.com/nodejs/node / markPropertyAsReferenced

Function markPropertyAsReferenced

test/fixtures/snapshot/typescript.js:75092–75113  ·  view source on GitHub ↗
(prop, nodeForCheckWriteOnly, isSelfTypeAccess)

Source from the content-addressed store, hash-verified

75090 }
75091 }
75092 function markPropertyAsReferenced(prop, nodeForCheckWriteOnly, isSelfTypeAccess) {
75093 var valueDeclaration = prop && (prop.flags & 106500 /* SymbolFlags.ClassMember */) && prop.valueDeclaration;
75094 if (!valueDeclaration) {
75095 return;
75096 }
75097 var hasPrivateModifier = ts.hasEffectiveModifier(valueDeclaration, 8 /* ModifierFlags.Private */);
75098 var hasPrivateIdentifier = prop.valueDeclaration && ts.isNamedDeclaration(prop.valueDeclaration) && ts.isPrivateIdentifier(prop.valueDeclaration.name);
75099 if (!hasPrivateModifier && !hasPrivateIdentifier) {
75100 return;
75101 }
75102 if (nodeForCheckWriteOnly && ts.isWriteOnlyAccess(nodeForCheckWriteOnly) && !(prop.flags & 65536 /* SymbolFlags.SetAccessor */)) {
75103 return;
75104 }
75105 if (isSelfTypeAccess) {
75106 // Find any FunctionLikeDeclaration because those create a new 'this' binding. But this should only matter for methods (or getters/setters).
75107 var containingMethod = ts.findAncestor(nodeForCheckWriteOnly, ts.isFunctionLikeDeclaration);
75108 if (containingMethod && containingMethod.symbol === prop) {
75109 return;
75110 }
75111 }
75112 (ts.getCheckFlags(prop) & 1 /* CheckFlags.Instantiated */ ? getSymbolLinks(prop).target : prop).isReferenced = 67108863 /* SymbolFlags.All */;
75113 }
75114 function isSelfTypeAccess(name, parent) {
75115 return name.kind === 108 /* SyntaxKind.ThisKeyword */
75116 || !!parent && ts.isEntityNameExpression(name) && parent === getResolvedSymbol(ts.getFirstIdentifier(name));

Calls 1

getSymbolLinksFunction · 0.85

Tested by

no test coverage detected