PageRenderTime 8ms CodeModel.GetById 1ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

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

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