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

Function getTypeOfExpression

test/fixtures/snapshot/typescript.js:79780–79802  ·  view source on GitHub ↗

* Returns the type of an expression. Unlike checkExpression, this function is simply concerned * with computing the type and may not fully check all contained sub-expressions for errors.

(node)

Source from the content-addressed store, hash-verified

79778 * with computing the type and may not fully check all contained sub-expressions for errors.
79779 */
79780 function getTypeOfExpression(node) {
79781 // Don't bother caching types that require no flow analysis and are quick to compute.
79782 var quickType = getQuickTypeOfExpression(node);
79783 if (quickType) {
79784 return quickType;
79785 }
79786 // If a type has been cached for the node, return it.
79787 if (node.flags & 134217728 /* NodeFlags.TypeCached */ && flowTypeCache) {
79788 var cachedType = flowTypeCache[getNodeId(node)];
79789 if (cachedType) {
79790 return cachedType;
79791 }
79792 }
79793 var startInvocationCount = flowInvocationCount;
79794 var type = checkExpression(node);
79795 // If control flow analysis was required to determine the type, it is worth caching.
79796 if (flowInvocationCount !== startInvocationCount) {
79797 var cache = flowTypeCache || (flowTypeCache = []);
79798 cache[getNodeId(node)] = type;
79799 ts.setNodeFlags(node, node.flags | 134217728 /* NodeFlags.TypeCached */);
79800 }
79801 return type;
79802 }
79803 function getQuickTypeOfExpression(node) {
79804 var expr = ts.skipParentheses(node, /*excludeJSDocTypeAssertions*/ true);
79805 if (ts.isJSDocTypeAssertion(expr)) {

Calls 3

getQuickTypeOfExpressionFunction · 0.85
getNodeIdFunction · 0.85
checkExpressionFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…