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

http://github.com/tybor/Liberty · Specman e · 85 lines · 60 code · 11 blank · 14 comment · 2 complexity · eb2483592fc3f5db5661ed7c796390c3 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_PARAMETER
  16. inherit
  17. LIBERTY_ENTITY
  18. redefine out_in_tagged_out_memory
  19. end
  20. create {LIBERTY_BUILDER_TOOLS, LIBERTY_PARAMETER}
  21. make
  22. feature {ANY}
  23. name: FIXED_STRING
  24. result_type: LIBERTY_TYPE
  25. out_in_tagged_out_memory is
  26. do
  27. tagged_out_memory.append(once "parameter: ")
  28. tagged_out_memory.append(name)
  29. end
  30. specialized_in (a_type: LIBERTY_ACTUAL_TYPE): like Current is
  31. local
  32. r: like result_type
  33. do
  34. r := result_type.specialized_in(a_type)
  35. if r = result_type then
  36. Result := Current
  37. else
  38. create Result.make(name, r, position)
  39. end
  40. end
  41. feature {LIBERTY_REACHABLE, LIBERTY_REACHABLE_COLLECTION_MARKER}
  42. mark_reachable_code (mark: INTEGER) is
  43. do
  44. if result_type.is_known and then result_type.known_type.is_runtime_category_set and then result_type.known_type.is_expanded then
  45. result_type.mark_reachable_code(mark)
  46. end
  47. end
  48. feature {}
  49. make (a_name: FIXED_STRING; a_result_type: like result_type; a_position: like position) is
  50. require
  51. a_name /= Void
  52. a_result_type /= Void
  53. a_position /= Void
  54. do
  55. name := a_name
  56. result_type := a_result_type
  57. position := a_position
  58. ensure
  59. name = a_name
  60. result_type = a_result_type
  61. position = a_position
  62. end
  63. feature {ANY}
  64. accept (v: VISITOR) is
  65. local
  66. v0: LIBERTY_PARAMETER_VISITOR
  67. do
  68. v0 ::= v
  69. v0.visit_liberty_parameter(Current)
  70. end
  71. invariant
  72. name /= Void
  73. result_type /= Void
  74. end