/src/tools/semantics/code/entities/liberty_result.e

http://github.com/tybor/Liberty · Specman e · 76 lines · 51 code · 11 blank · 14 comment · 1 complexity · e0127f053f3b45c6ef747dc30feaac17 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_RESULT
  16. inherit
  17. LIBERTY_WRITABLE
  18. redefine out_in_tagged_out_memory
  19. end
  20. create {LIBERTY_TYPE}
  21. make
  22. feature {ANY}
  23. name: FIXED_STRING is
  24. once
  25. Result := "Result".intern
  26. end
  27. result_type: LIBERTY_TYPE
  28. out_in_tagged_out_memory is
  29. do
  30. tagged_out_memory.append(name)
  31. end
  32. specialized_in (a_type: LIBERTY_ACTUAL_TYPE): like Current is
  33. do
  34. Result := result_type.specialized_in(a_type).result_entity
  35. end
  36. feature {LIBERTY_REACHABLE, LIBERTY_REACHABLE_COLLECTION_MARKER}
  37. mark_reachable_code (mark: INTEGER) is
  38. do
  39. if result_type.is_known and then result_type.known_type.is_runtime_category_set and then result_type.known_type.is_expanded then
  40. result_type.mark_reachable_code(mark)
  41. end
  42. end
  43. feature {}
  44. make (a_result_type: like result_type; a_position: like position) is
  45. require
  46. a_result_type /= Void
  47. a_position /= Void
  48. do
  49. result_type := a_result_type
  50. position := a_position
  51. ensure
  52. result_type = a_result_type
  53. position = a_position
  54. end
  55. feature {ANY}
  56. accept (v: VISITOR) is
  57. local
  58. v0: LIBERTY_RESULT_VISITOR
  59. do
  60. v0 ::= v
  61. v0.visit_liberty_result(Current)
  62. end
  63. invariant
  64. result_type /= Void
  65. end