/runtime/typeinfo/ti_assocarray.d

http://github.com/wilkie/djehuty · D · 40 lines · 23 code · 10 blank · 7 comment · 2 complexity · b8abe71a6252a80d0fb46e993c5a7a2b MD5 · raw file

  1. /*
  2. * ti_associativearray.d
  3. *
  4. * This module implements the TypeInfo for associative arrays.
  5. *
  6. */
  7. class TypeInfo_AssociativeArray : TypeInfo {
  8. char[] toString() {
  9. return value.toString() ~ "[" ~ key.toString() ~ "]";
  10. }
  11. int opEquals(Object o) {
  12. TypeInfo_AssociativeArray c;
  13. return this is o ||
  14. ((c = cast(TypeInfo_AssociativeArray)o) !is null &&
  15. this.key == c.key &&
  16. this.value == c.value);
  17. }
  18. // BUG: need to add the rest of the functions
  19. size_t tsize() {
  20. return (char[int]).sizeof;
  21. }
  22. TypeInfo next() {
  23. return value;
  24. }
  25. uint flags() {
  26. return 1;
  27. }
  28. TypeInfo value;
  29. TypeInfo key;
  30. }