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

Function generatorResult

lib/infer.js:1860–1874  ·  view source on GitHub ↗
(input, output, async)

Source from the content-addressed store, hash-verified

1858 }
1859
1860 function generatorResult(input, output, async) {
1861 var defs = cx.definitions.ecmascript;
1862 var valObj = new Obj(true);
1863 valObj.defProp("done").addType(cx.bool);
1864 output.propagate(valObj.defProp("value"));
1865 var retObj = valObj;
1866 if (async && defs) {
1867 retObj = new Obj(defs["Promise.prototype"]);
1868 retObj.getType().propagate(new DefProp(':t', valObj));
1869 }
1870 var method = new Fn(null, ANull, input ? [input] : [], input ? ["?"] : [], retObj);
1871 var result = new Obj(defs ? async ? defs.async_generator_prototype : defs.generator_prototype : true);
1872 result.defProp("next").addType(method);
1873 return result;
1874 }
1875
1876 function maybeIterator(fn, output) {
1877 if (!fn.generator) return output;

Callers 1

maybeIteratorFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…