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

http://github.com/tybor/Liberty · Specman e · 99 lines · 67 code · 13 blank · 19 comment · 2 complexity · 9aa633645adb40e03e8a3ae7593509fc 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_WRITABLE_FEATURE
  16. --
  17. -- A proxy to the feature itself, which must be an attribute.
  18. --
  19. -- See also LIBERTY_FEATURE_ENTITY
  20. --
  21. inherit
  22. LIBERTY_WRITABLE
  23. redefine out_in_tagged_out_memory
  24. end
  25. create {LIBERTY_BUILDER_TOOLS, LIBERTY_WRITABLE_FEATURE}
  26. make
  27. feature {ANY}
  28. name: FIXED_STRING is
  29. do
  30. Result := entity.name
  31. end
  32. feature_name: LIBERTY_FEATURE_NAME is
  33. do
  34. Result := entity.feature_name
  35. end
  36. result_type: LIBERTY_TYPE is
  37. do
  38. Result := entity.result_type
  39. end
  40. out_in_tagged_out_memory is
  41. do
  42. tagged_out_memory.append(once "writable feature: ")
  43. tagged_out_memory.append(name)
  44. end
  45. specialized_in (a_type: LIBERTY_ACTUAL_TYPE): like Current is
  46. local
  47. e: like entity
  48. do
  49. e := entity.specialized_in(a_type)
  50. if e = entity then
  51. Result := Current
  52. else
  53. create Result.make(e, position)
  54. end
  55. end
  56. feature {LIBERTY_REACHABLE, LIBERTY_REACHABLE_COLLECTION_MARKER}
  57. mark_reachable_code (mark: INTEGER) is
  58. do
  59. if result_type.is_known and then result_type.known_type.is_runtime_category_set and then result_type.known_type.is_expanded then
  60. result_type.mark_reachable_code(mark)
  61. end
  62. end
  63. feature {}
  64. entity: LIBERTY_FEATURE_ENTITY
  65. make (a_entity: like entity; a_position: like position) is
  66. require
  67. a_entity /= Void
  68. a_position /= Void
  69. do
  70. entity := a_entity
  71. position := a_position
  72. ensure
  73. entity = a_entity
  74. position = a_position
  75. end
  76. feature {ANY}
  77. accept (v: VISITOR) is
  78. local
  79. v0: LIBERTY_WRITABLE_FEATURE_VISITOR
  80. do
  81. v0 ::= v
  82. v0.visit_liberty_writable_feature(Current)
  83. end
  84. invariant
  85. entity /= Void
  86. end