MCPcopy
hub / github.com/ternjs/tern / withWorklist

Function withWorklist

lib/infer.js:909–926  ·  view source on GitHub ↗
(f)

Source from the content-addressed store, hash-verified

907
908 var baseMaxWorkDepth = 20, reduceMaxWorkDepth = 0.0001;
909 function withWorklist(f) {
910 if (cx.workList) return f(cx.workList);
911
912 var list = [], depth = 0;
913 var add = cx.workList = function(type, target, weight) {
914 if (depth < baseMaxWorkDepth - reduceMaxWorkDepth * list.length)
915 list.push(type, target, weight, depth);
916 };
917 var ret = f(add);
918 for (var i = 0; i < list.length; i += 4) {
919 if (timeout && +new Date >= timeout)
920 throw new exports.TimedOut();
921 depth = list[i + 3] + 1;
922 list[i + 1].addType(list[i], list[i + 2]);
923 }
924 cx.workList = null;
925 return ret;
926 }
927
928 function withSuper(ctor, obj, f) {
929 var oldCtor = cx.curSuperCtor, oldObj = cx.curSuper;

Callers 1

infer.jsFile · 0.85

Calls 1

fFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…