MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / withWorklist

Function withWorklist

lib/web/tern/infer.js:895–912  ·  view source on GitHub ↗
(f)

Source from the content-addressed store, hash-verified

893
894 var baseMaxWorkDepth = 20, reduceMaxWorkDepth = 0.0001;
895 function withWorklist(f) {
896 if (cx.workList) return f(cx.workList);
897
898 var list = [], depth = 0;
899 var add = cx.workList = function(type, target, weight) {
900 if (depth < baseMaxWorkDepth - reduceMaxWorkDepth * list.length)
901 list.push(type, target, weight, depth);
902 };
903 var ret = f(add);
904 for (var i = 0; i < list.length; i += 4) {
905 if (timeout && +new Date >= timeout)
906 throw new exports.TimedOut();
907 depth = list[i + 3] + 1;
908 list[i + 1].addType(list[i], list[i + 2]);
909 }
910 cx.workList = null;
911 return ret;
912 }
913
914 function withSuper(ctor, obj, f) {
915 var oldCtor = cx.curSuperCtor, oldObj = cx.curSuper

Callers 1

infer.jsFile · 0.85

Calls 2

fFunction · 0.50
pushMethod · 0.45

Tested by

no test coverage detected