hole-in-for-of.ts 878 B

1234567891011121314151617
  1. // A hole inside a for...of body. The interpreter reads for...of as an iteration candidate, and
  2. // the hole is a facade site, so the candidate promotes to a fan-out and the hole is issued
  3. // inside its region (`within=fan-out#1`) — the per-element semantics for...of always gets.
  4. // That is not the 9012 case: only an ARRAY-METHOD callback rejects a hole, because its
  5. // elements run concurrently; a for...of with await is sequential, so the first round parks
  6. // at the hole, the fill arrives, and every later round runs the body with its own bindings.
  7. interface Fix {
  8. patch: string;
  9. }
  10. const paths = await files.glob("src/**/*.ts");
  11. const fixes: string[] = [];
  12. for (const path of paths) {
  13. const note = await agent(`审查-${path}`).ask<string>(`审查 ${path}`);
  14. const fix = await hole<Fix>("决定修法", `${path}:${note}`);
  15. fixes.push(fix.patch);
  16. }
  17. return fixes;