PageRenderTime 23ms CodeModel.GetById 20ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/src/tools/semantics/code/instructions/liberty_default.e

http://github.com/tybor/Liberty
Specman e | 71 lines | 48 code | 9 blank | 14 comment | 1 complexity | c87b3384d27f7e83a61bb5d10d2f7259 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_DEFAULT
16
17insert
18   LIBERTY_POSITIONABLE
19   LIBERTY_REACHABLE
20
21create {LIBERTY_BUILDER_TOOLS, LIBERTY_DEFAULT}
22   make
23
24feature {ANY}
25   instruction: LIBERTY_INSTRUCTION
26
27feature {LIBERTY_CONDITIONAL, LIBERTY_INSPECT}
28   specialized_in (a_type: LIBERTY_ACTUAL_TYPE): like Current is
29      local
30         i: like instruction
31      do
32         i := instruction.specialized_in(a_type)
33         if i = instruction then
34            Result := Current
35         else
36            create Result.make(i, position)
37         end
38      end
39
40feature {LIBERTY_REACHABLE, LIBERTY_REACHABLE_COLLECTION_MARKER}
41   mark_reachable_code (mark: INTEGER) is
42      do
43         instruction.mark_reachable_code(mark)
44      end
45
46feature {}
47   make (a_instruction: like instruction; a_position: like position) is
48      require
49         a_instruction /= Void
50         a_position /= Void
51      do
52         instruction := a_instruction
53         position := a_position
54      ensure
55         instruction = a_instruction
56         position = a_position
57      end
58
59feature {ANY}
60   accept (v: VISITOR) is
61      local
62         v0: LIBERTY_DEFAULT_VISITOR
63      do
64         v0 ::= v
65         v0.visit_liberty_default(Current)
66      end
67
68invariant
69   instruction /= Void
70
71end