MCPcopy Create free account
hub / github.com/nodejs/node / combineUsages

Function combineUsages

test/fixtures/snapshot/typescript.js:156921–156951  ·  view source on GitHub ↗
(usages)

Source from the content-addressed store, hash-verified

156919 };
156920 }
156921 function combineUsages(usages) {
156922 var combinedProperties = new ts.Map();
156923 for (var _i = 0, usages_1 = usages; _i < usages_1.length; _i++) {
156924 var u = usages_1[_i];
156925 if (u.properties) {
156926 u.properties.forEach(function (p, name) {
156927 if (!combinedProperties.has(name)) {
156928 combinedProperties.set(name, []);
156929 }
156930 combinedProperties.get(name).push(p);
156931 });
156932 }
156933 }
156934 var properties = new ts.Map();
156935 combinedProperties.forEach(function (ps, name) {
156936 properties.set(name, combineUsages(ps));
156937 });
156938 return {
156939 isNumber: usages.some(function (u) { return u.isNumber; }),
156940 isString: usages.some(function (u) { return u.isString; }),
156941 isNumberOrString: usages.some(function (u) { return u.isNumberOrString; }),
156942 candidateTypes: ts.flatMap(usages, function (u) { return u.candidateTypes; }),
156943 properties: properties,
156944 calls: ts.flatMap(usages, function (u) { return u.calls; }),
156945 constructs: ts.flatMap(usages, function (u) { return u.constructs; }),
156946 numberIndex: ts.forEach(usages, function (u) { return u.numberIndex; }),
156947 stringIndex: ts.forEach(usages, function (u) { return u.stringIndex; }),
156948 candidateThisTypes: ts.flatMap(usages, function (u) { return u.candidateThisTypes; }),
156949 inferredTypes: undefined, // clear type cache
156950 };
156951 }
156952 function single() {
156953 return combineTypes(inferTypesFromReferencesSingle(references));
156954 }

Callers 1

getSignatureFromCallsFunction · 0.85

Calls 7

someMethod · 0.80
flatMapMethod · 0.80
forEachMethod · 0.65
hasMethod · 0.65
getMethod · 0.65
setMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected