/src/tools/semantics/code/expressions/liberty_entity_expression.e

http://github.com/tybor/Liberty · Specman e · 75 lines · 49 code · 10 blank · 16 comment · 1 complexity · 9d4eec9691ca53033c96a8e9f11b087c 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_ENTITY_EXPRESSION
  16. -- expressions like "entity"
  17. inherit
  18. LIBERTY_EXPRESSION
  19. create {LIBERTY_BUILDER_TOOLS, LIBERTY_ENTITY_EXPRESSION}
  20. make
  21. feature {ANY}
  22. entity: LIBERTY_ENTITY
  23. result_type: LIBERTY_TYPE is
  24. do
  25. Result := entity.result_type
  26. end
  27. specialized_in (a_type: LIBERTY_ACTUAL_TYPE): like Current is
  28. local
  29. e: like entity
  30. do
  31. e := entity.specialized_in(a_type)
  32. if e = entity then
  33. Result := Current
  34. else
  35. create Result.make(e, position)
  36. end
  37. end
  38. feature {LIBERTY_REACHABLE, LIBERTY_REACHABLE_COLLECTION_MARKER}
  39. mark_reachable_code (mark: INTEGER) is
  40. do
  41. -- nothing
  42. end
  43. feature {}
  44. make (a_entity: like entity; a_position: like position) is
  45. require
  46. a_entity.result_type /= Void
  47. a_position /= Void
  48. do
  49. entity := a_entity
  50. position := a_position
  51. ensure
  52. entity = a_entity
  53. position = a_position
  54. end
  55. feature {ANY}
  56. accept (v: VISITOR) is
  57. local
  58. v0: LIBERTY_ENTITY_EXPRESSION_VISITOR
  59. do
  60. v0 ::= v
  61. v0.visit_liberty_entity_expression(Current)
  62. end
  63. invariant
  64. entity /= Void
  65. end