PageRenderTime 9ms CodeModel.GetById 2ms app.highlight 2ms RepoModel.GetById 2ms app.codeStats 0ms

/src/tools/semantics/code/assertions/liberty_variant.e

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