PageRenderTime 22ms CodeModel.GetById 13ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 1ms

/src/tools/semantics/code/entities/liberty_parameter.e

http://github.com/tybor/Liberty
Specman e | 85 lines | 60 code | 11 blank | 14 comment | 2 complexity | eb2483592fc3f5db5661ed7c796390c3 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_PARAMETER
16
17inherit
18   LIBERTY_ENTITY
19      redefine out_in_tagged_out_memory
20      end
21
22create {LIBERTY_BUILDER_TOOLS, LIBERTY_PARAMETER}
23   make
24
25feature {ANY}
26   name: FIXED_STRING
27
28   result_type: LIBERTY_TYPE
29
30   out_in_tagged_out_memory is
31      do
32         tagged_out_memory.append(once "parameter: ")
33         tagged_out_memory.append(name)
34      end
35
36   specialized_in (a_type: LIBERTY_ACTUAL_TYPE): like Current is
37      local
38         r: like result_type
39      do
40         r := result_type.specialized_in(a_type)
41         if r = result_type then
42            Result := Current
43         else
44            create Result.make(name, r, position)
45         end
46      end
47
48feature {LIBERTY_REACHABLE, LIBERTY_REACHABLE_COLLECTION_MARKER}
49   mark_reachable_code (mark: INTEGER) is
50      do
51         if result_type.is_known and then result_type.known_type.is_runtime_category_set and then result_type.known_type.is_expanded then
52            result_type.mark_reachable_code(mark)
53         end
54      end
55
56feature {}
57   make (a_name: FIXED_STRING; a_result_type: like result_type; a_position: like position) is
58      require
59         a_name /= Void
60         a_result_type /= Void
61         a_position /= Void
62      do
63         name := a_name
64         result_type := a_result_type
65         position := a_position
66      ensure
67         name = a_name
68         result_type = a_result_type
69         position = a_position
70      end
71
72feature {ANY}
73   accept (v: VISITOR) is
74      local
75         v0: LIBERTY_PARAMETER_VISITOR
76      do
77         v0 ::= v
78         v0.visit_liberty_parameter(Current)
79      end
80
81invariant
82   name /= Void
83   result_type /= Void
84
85end