(srv, query, file)
| 878 | }; |
| 879 | |
| 880 | function findTypeAt(srv, query, file) { |
| 881 | var expr = findExpr(file, query), exprName; |
| 882 | var type = findExprType(srv, query, file, expr), exprType = type; |
| 883 | if (query.preferFunction) |
| 884 | type = type.getFunctionType() || type.getType(); |
| 885 | else |
| 886 | type = type.getType(); |
| 887 | |
| 888 | if (expr) { |
| 889 | if (expr.node.type == "Identifier") |
| 890 | exprName = expr.node.name; |
| 891 | else if (expr.node.type == "MemberExpression" && !expr.node.computed) |
| 892 | exprName = expr.node.property.name; |
| 893 | else if (expr.node.type == "MethodDefinition" && !expr.node.computed) |
| 894 | exprName = expr.node.key.name |
| 895 | } |
| 896 | |
| 897 | if (query.depth != null && typeof query.depth != "number") |
| 898 | throw ternError(".query.depth must be a number"); |
| 899 | |
| 900 | var result = {guess: infer.didGuess(), |
| 901 | type: infer.toString(exprType, query.depth), |
| 902 | name: type && type.name, |
| 903 | exprName: exprName, |
| 904 | doc: exprType.doc, |
| 905 | url: exprType.url}; |
| 906 | if (type) storeTypeDocs(query, type, result); |
| 907 | |
| 908 | return clean(result); |
| 909 | } |
| 910 | |
| 911 | function parseDoc(query, doc) { |
| 912 | if (!doc) return null; |
nothing calls this directly
no test coverage detected