/src/tools/semantics/code/assertions/liberty_written_assertions.e

http://github.com/tybor/Liberty · Specman e · 75 lines · 53 code · 8 blank · 14 comment · 3 complexity · ef131b4daf71416f90a5f2dbbab5034c MD5 · raw file

  1. -- This file is part of Liberty Eiffel.
  2. --
  3. -- Liberty Eiffel is free software: you can redistribute it and/or modify
  4. -- it under the terms of the GNU General Public License as published by
  5. -- the Free Software Foundation, version 3 of the License.
  6. --
  7. -- Liberty Eiffel is distributed in the hope that it will be useful,
  8. -- but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. -- GNU General Public License for more details.
  11. --
  12. -- You should have received a copy of the GNU General Public License
  13. -- along with Liberty Eiffel. If not, see <http://www.gnu.org/licenses/>.
  14. --
  15. deferred class LIBERTY_WRITTEN_ASSERTIONS
  16. inherit
  17. LIBERTY_ASSERTIONS
  18. feature {ANY}
  19. assertions: TRAVERSABLE[LIBERTY_ASSERTION] is
  20. do
  21. Result := assertions_list
  22. end
  23. feature {LIBERTY_FEATURE, LIBERTY_ASSERTIONS}
  24. specialized_in (a_type: LIBERTY_ACTUAL_TYPE): like Current is
  25. local
  26. al: like assertions_list
  27. a: LIBERTY_ASSERTION
  28. i: INTEGER
  29. do
  30. from
  31. al := assertions_list
  32. i := al.lower
  33. until
  34. i > al.upper
  35. loop
  36. a := al.item(i).specialized_in(a_type)
  37. if a /= al.item(i) then
  38. if al = assertions_list then
  39. al := assertions_list.twin
  40. end
  41. al.put(a, i)
  42. end
  43. i := i + 1
  44. end
  45. if al = assertions_list then
  46. Result := Current
  47. else
  48. Result := specialized(al)
  49. end
  50. end
  51. feature {}
  52. specialized (a_assertions: like assertions_list): like Current is
  53. deferred
  54. ensure
  55. Result /= Current
  56. Result.assertions_list = a_assertions
  57. end
  58. feature {LIBERTY_REACHABLE, LIBERTY_REACHABLE_COLLECTION_MARKER}
  59. mark_reachable_code (mark: INTEGER) is
  60. do
  61. assertions_marker.mark_reachable_code(mark, assertions)
  62. end
  63. feature {LIBERTY_WRITTEN_ASSERTIONS}
  64. assertions_list: COLLECTION[LIBERTY_ASSERTION]
  65. invariant
  66. assertions /= Void
  67. end