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

http://github.com/tybor/Liberty · Specman e · 96 lines · 69 code · 12 blank · 15 comment · 2 complexity · abebb8e0881caabd01274a1351af060f 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_OPEN_ARGUMENT
  16. inherit
  17. LIBERTY_EXPRESSION
  18. redefine
  19. result_type_may_be_void, is_open_argument
  20. end
  21. create {LIBERTY_BUILDER_TOOLS}
  22. make
  23. create {LIBERTY_OPEN_ARGUMENT}
  24. make_specialized
  25. feature {ANY}
  26. result_type: LIBERTY_TYPE
  27. result_type_may_be_void: BOOLEAN is True
  28. is_open_argument: BOOLEAN is True
  29. specialized_in (a_type: LIBERTY_ACTUAL_TYPE): like Current is
  30. local
  31. r: like result_type
  32. do
  33. if result_type /= Void then
  34. r := result_type.specialized_in(a_type)
  35. end
  36. if r = result_type then
  37. Result := Current
  38. else
  39. create Result.make_specialized(r, position)
  40. end
  41. end
  42. feature {LIBERTY_BUILDER_TOOLS, LIBERTY_AGENT}
  43. set_result_type (a_result_type: like result_type) is
  44. require
  45. a_result_type /= Void
  46. do
  47. result_type := a_result_type
  48. ensure
  49. result_type = a_result_type
  50. end
  51. feature {LIBERTY_REACHABLE, LIBERTY_REACHABLE_COLLECTION_MARKER}
  52. mark_reachable_code (mark: INTEGER) is
  53. do
  54. -- nothing
  55. end
  56. feature {}
  57. make (a_position: like position) is
  58. require
  59. a_position /= Void
  60. do
  61. position := a_position
  62. ensure
  63. position = a_position
  64. end
  65. make_specialized (a_result_type: like result_type; a_position: like position) is
  66. require
  67. a_result_type /= Void
  68. a_position /= Void
  69. do
  70. result_type := a_result_type
  71. position := a_position
  72. ensure
  73. result_type = a_result_type
  74. position = a_position
  75. end
  76. feature {ANY}
  77. accept (v: VISITOR) is
  78. local
  79. v0: LIBERTY_OPEN_ARGUMENT_VISITOR
  80. do
  81. v0 ::= v
  82. v0.visit_liberty_open_argument(Current)
  83. end
  84. end