emission-graph-computed-method-name-obj.ts 734 B

12345678910111213
  1. // A facade ask in a COMPUTED METHOD NAME of an object literal (`{ [<ask>]() {…} }`). Runtime:
  2. // ask#1's output (s) is interpolated into ask#2's instructions (the method-name expression), so
  3. // ask#1 -> ask#2 is a required may-flow edge and ask#2 runs on the "namer" lane; the resulting
  4. // name becomes a KEY of `o`, so ask#2 -> ask#3 via `Object.keys(o)` ("strings launder nothing").
  5. // If the evaluator skips computed method/accessor names, ask#2 loses its sinks and `o` never
  6. // carries the key taint.
  7. const s = await agent("keeper").ask<string>("secret");
  8. const o = {
  9. [await agent("namer").ask<string>(`method name for ${s}`)]() {
  10. return 1;
  11. },
  12. };
  13. return agent("final").ask<string>(`built ${Object.keys(o).join(",")}`);