/src/tools/semantics/types/impl/liberty_void_type.e

http://github.com/tybor/Liberty · Specman e · 173 lines · 122 code · 32 blank · 19 comment · 1 complexity · 94395982c7496242457c41779502b091 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_VOID_TYPE
  16. --
  17. -- The type of a 'Void' expression unless or before its precise type can be determined.
  18. --
  19. -- In other words: good old NONE.
  20. --
  21. inherit
  22. LIBERTY_KNOWN_TYPE
  23. undefine is_equal
  24. end
  25. insert
  26. SINGLETON
  27. undefine out_in_tagged_out_memory
  28. end
  29. creation {LIBERTY_VOID}
  30. make
  31. feature {ANY}
  32. current_entity: LIBERTY_CURRENT is
  33. do
  34. check Result = Void end
  35. end
  36. known_type: LIBERTY_VOID_TYPE is
  37. do
  38. Result := Current
  39. end
  40. file: FIXED_STRING is
  41. once
  42. Result := "<Void>".intern
  43. end
  44. name: FIXED_STRING is
  45. once
  46. Result := "{Void type}".intern
  47. end
  48. hash_code: INTEGER is 20050814
  49. is_obsolete: BOOLEAN is False
  50. cluster: LIBERTY_CLUSTER is
  51. do
  52. check Result = Void end
  53. end
  54. the_invariant: LIBERTY_INVARIANT is
  55. do
  56. check Result = Void end
  57. end
  58. has_feature (a_feature_name: LIBERTY_FEATURE_NAME): BOOLEAN is
  59. do
  60. check not Result end
  61. end
  62. feature_definition (a_feature_name: LIBERTY_FEATURE_NAME): LIBERTY_FEATURE_DEFINITION is
  63. do
  64. check False end
  65. end
  66. is_conform_to (other: LIBERTY_KNOWN_TYPE): BOOLEAN is
  67. do
  68. Result := not other.is_expanded
  69. end
  70. is_non_conformant_child_of (other: LIBERTY_KNOWN_TYPE): BOOLEAN is
  71. do
  72. check not Result end
  73. end
  74. parameters: TRAVERSABLE[LIBERTY_TYPE] is
  75. once
  76. create {FAST_ARRAY[LIBERTY_TYPE]} Result.with_capacity(0)
  77. end
  78. is_deferred: BOOLEAN is False
  79. is_expanded: BOOLEAN is False
  80. is_separate: BOOLEAN is False
  81. is_reference: BOOLEAN is False
  82. is_runtime_category_set: BOOLEAN is True
  83. accept (visitor: LIBERTY_TYPE_VISITOR) is
  84. do
  85. visitor.visit_void(Current)
  86. end
  87. converts_to (target_type: LIBERTY_KNOWN_TYPE): BOOLEAN is
  88. do
  89. check not Result end
  90. end
  91. do_convert (target_type: LIBERTY_ACTUAL_TYPE; a_converter: LIBERTY_TYPE_CONVERTER) is
  92. do
  93. check False end
  94. end
  95. feature {LIBERTY_KNOWN_TYPE}
  96. full_name_in (buffer: STRING) is
  97. do
  98. buffer.append(once "NONE")
  99. end
  100. same_base_class_as (other: LIBERTY_ACTUAL_TYPE): BOOLEAN is
  101. do
  102. check not Result end
  103. end
  104. feature {ANY}
  105. debug_display (o: OUTPUT_STREAM; show_features: BOOLEAN) is
  106. do
  107. o.put_line(full_name)
  108. end
  109. feature {LIBERTY_KNOWN_TYPE}
  110. common_parent (other: LIBERTY_KNOWN_TYPE): LIBERTY_KNOWN_TYPE is
  111. do
  112. check False end
  113. end
  114. feature {LIBERTY_TYPE_BUILDER}
  115. has_no_parents: BOOLEAN is True
  116. feature {LIBERTY_UNIVERSE, LIBERTY_TYPE_BUILDER}
  117. has_loaded_features: BOOLEAN is True
  118. feature {LIBERTY_REACHABLE, LIBERTY_REACHABLE_COLLECTION_MARKER}
  119. mark_reachable_code (mark: like reachable_mark) is
  120. do
  121. if reachable_mark < mark then
  122. reachable_mark := mark
  123. end
  124. end
  125. feature {LIBERTY_TYPE_LISTENER, LIBERTY_TYPE}
  126. add_listener (a_listener: LIBERTY_TYPE_LISTENER) is
  127. do
  128. a_listener.on_type_known(Current)
  129. end
  130. feature {}
  131. make is
  132. do
  133. reachable_mark := 1
  134. create result_entity.make(Current, errors.unknown_position)
  135. ensure
  136. is_reachable
  137. end
  138. errors: LIBERTY_ERRORS
  139. invariant
  140. is_reachable
  141. end -- class LIBERTY_VOID_TYPE