depend_scope.ncd 734 B

12345678910111213141516171819202122232425262728293031
  1. process main {
  2. depend_scope() scope;
  3. var("0") x;
  4. process_manager() mgr;
  5. var("false") backtrack_check;
  6. backtrack_point() point;
  7. If (backtrack_check) {
  8. val_equal(x, "2") a; # must not have rebound temporarily to A during backtracking
  9. assert(a);
  10. exit("0");
  11. };
  12. scope->provide("A");
  13. mgr->start("t1", "t1", {});
  14. val_equal(x, "1") a; # must have bound to A immediately
  15. assert(a);
  16. scope->provide("B") mgr;
  17. val_equal(x, "2") a; # must have rebound to B immediately
  18. assert(a);
  19. backtrack_check->set("true");
  20. point->go();
  21. }
  22. template t1 {
  23. _caller.scope->depend({"B", "A"}) dep;
  24. num_add(dep.x, "1") new_x;
  25. dep.x->set(new_x);
  26. }