/src/tools/semantics/code/instructions/liberty_condition.e

http://github.com/tybor/Liberty · Specman e · 79 lines · 55 code · 10 blank · 14 comment · 1 complexity · ca61bb4d2bfd498e08a3bc4a5c80dc0b 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_CONDITION
  16. insert
  17. LIBERTY_POSITIONABLE
  18. LIBERTY_REACHABLE
  19. create {LIBERTY_BUILDER_TOOLS, LIBERTY_CONDITION}
  20. make
  21. feature {ANY}
  22. expression: LIBERTY_EXPRESSION
  23. instruction: LIBERTY_INSTRUCTION
  24. feature {LIBERTY_CONDITIONAL}
  25. specialized_in (a_type: LIBERTY_ACTUAL_TYPE): like Current is
  26. local
  27. e: like expression
  28. i: like instruction
  29. do
  30. e := expression.specialized_in(a_type)
  31. i := instruction.specialized_in(a_type)
  32. if e = expression and then i = instruction then
  33. Result := Current
  34. else
  35. create Result.make(e, i, position)
  36. end
  37. end
  38. feature {LIBERTY_REACHABLE, LIBERTY_REACHABLE_COLLECTION_MARKER}
  39. mark_reachable_code (mark: INTEGER) is
  40. do
  41. expression.mark_reachable_code(mark)
  42. instruction.mark_reachable_code(mark)
  43. end
  44. feature {}
  45. make (a_expression: like expression; a_instruction: like instruction; a_position: like position) is
  46. require
  47. a_expression /= Void
  48. a_instruction /= Void
  49. a_position /= Void
  50. do
  51. expression := a_expression
  52. instruction := a_instruction
  53. position := a_position
  54. ensure
  55. expression = a_expression
  56. instruction = a_instruction
  57. position = a_position
  58. end
  59. feature {ANY}
  60. accept (v: VISITOR) is
  61. local
  62. v0: LIBERTY_CONDITION_VISITOR
  63. do
  64. v0 ::= v
  65. v0.visit_liberty_condition(Current)
  66. end
  67. invariant
  68. expression /= Void
  69. end