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

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

http://github.com/tybor/Liberty
Specman e | 75 lines | 53 code | 8 blank | 14 comment | 3 complexity | ef131b4daf71416f90a5f2dbbab5034c 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--
15deferred class LIBERTY_WRITTEN_ASSERTIONS
16
17inherit
18   LIBERTY_ASSERTIONS
19
20feature {ANY}
21   assertions: TRAVERSABLE[LIBERTY_ASSERTION] is
22      do
23         Result := assertions_list
24      end
25
26feature {LIBERTY_FEATURE, LIBERTY_ASSERTIONS}
27   specialized_in (a_type: LIBERTY_ACTUAL_TYPE): like Current is
28      local
29         al: like assertions_list
30         a: LIBERTY_ASSERTION
31         i: INTEGER
32      do
33         from
34            al := assertions_list
35            i := al.lower
36         until
37            i > al.upper
38         loop
39            a := al.item(i).specialized_in(a_type)
40            if a /= al.item(i) then
41               if al = assertions_list then
42                  al := assertions_list.twin
43               end
44               al.put(a, i)
45            end
46            i := i + 1
47         end
48         if al = assertions_list then
49            Result := Current
50         else
51            Result := specialized(al)
52         end
53      end
54
55feature {}
56   specialized (a_assertions: like assertions_list): like Current is
57      deferred
58      ensure
59         Result /= Current
60         Result.assertions_list = a_assertions
61      end
62
63feature {LIBERTY_REACHABLE, LIBERTY_REACHABLE_COLLECTION_MARKER}
64   mark_reachable_code (mark: INTEGER) is
65      do
66         assertions_marker.mark_reachable_code(mark, assertions)
67      end
68
69feature {LIBERTY_WRITTEN_ASSERTIONS}
70   assertions_list: COLLECTION[LIBERTY_ASSERTION]
71
72invariant
73   assertions /= Void
74
75end