/[eiffelstudio]/branches/CAT_mono/Src/Eiffel/eiffel/interface/tuple_class_b.e
ViewVC logotype

Contents of /branches/CAT_mono/Src/Eiffel/eiffel/interface/tuple_class_b.e

Parent Directory Parent Directory | Revision Log Revision Log


Revision 69868 - (show annotations)
Fri Aug 3 22:28:26 2007 UTC (12 years, 4 months ago) by martins
File size: 3665 byte(s)
enabled more types to store monomorph information
1 indexing
2 description: "Compiled class TUPLE"
3 legal: "See notice at end of class."
4 status: "See notice at end of class."
5 date: "$Date$"
6 revision: "$Revision$"
7
8 class
9 TUPLE_CLASS_B
10
11 inherit
12 EIFFEL_CLASS_C
13 redefine
14 actual_type,
15 is_tuple,
16 normalized_type_i,
17 partial_actual_type
18 end
19
20 create
21 make
22
23 feature -- Status report
24
25 is_tuple: BOOLEAN is True
26 -- Current class is TUPLE.
27
28 feature {NONE} -- Implementation
29
30 normalized_type_i (data: CL_TYPE_I): TUPLE_TYPE_I is
31 -- Class type `data' normalized in terms of the current class.
32 do
33 create Result.make (class_id, create {META_GENERIC}.make (0), create {ARRAY [TYPE_I]}.make (1, 0))
34 Result.set_mark (data.declaration_mark)
35 end
36
37 feature -- Actual class type
38
39 actual_type: TUPLE_TYPE_A is
40 -- Actual type of the class
41 local
42 i, count: INTEGER
43 actual_generic: ARRAY [FORMAL_A]
44 formal: FORMAL_A
45 do
46 if generics /= Void then
47 from
48 i := 1
49 count := generics.count
50 create actual_generic.make (1, count)
51 until
52 i > count
53 loop
54 -- TODO: is polymorph ok? (3rd False)
55 create formal.make (False, False, False, 1)
56 actual_generic.put (formal, i)
57 i := i + 1
58 end
59 else
60 create actual_generic.make (1, 0)
61 end
62 create Result.make (class_id, actual_generic)
63 end
64
65 feature {CLASS_TYPE_AS} -- Actual class type
66
67 partial_actual_type (gen: ARRAY [TYPE_A]; is_exp, is_sep, is_mono: BOOLEAN): CL_TYPE_A is
68 -- Actual type of `current depending on the context in which it is declared
69 -- in CLASS_TYPE_AS. That is to say, it could have generics `gen' but not
70 -- be a generic class. It simplifies creation of `CL_TYPE_A' instances in
71 -- CLASS_TYPE_AS when trying to resolve types, by using dynamic binding
72 -- rather than if statements.
73 do
74 if gen /= Void then
75 create {TUPLE_TYPE_A} Result.make (class_id, gen)
76 else
77 create {TUPLE_TYPE_A} Result.make (class_id, create {ARRAY [TYPE_A]}.make (1, 0))
78 end
79 -- Note that TUPLE is not expanded by default.
80 if is_exp then
81 Result.set_expanded_mark
82 elseif is_sep then
83 Result.set_separate_mark
84 end
85 if is_mono then
86 Result.set_monomorph_mark
87 end
88 if is_expanded then
89 Result.set_expanded_class_mark
90 end
91 end
92
93 invariant
94 types_has_only_one_element: types /= Void implies types.count <= 1
95
96 indexing
97 copyright: "Copyright (c) 1984-2006, Eiffel Software"
98 license: "GPL version 2 (see http://www.eiffel.com/licensing/gpl.txt)"
99 licensing_options: "http://www.eiffel.com/licensing"
100 copying: "[
101 This file is part of Eiffel Software's Eiffel Development Environment.
102
103 Eiffel Software's Eiffel Development Environment is free
104 software; you can redistribute it and/or modify it under
105 the terms of the GNU General Public License as published
106 by the Free Software Foundation, version 2 of the License
107 (available at the URL listed under "license" above).
108
109 Eiffel Software's Eiffel Development Environment is
110 distributed in the hope that it will be useful, but
111 WITHOUT ANY WARRANTY; without even the implied warranty
112 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
113 See the GNU General Public License for more details.
114
115 You should have received a copy of the GNU General Public
116 License along with Eiffel Software's Eiffel Development
117 Environment; if not, write to the Free Software Foundation,
118 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
119 ]"
120 source: "[
121 Eiffel Software
122 356 Storke Road, Goleta, CA 93117 USA
123 Telephone 805-685-1006, Fax 805-685-6869
124 Website http://www.eiffel.com
125 Customer support http://support.eiffel.com
126 ]"
127
128 end

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.23