(container)
| 72055 | } |
| 72056 | } |
| 72057 | function getClassNameFromPrototypeMethod(container) { |
| 72058 | // Check if it's the RHS of a x.prototype.y = function [name]() { .... } |
| 72059 | if (container.kind === 213 /* SyntaxKind.FunctionExpression */ && |
| 72060 | ts.isBinaryExpression(container.parent) && |
| 72061 | ts.getAssignmentDeclarationKind(container.parent) === 3 /* AssignmentDeclarationKind.PrototypeProperty */) { |
| 72062 | // Get the 'x' of 'x.prototype.y = container' |
| 72063 | return container.parent // x.prototype.y = container |
| 72064 | .left // x.prototype.y |
| 72065 | .expression // x.prototype |
| 72066 | .expression; // x |
| 72067 | } |
| 72068 | // x.prototype = { method() { } } |
| 72069 | else if (container.kind === 169 /* SyntaxKind.MethodDeclaration */ && |
| 72070 | container.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ && |
| 72071 | ts.isBinaryExpression(container.parent.parent) && |
| 72072 | ts.getAssignmentDeclarationKind(container.parent.parent) === 6 /* AssignmentDeclarationKind.Prototype */) { |
| 72073 | return container.parent.parent.left.expression; |
| 72074 | } |
| 72075 | // x.prototype = { method: function() { } } |
| 72076 | else if (container.kind === 213 /* SyntaxKind.FunctionExpression */ && |
| 72077 | container.parent.kind === 296 /* SyntaxKind.PropertyAssignment */ && |
| 72078 | container.parent.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ && |
| 72079 | ts.isBinaryExpression(container.parent.parent.parent) && |
| 72080 | ts.getAssignmentDeclarationKind(container.parent.parent.parent) === 6 /* AssignmentDeclarationKind.Prototype */) { |
| 72081 | return container.parent.parent.parent.left.expression; |
| 72082 | } |
| 72083 | // Object.defineProperty(x, "method", { value: function() { } }); |
| 72084 | // Object.defineProperty(x, "method", { set: (x: () => void) => void }); |
| 72085 | // Object.defineProperty(x, "method", { get: () => function() { }) }); |
| 72086 | else if (container.kind === 213 /* SyntaxKind.FunctionExpression */ && |
| 72087 | ts.isPropertyAssignment(container.parent) && |
| 72088 | ts.isIdentifier(container.parent.name) && |
| 72089 | (container.parent.name.escapedText === "value" || container.parent.name.escapedText === "get" || container.parent.name.escapedText === "set") && |
| 72090 | ts.isObjectLiteralExpression(container.parent.parent) && |
| 72091 | ts.isCallExpression(container.parent.parent.parent) && |
| 72092 | container.parent.parent.parent.arguments[2] === container.parent.parent && |
| 72093 | ts.getAssignmentDeclarationKind(container.parent.parent.parent) === 9 /* AssignmentDeclarationKind.ObjectDefinePrototypeProperty */) { |
| 72094 | return container.parent.parent.parent.arguments[0].expression; |
| 72095 | } |
| 72096 | // Object.defineProperty(x, "method", { value() { } }); |
| 72097 | // Object.defineProperty(x, "method", { set(x: () => void) {} }); |
| 72098 | // Object.defineProperty(x, "method", { get() { return () => {} } }); |
| 72099 | else if (ts.isMethodDeclaration(container) && |
| 72100 | ts.isIdentifier(container.name) && |
| 72101 | (container.name.escapedText === "value" || container.name.escapedText === "get" || container.name.escapedText === "set") && |
| 72102 | ts.isObjectLiteralExpression(container.parent) && |
| 72103 | ts.isCallExpression(container.parent.parent) && |
| 72104 | container.parent.parent.arguments[2] === container.parent && |
| 72105 | ts.getAssignmentDeclarationKind(container.parent.parent) === 9 /* AssignmentDeclarationKind.ObjectDefinePrototypeProperty */) { |
| 72106 | return container.parent.parent.arguments[0].expression; |
| 72107 | } |
| 72108 | } |
| 72109 | function getTypeForThisExpressionFromJSDoc(node) { |
| 72110 | var jsdocType = ts.getJSDocType(node); |
| 72111 | if (jsdocType && jsdocType.kind === 317 /* SyntaxKind.JSDocFunctionType */) { |
no outgoing calls
no test coverage detected
searching dependent graphs…