PageRenderTime 11ms CodeModel.GetById 2ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/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--
 15class 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
 22inherit
 23   LIBERTY_KNOWN_TYPE
 24      undefine is_equal
 25      end
 26
 27insert
 28   SINGLETON
 29      undefine out_in_tagged_out_memory
 30      end
 31
 32creation {LIBERTY_VOID}
 33   make
 34
 35feature {ANY}
 36   current_entity: LIBERTY_CURRENT is
 37      do
 38         check Result = Void end
 39      end
 40
 41   known_type: LIBERTY_VOID_TYPE is
 42      do
 43         Result := Current
 44      end
 45
 46   file: FIXED_STRING is
 47      once
 48         Result := "<Void>".intern
 49      end
 50
 51   name: FIXED_STRING is
 52      once
 53         Result := "{Void type}".intern
 54      end
 55
 56   hash_code: INTEGER is 20050814
 57
 58   is_obsolete: BOOLEAN is False
 59
 60   cluster: LIBERTY_CLUSTER is
 61      do
 62         check Result = Void end
 63      end
 64
 65   the_invariant: LIBERTY_INVARIANT is
 66      do
 67         check Result = Void end
 68      end
 69
 70   has_feature (a_feature_name: LIBERTY_FEATURE_NAME): BOOLEAN is
 71      do
 72         check not Result end
 73      end
 74
 75   feature_definition (a_feature_name: LIBERTY_FEATURE_NAME): LIBERTY_FEATURE_DEFINITION is
 76      do
 77         check False end
 78      end
 79
 80   is_conform_to (other: LIBERTY_KNOWN_TYPE): BOOLEAN is
 81      do
 82         Result := not other.is_expanded
 83      end
 84
 85   is_non_conformant_child_of (other: LIBERTY_KNOWN_TYPE): BOOLEAN is
 86      do
 87         check not Result end
 88      end
 89
 90   parameters: TRAVERSABLE[LIBERTY_TYPE] is
 91      once
 92         create {FAST_ARRAY[LIBERTY_TYPE]} Result.with_capacity(0)
 93      end
 94
 95   is_deferred: BOOLEAN is False
 96   is_expanded: BOOLEAN is False
 97   is_separate: BOOLEAN is False
 98   is_reference: BOOLEAN is False
 99   is_runtime_category_set: BOOLEAN is True
100
101   accept (visitor: LIBERTY_TYPE_VISITOR) is
102      do
103         visitor.visit_void(Current)
104      end
105
106   converts_to (target_type: LIBERTY_KNOWN_TYPE): BOOLEAN is
107      do
108         check not Result end
109      end
110
111   do_convert (target_type: LIBERTY_ACTUAL_TYPE; a_converter: LIBERTY_TYPE_CONVERTER) is
112      do
113         check False end
114      end
115
116feature {LIBERTY_KNOWN_TYPE}
117   full_name_in (buffer: STRING) is
118      do
119         buffer.append(once "NONE")
120      end
121
122   same_base_class_as (other: LIBERTY_ACTUAL_TYPE): BOOLEAN is
123      do
124         check not Result end
125      end
126
127feature {ANY}
128   debug_display (o: OUTPUT_STREAM; show_features: BOOLEAN) is
129      do
130         o.put_line(full_name)
131      end
132
133feature {LIBERTY_KNOWN_TYPE}
134   common_parent (other: LIBERTY_KNOWN_TYPE): LIBERTY_KNOWN_TYPE is
135      do
136         check False end
137      end
138
139feature {LIBERTY_TYPE_BUILDER}
140   has_no_parents: BOOLEAN is True
141
142feature {LIBERTY_UNIVERSE, LIBERTY_TYPE_BUILDER}
143   has_loaded_features: BOOLEAN is True
144
145feature {LIBERTY_REACHABLE, LIBERTY_REACHABLE_COLLECTION_MARKER}
146   mark_reachable_code (mark: like reachable_mark) is
147      do
148         if reachable_mark < mark then
149            reachable_mark := mark
150         end
151      end
152
153feature {LIBERTY_TYPE_LISTENER, LIBERTY_TYPE}
154   add_listener (a_listener: LIBERTY_TYPE_LISTENER) is
155      do
156         a_listener.on_type_known(Current)
157      end
158
159feature {}
160   make is
161      do
162         reachable_mark := 1
163         create result_entity.make(Current, errors.unknown_position)
164      ensure
165         is_reachable
166      end
167
168   errors: LIBERTY_ERRORS
169
170invariant
171   is_reachable
172
173end -- class LIBERTY_VOID_TYPE