PageRenderTime 16ms CodeModel.GetById 14ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

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

http://github.com/tybor/Liberty
Specman e | 99 lines | 67 code | 13 blank | 19 comment | 2 complexity | 9aa633645adb40e03e8a3ae7593509fc 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_WRITABLE_FEATURE
16--
17-- A proxy to the feature itself, which must be an attribute.
18--
19-- See also LIBERTY_FEATURE_ENTITY
20--
21
22inherit
23   LIBERTY_WRITABLE
24      redefine out_in_tagged_out_memory
25      end
26
27create {LIBERTY_BUILDER_TOOLS, LIBERTY_WRITABLE_FEATURE}
28   make
29
30feature {ANY}
31   name: FIXED_STRING is
32      do
33         Result := entity.name
34      end
35
36   feature_name: LIBERTY_FEATURE_NAME is
37      do
38         Result := entity.feature_name
39      end
40
41   result_type: LIBERTY_TYPE is
42      do
43         Result := entity.result_type
44      end
45
46   out_in_tagged_out_memory is
47      do
48         tagged_out_memory.append(once "writable feature: ")
49         tagged_out_memory.append(name)
50      end
51
52   specialized_in (a_type: LIBERTY_ACTUAL_TYPE): like Current is
53      local
54         e: like entity
55      do
56         e := entity.specialized_in(a_type)
57         if e = entity then
58            Result := Current
59         else
60            create Result.make(e, position)
61         end
62      end
63
64feature {LIBERTY_REACHABLE, LIBERTY_REACHABLE_COLLECTION_MARKER}
65   mark_reachable_code (mark: INTEGER) is
66      do
67         if result_type.is_known and then result_type.known_type.is_runtime_category_set and then result_type.known_type.is_expanded then
68            result_type.mark_reachable_code(mark)
69         end
70      end
71
72feature {}
73   entity: LIBERTY_FEATURE_ENTITY
74
75   make (a_entity: like entity; a_position: like position) is
76      require
77         a_entity /= Void
78         a_position /= Void
79      do
80         entity := a_entity
81         position := a_position
82      ensure
83         entity = a_entity
84         position = a_position
85      end
86
87feature {ANY}
88   accept (v: VISITOR) is
89      local
90         v0: LIBERTY_WRITABLE_FEATURE_VISITOR
91      do
92         v0 ::= v
93         v0.visit_liberty_writable_feature(Current)
94      end
95
96invariant
97   entity /= Void
98
99end