classes-2-computed-method-name.ts 635 B

1234567891011121314
  1. // A method declared with a COMPUTED name (["run"]) but called through the plain static
  2. // name w.run(secret). Runtime: the method executes, ask#2 receives `use ${secret}`, and
  3. // its Node is returned to the sink. Probe: computed-name members are skipped by the
  4. // class-body registration — does the method still dispatch?
  5. // Expected: source -> ask#1, ask#1 -> ask#2 (param x), ask#2 -> sink.
  6. const secret = await agent("writer").ask<string>("secret");
  7. class Worker {
  8. ["run"](x: string): Node<string> {
  9. return agent("reader").ask<string>(`use ${x}`);
  10. }
  11. }
  12. const w = new Worker();
  13. const out = await w.run(secret);
  14. return out;