(typeChecker, symbol, node, failedAliasResolution, excludeDeclaration)
| 139993 | return !!containingAssignment && ts.getAssignmentDeclarationKind(containingAssignment) === 5 /* AssignmentDeclarationKind.Property */; |
| 139994 | } |
| 139995 | function getDefinitionFromSymbol(typeChecker, symbol, node, failedAliasResolution, excludeDeclaration) { |
| 139996 | var filteredDeclarations = ts.filter(symbol.declarations, function (d) { return d !== excludeDeclaration; }); |
| 139997 | var withoutExpandos = ts.filter(filteredDeclarations, function (d) { return !isExpandoDeclaration(d); }); |
| 139998 | var results = ts.some(withoutExpandos) ? withoutExpandos : filteredDeclarations; |
| 139999 | return getConstructSignatureDefinition() || getCallSignatureDefinition() || ts.map(results, function (declaration) { return createDefinitionInfo(declaration, typeChecker, symbol, node, /*unverified*/ false, failedAliasResolution); }); |
| 140000 | function getConstructSignatureDefinition() { |
| 140001 | // Applicable only if we are in a new expression, or we are on a constructor declaration |
| 140002 | // and in either case the symbol has a construct signature definition, i.e. class |
| 140003 | if (symbol.flags & 32 /* SymbolFlags.Class */ && !(symbol.flags & (16 /* SymbolFlags.Function */ | 3 /* SymbolFlags.Variable */)) && (ts.isNewExpressionTarget(node) || node.kind === 134 /* SyntaxKind.ConstructorKeyword */)) { |
| 140004 | var cls = ts.find(filteredDeclarations, ts.isClassLike) || ts.Debug.fail("Expected declaration to have at least one class-like declaration"); |
| 140005 | return getSignatureDefinition(cls.members, /*selectConstructors*/ true); |
| 140006 | } |
| 140007 | } |
| 140008 | function getCallSignatureDefinition() { |
| 140009 | return ts.isCallOrNewExpressionTarget(node) || ts.isNameOfFunctionDeclaration(node) |
| 140010 | ? getSignatureDefinition(filteredDeclarations, /*selectConstructors*/ false) |
| 140011 | : undefined; |
| 140012 | } |
| 140013 | function getSignatureDefinition(signatureDeclarations, selectConstructors) { |
| 140014 | if (!signatureDeclarations) { |
| 140015 | return undefined; |
| 140016 | } |
| 140017 | var declarations = signatureDeclarations.filter(selectConstructors ? ts.isConstructorDeclaration : ts.isFunctionLike); |
| 140018 | var declarationsWithBody = declarations.filter(function (d) { return !!d.body; }); |
| 140019 | // declarations defined on the global scope can be defined on multiple files. Get all of them. |
| 140020 | return declarations.length |
| 140021 | ? declarationsWithBody.length !== 0 |
| 140022 | ? declarationsWithBody.map(function (x) { return createDefinitionInfo(x, typeChecker, symbol, node); }) |
| 140023 | : [createDefinitionInfo(ts.last(declarations), typeChecker, symbol, node, /*unverified*/ false, failedAliasResolution)] |
| 140024 | : undefined; |
| 140025 | } |
| 140026 | } |
| 140027 | /** Creates a DefinitionInfo from a Declaration, using the declaration's name if possible. */ |
| 140028 | function createDefinitionInfo(declaration, checker, symbol, node, unverified, failedAliasResolution) { |
| 140029 | var symbolName = checker.symbolToString(symbol); // Do not get scoped name, just the name of the symbol |
no test coverage detected