async-promise-for-await-of.ts 525 B

12345678910
  1. // for await...of over an array of Nodes: the loop variable is the awaited element.
  2. // The body reaches no facade site, so no fan-out node is promoted, but element
  3. // taint must still flow into `parts` and on to the merger.
  4. // Expected: ask#1 -> ask#3; ask#2 -> ask#3; ask#3 -> sink; NO fan-out node.
  5. const nodes = [agent("alpha").ask<string>("a"), agent("beta").ask<string>("b")];
  6. const parts: string[] = [];
  7. for await (const t of nodes) {
  8. parts.push(t);
  9. }
  10. return agent("merger").ask<string>(`merge ${parts.join(", ")}`);