2
0

seenat-methods.azsl 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. int f(int);
  2. int _(int);
  3. interface Parent
  4. {
  5. int f(int); // decl
  6. };
  7. class Child : Parent
  8. {
  9. int f(int) override // should be understood as part of the family of Parent::f. but can't be a seenat since 2 separate symbols
  10. { }
  11. int g()
  12. {
  13. f(2); // ref to Child::f
  14. // [note: should resolve to Parent::f if we hadn't the obligation to implement f.
  15. // this is called "dominance in inheritance" and has major implications for SymbolManager::LookupSymbol]
  16. ::f(3); // resolves to the global one
  17. _(f(1)); // ref 2 in the parameter list
  18. int a = 5 + f(0); // ref 3. from an expression
  19. _(5 + Child::f(0)); // ref 4. qualified in an expression in a parameter list.
  20. }
  21. };
  22. Child getchild() { Child c; return c; }
  23. int4 psmain(): SV_Target0
  24. {
  25. Child c;
  26. int i = c.f(1); // ref 5. direct member call
  27. getchild().f(2); // ref 6. call through (abstract-machine) unnamed temporary
  28. int j = f(0); // fake ref (is ::f)
  29. int j2 = ::f(0); // fake ref
  30. return int4(c.f(0), i, 0, 1); // ref 7. in constructor expression
  31. }
  32. // WARNING: be careful in these files, any change will disrupt line and column numbers as checked by the seenat.py test