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

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