PageRenderTime 9ms CodeModel.GetById 1ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 1ms

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

http://github.com/tybor/Liberty
Specman e | 75 lines | 49 code | 10 blank | 16 comment | 1 complexity | 9d4eec9691ca53033c96a8e9f11b087c 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_ENTITY_EXPRESSION
16   -- expressions like "entity"
17
18inherit
19   LIBERTY_EXPRESSION
20
21create {LIBERTY_BUILDER_TOOLS, LIBERTY_ENTITY_EXPRESSION}
22   make
23
24feature {ANY}
25   entity: LIBERTY_ENTITY
26
27   result_type: LIBERTY_TYPE is
28      do
29         Result := entity.result_type
30      end
31
32   specialized_in (a_type: LIBERTY_ACTUAL_TYPE): like Current is
33      local
34         e: like entity
35      do
36         e := entity.specialized_in(a_type)
37         if e = entity then
38            Result := Current
39         else
40            create Result.make(e, position)
41         end
42      end
43
44feature {LIBERTY_REACHABLE, LIBERTY_REACHABLE_COLLECTION_MARKER}
45   mark_reachable_code (mark: INTEGER) is
46      do
47         -- nothing
48      end
49
50feature {}
51   make (a_entity: like entity; a_position: like position) is
52      require
53         a_entity.result_type /= Void
54         a_position /= Void
55      do
56         entity := a_entity
57         position := a_position
58      ensure
59         entity = a_entity
60         position = a_position
61      end
62
63feature {ANY}
64   accept (v: VISITOR) is
65      local
66         v0: LIBERTY_ENTITY_EXPRESSION_VISITOR
67      do
68         v0 ::= v
69         v0.visit_liberty_entity_expression(Current)
70      end
71
72invariant
73   entity /= Void
74
75end