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

Function isThislessInterface

test/fixtures/snapshot/typescript.js:57323–57348  ·  view source on GitHub ↗

* Returns true if the interface given by the symbol is free of "this" references. * * Specifically, the result is true if the interface itself contains no references * to "this" in its body, if all base types are interfaces, * and if none of the base interfaces ha

(symbol)

Source from the content-addressed store, hash-verified

57321 * and if none of the base interfaces have a "this" type.
57322 */
57323 function isThislessInterface(symbol) {
57324 if (!symbol.declarations) {
57325 return true;
57326 }
57327 for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
57328 var declaration = _a[_i];
57329 if (declaration.kind === 258 /* SyntaxKind.InterfaceDeclaration */) {
57330 if (declaration.flags & 128 /* NodeFlags.ContainsThis */) {
57331 return false;
57332 }
57333 var baseTypeNodes = ts.getInterfaceBaseTypeNodes(declaration);
57334 if (baseTypeNodes) {
57335 for (var _b = 0, baseTypeNodes_1 = baseTypeNodes; _b < baseTypeNodes_1.length; _b++) {
57336 var node = baseTypeNodes_1[_b];
57337 if (ts.isEntityNameExpression(node.expression)) {
57338 var baseSymbol = resolveEntityName(node.expression, 788968 /* SymbolFlags.Type */, /*ignoreErrors*/ true);
57339 if (!baseSymbol || !(baseSymbol.flags & 64 /* SymbolFlags.Interface */) || getDeclaredTypeOfClassOrInterface(baseSymbol).thisType) {
57340 return false;
57341 }
57342 }
57343 }
57344 }
57345 }
57346 }
57347 return true;
57348 }
57349 function getDeclaredTypeOfClassOrInterface(symbol) {
57350 var links = getSymbolLinks(symbol);
57351 var originalLinks = links;

Callers 1

Calls 2

resolveEntityNameFunction · 0.85

Tested by

no test coverage detected