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

/src/tools/semantics/types/type_resolver/liberty_type_resolver_in_inline_agent.e

http://github.com/tybor/Liberty
Specman e | 82 lines | 54 code | 11 blank | 17 comment | 3 complexity | 13dcd6f1ee7a09c1ba17843286d1144d 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_TYPE_RESOLVER_IN_INLINE_AGENT
16
17inherit
18   LIBERTY_TYPE_RESOLVER
19
20creation {LIBERTY_SEMANTICS_BUILDER}
21   make
22
23feature {ANY}
24   local_context: LIBERTY_INLINE_AGENT_CONTEXT
25
26   out_in_tagged_out_memory is
27      do
28         tagged_out_memory.append(once "resolver in inline agent")
29      end
30
31   specialized_in (a_type: LIBERTY_ACTUAL_TYPE): like Current is
32      do
33         Result := Current --| TODO: ???
34      end
35
36feature {}
37   lookup_type (type_definition: LIBERTY_AST_TYPE_DEFINITION): LIBERTY_TYPE is
38      local
39         name: FIXED_STRING
40      do
41         if type_definition.is_like_result then
42            if local_context.result_type = Void then
43               --|*** TODO: error: not a function
44               not_yet_implemented
45            end
46            Result := local_context.result_type
47         elseif type_definition.is_like_entity then
48            -- If it's an anchor to a parameter or a local, resolve it immediately. (TODO: beware of cycles!)
49            -- Other cases will be caught by parent resolvers.
50            name := type_definition.entity_anchor.image.image.intern
51            if local_context.is_parameter(name) then
52               Result := local_context.parameter(name).result_type
53            elseif local_context.is_local(name) then
54               Result := local_context.local_var(name).result_type
55            end
56         end
57      end
58
59   lookup_export_type (type_definition: LIBERTY_AST_TYPE_DEFINITION): LIBERTY_TYPE is
60      do
61         check Result = Void end
62      end
63
64   lookup_position (type_definition: LIBERTY_AST_TYPE_DEFINITION): LIBERTY_POSITION is
65      do
66         check Result = Void end
67      end
68
69feature {}
70   make (a_local_context: like local_context) is
71      require
72         a_local_context /= Void
73      do
74         local_context := a_local_context
75      ensure
76         local_context = a_local_context
77      end
78
79invariant
80   local_context /= Void
81
82end -- class LIBERTY_TYPE_RESOLVER_IN_INLINE_AGENT