MCPcopy Index your code
hub / github.com/ternjs/tern / findTypeAtExpr

Function findTypeAtExpr

lib/tern.js:924–945  ·  view source on GitHub ↗
(srv, query, file, expr)

Source from the content-addressed store, hash-verified

922 }
923
924 function findTypeAtExpr(srv, query, file, expr) {
925 var exprName, exprType;
926 var type = findExprType(srv, query, file, expr), exprType = type;
927 if (query.preferFunction)
928 type = type.getFunctionType() || type.getType();
929 else
930 type = type.getType();
931
932 if (expr) {
933 if (expr.node.type == "Identifier")
934 exprName = expr.node.name;
935 else if (expr.node.type == "MemberExpression" && !expr.node.computed)
936 exprName = expr.node.property.name;
937 else if (expr.node.type == "MethodDefinition" && !expr.node.computed)
938 exprName = expr.node.key.name;
939 }
940
941 if (query.depth != null && typeof query.depth != "number")
942 throw ternError(".query.depth must be a number");
943
944 return [type, exprName, exprType];
945 }
946
947 function findTypeAt(srv, query, file) {
948 var type, exprName, exprType;

Callers 1

findTypeAtFunction · 0.85

Calls 2

findExprTypeFunction · 0.85
ternErrorFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…