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

http://github.com/tybor/Liberty · Specman e · 104 lines · 76 code · 14 blank · 14 comment · 1 complexity · 2130c6a65827b60a1861dbf18ed197bc 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. deferred class LIBERTY_PREFIX_CALL
  16. inherit
  17. LIBERTY_EXPRESSION
  18. insert
  19. LIBERTY_CALL
  20. feature {ANY}
  21. target: LIBERTY_EXPRESSION
  22. entity: LIBERTY_FEATURE_ENTITY
  23. result_type: LIBERTY_TYPE is
  24. do
  25. Result := entity.result_type
  26. end
  27. feature {LIBERTY_REACHABLE, LIBERTY_REACHABLE_COLLECTION_MARKER}
  28. mark_reachable_code (mark: INTEGER) is
  29. do
  30. target.mark_reachable_code(mark)
  31. entity.mark_reachable_code(mark)
  32. end
  33. feature {}
  34. make (a_target: like target; a_entity_builder: FUNCTION[TUPLE[LIBERTY_TYPE, LIBERTY_FEATURE_NAME], LIBERTY_FEATURE_ENTITY]; a_position: like position) is
  35. require
  36. a_target /= Void
  37. a_entity_builder /= Void
  38. a_position /= Void
  39. do
  40. create prefix_name.make_prefix(the_prefix_name, a_position)
  41. target := a_target
  42. entity := a_entity_builder.item([a_target.result_type, prefix_name])
  43. position := a_position
  44. register_for_promotion
  45. ensure
  46. position = a_position
  47. end
  48. new (a_target: like target; a_entity: like entity; a_actuals: like actuals_list; a_position: like position) is
  49. require
  50. a_target /= Void
  51. a_actuals.is_empty
  52. a_position /= Void
  53. do
  54. check a_actuals = actuals_list end
  55. target := a_target
  56. entity := a_entity
  57. position := a_position
  58. ensure
  59. target = a_target or else {LIBERTY_CAST_EXPRESSION} ?:= target
  60. entity = a_entity
  61. actuals_list = a_actuals
  62. position = a_position
  63. end
  64. prefix_name: LIBERTY_FEATURE_NAME is
  65. attribute
  66. ensure
  67. Result.is_prefix
  68. end
  69. the_prefix_name: FIXED_STRING is
  70. deferred
  71. ensure
  72. Result /= Void
  73. end
  74. actuals_list: COLLECTION[LIBERTY_EXPRESSION] is
  75. once
  76. create {FAST_ARRAY[LIBERTY_EXPRESSION]} Result.with_capacity(0)
  77. end
  78. feature {LIBERTY_CALL_PROMOTION}
  79. set_entity (a_entity: like entity) is
  80. do
  81. entity := a_entity
  82. end
  83. set_target (a_target: like target) is
  84. do
  85. target := a_target
  86. end
  87. invariant
  88. actuals.is_empty
  89. not is_implicit_current
  90. end