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

http://github.com/tybor/Liberty · Specman e · 105 lines · 79 code · 12 blank · 14 comment · 3 complexity · 18473a78c5f5abacfb594385ddfb78b7 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_CALL_INSTRUCTION
  16. inherit
  17. LIBERTY_INSTRUCTION
  18. LIBERTY_CALL
  19. create {LIBERTY_BUILDER_TOOLS, LIBERTY_CALL_INSTRUCTION}
  20. make, implicit_current
  21. feature {ANY}
  22. target: LIBERTY_EXPRESSION
  23. entity: LIBERTY_FEATURE_ENTITY
  24. feature {LIBERTY_REACHABLE, LIBERTY_REACHABLE_COLLECTION_MARKER}
  25. mark_reachable_code (mark: INTEGER) is
  26. do
  27. if target /= Void then
  28. target.mark_reachable_code(mark)
  29. end
  30. entity.mark_reachable_code(mark)
  31. expressions_marker.mark_reachable_code(mark, actuals)
  32. end
  33. feature {}
  34. make (a_target: like target; a_entity: like entity; a_actuals: like actuals_list; a_position: like position) is
  35. require
  36. a_target /= Void
  37. a_entity /= Void
  38. a_actuals /= Void
  39. a_position /= Void
  40. do
  41. target := a_target
  42. entity := a_entity
  43. actuals_list := a_actuals
  44. position := a_position
  45. register_for_promotion
  46. ensure
  47. target = a_target or else {LIBERTY_CAST_EXPRESSION} ?:= target
  48. entity = a_entity
  49. actuals_list = a_actuals
  50. position = a_position
  51. end
  52. implicit_current (a_entity: like entity; a_actuals: like actuals_list; a_position: like position) is
  53. require
  54. a_entity /= Void
  55. a_actuals /= Void
  56. a_position /= Void
  57. do
  58. entity := a_entity
  59. actuals_list := a_actuals
  60. position := a_position
  61. ensure
  62. is_implicit_current
  63. entity = a_entity
  64. actuals_list = a_actuals
  65. position = a_position
  66. end
  67. actuals_list: COLLECTION[LIBERTY_EXPRESSION]
  68. make_new (a_target: like target; a_entity: like entity; a_actuals: like actuals_list; a_position: like position): like Current is
  69. do
  70. if a_target = Void then
  71. create Result.implicit_current(a_entity, a_actuals, a_position)
  72. else
  73. create Result.make(a_target, a_entity, a_actuals, a_position)
  74. end
  75. end
  76. feature {LIBERTY_CALL_PROMOTION}
  77. set_entity (a_entity: like entity) is
  78. do
  79. entity := a_entity
  80. end
  81. set_target (a_target: like target) is
  82. do
  83. target := a_target
  84. end
  85. feature {ANY}
  86. accept (v: VISITOR) is
  87. local
  88. v0: LIBERTY_CALL_INSTRUCTION_VISITOR
  89. do
  90. v0 ::= v
  91. v0.visit_liberty_call_instruction(Current)
  92. end
  93. end