PageRenderTime 15ms CodeModel.GetById 7ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 1ms

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

http://github.com/tybor/Liberty
Specman e | 96 lines | 69 code | 12 blank | 15 comment | 2 complexity | abebb8e0881caabd01274a1351af060f 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_OPEN_ARGUMENT
16
17inherit
18   LIBERTY_EXPRESSION
19      redefine
20         result_type_may_be_void, is_open_argument
21      end
22
23create {LIBERTY_BUILDER_TOOLS}
24   make
25
26create {LIBERTY_OPEN_ARGUMENT}
27   make_specialized
28
29feature {ANY}
30   result_type: LIBERTY_TYPE
31
32   result_type_may_be_void: BOOLEAN is True
33   is_open_argument: BOOLEAN is True
34
35   specialized_in (a_type: LIBERTY_ACTUAL_TYPE): like Current is
36      local
37         r: like result_type
38      do
39         if result_type /= Void then
40            r := result_type.specialized_in(a_type)
41         end
42         if r = result_type then
43            Result := Current
44         else
45            create Result.make_specialized(r, position)
46         end
47      end
48
49feature {LIBERTY_BUILDER_TOOLS, LIBERTY_AGENT}
50   set_result_type (a_result_type: like result_type) is
51      require
52         a_result_type /= Void
53      do
54         result_type := a_result_type
55      ensure
56         result_type = a_result_type
57      end
58
59feature {LIBERTY_REACHABLE, LIBERTY_REACHABLE_COLLECTION_MARKER}
60   mark_reachable_code (mark: INTEGER) is
61      do
62         -- nothing
63      end
64
65feature {}
66   make (a_position: like position) is
67      require
68         a_position /= Void
69      do
70         position := a_position
71      ensure
72         position = a_position
73      end
74
75   make_specialized (a_result_type: like result_type; a_position: like position) is
76      require
77         a_result_type /= Void
78         a_position /= Void
79      do
80         result_type := a_result_type
81         position := a_position
82      ensure
83         result_type = a_result_type
84         position = a_position
85      end
86
87feature {ANY}
88   accept (v: VISITOR) is
89      local
90         v0: LIBERTY_OPEN_ARGUMENT_VISITOR
91      do
92         v0 ::= v
93         v0.visit_liberty_open_argument(Current)
94      end
95
96end