MCPcopy Index your code
hub / github.com/nodejs/node / isConstructorDeclaredProperty

Function isConstructorDeclaredProperty

test/fixtures/snapshot/typescript.js:56058–56076  ·  view source on GitHub ↗
(symbol)

Source from the content-addressed store, hash-verified

56056 return undefined;
56057 }
56058 function isConstructorDeclaredProperty(symbol) {
56059 // A property is considered a constructor declared property when all declaration sites are this.xxx assignments,
56060 // when no declaration sites have JSDoc type annotations, and when at least one declaration site is in the body of
56061 // a class constructor.
56062 if (symbol.valueDeclaration && ts.isBinaryExpression(symbol.valueDeclaration)) {
56063 var links = getSymbolLinks(symbol);
56064 if (links.isConstructorDeclaredProperty === undefined) {
56065 links.isConstructorDeclaredProperty = false;
56066 links.isConstructorDeclaredProperty = !!getDeclaringConstructor(symbol) && ts.every(symbol.declarations, function (declaration) {
56067 return ts.isBinaryExpression(declaration) &&
56068 isPossiblyAliasedThisProperty(declaration) &&
56069 (declaration.left.kind !== 207 /* SyntaxKind.ElementAccessExpression */ || ts.isStringOrNumericLiteralLike(declaration.left.argumentExpression)) &&
56070 !getAnnotatedTypeForAssignmentDeclaration(/*declaredType*/ undefined, declaration, symbol, declaration);
56071 });
56072 }
56073 return links.isConstructorDeclaredProperty;
56074 }
56075 return false;
56076 }
56077 function isAutoTypedProperty(symbol) {
56078 // A property is auto-typed when its declaration has no type annotation or initializer and we're in
56079 // noImplicitAny mode or a .js file.

Calls 5

getSymbolLinksFunction · 0.85
getDeclaringConstructorFunction · 0.85
everyMethod · 0.80

Tested by

no test coverage detected