/src/tools/semantics/code/liberty_assertion.e

http://github.com/tybor/Liberty · Specman e · 58 lines · 37 code · 7 blank · 14 comment · 1 complexity · 296f92db9fb125ad26fce7a1d5688117 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. class LIBERTY_ASSERTION
  16. insert
  17. LIBERTY_REACHABLE
  18. create {LIBERTY_BUILDER_TOOLS, LIBERTY_ASSERTION}
  19. make
  20. feature {ANY}
  21. tag: FIXED_STRING
  22. assertion: LIBERTY_EXPRESSION
  23. feature {LIBERTY_REACHABLE, LIBERTY_REACHABLE_COLLECTION_MARKER}
  24. mark_reachable_code (mark: INTEGER) is
  25. do
  26. assertion.mark_reachable_code(mark)
  27. end
  28. feature {LIBERTY_ASSERTIONS}
  29. specialized_in (a_type: LIBERTY_ACTUAL_TYPE): like Current is
  30. require
  31. a_type /= Void
  32. local
  33. a: like assertion
  34. do
  35. a := assertion.specialized_in(a_type)
  36. if a = assertion then
  37. Result := Current
  38. else
  39. create Result.make(tag, a)
  40. end
  41. end
  42. feature {}
  43. make (a_tag: like tag; a_assertion: like assertion) is
  44. do
  45. tag := a_tag
  46. assertion := a_assertion
  47. ensure
  48. tag = a_tag
  49. assertion = a_assertion
  50. end
  51. end