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

/src/tools/semantics/types/delayed_resolver/liberty_delayed_open_argument.e

http://github.com/tybor/Liberty
Specman e | 93 lines | 63 code | 16 blank | 14 comment | 1 complexity | 19da7d98f13380b3c4503cc55708e0a2 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_DELAYED_OPEN_ARGUMENT
16
17inherit
18   LIBERTY_DELAYED_RESOLVER
19
20creation {LIBERTY_AGENT}
21   make
22
23feature {ANY}
24   out_in_tagged_out_memory is
25      do
26         if can_resolve then
27            resolved.out_in_tagged_out_memory
28         else
29            tagged_out_memory.extend('?')
30         end
31      end
32
33   hash_code: INTEGER is
34      do
35         Result := full_name_memory.hash_code
36      end
37
38   is_equal (other: like Current): BOOLEAN is
39      do
40         Result := other = Current
41      end
42
43feature {LIBERTY_DELAYED_TYPE}
44   can_resolve: BOOLEAN is
45      do
46         Result := of_agent.can_compute_open_argument_type(Current, index)
47      end
48
49   resolved: LIBERTY_KNOWN_TYPE is
50      do
51         Result := of_agent.open_argument_type(Current, index)
52      end
53
54   full_name: FIXED_STRING is
55      do
56         Result := full_name_memory
57      end
58
59   specialized_in (a_type: LIBERTY_ACTUAL_TYPE): like Current is
60      do
61         Result := Current
62      end
63
64feature {}
65   make (a_agent: like of_agent; a_index: like index) is
66      require
67         a_agent /= Void
68      do
69         of_agent := a_agent
70         index := a_index
71
72         lock_tagged_out
73         tagged_out_memory.copy(once "open argument #")
74         a_index.append_in(tagged_out_memory)
75         tagged_out_memory.append(once " of ")
76         a_agent.out_in_tagged_out_memory
77         unlock_tagged_out
78
79         full_name_memory := tagged_out_memory.intern
80      ensure
81         of_agent = a_agent
82         index = a_index
83      end
84
85   of_agent: LIBERTY_AGENT
86   index: INTEGER
87
88   full_name_memory: FIXED_STRING
89
90invariant
91   of_agent /= Void
92
93end -- class LIBERTY_DELAYED_OPEN_ARGUMENT