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 |
create formal.make (False, False, 1) |
55 |
actual_generic.put (formal, i) |
56 |
i := i + 1 |
57 |
end |
58 |
else |
59 |
create actual_generic.make (1, 0) |
60 |
end |
61 |
create Result.make (class_id, actual_generic) |
62 |
end |
63 |
|
64 |
feature {CLASS_TYPE_AS} -- Actual class type |
65 |
|
66 |
partial_actual_type (gen: ARRAY [TYPE_A]; is_exp, is_sep, is_mono: BOOLEAN): CL_TYPE_A is |
67 |
-- Actual type of `current depending on the context in which it is declared |
68 |
-- in CLASS_TYPE_AS. That is to say, it could have generics `gen' but not |
69 |
-- be a generic class. It simplifies creation of `CL_TYPE_A' instances in |
70 |
-- CLASS_TYPE_AS when trying to resolve types, by using dynamic binding |
71 |
-- rather than if statements. |
72 |
do |
73 |
if gen /= Void then |
74 |
create {TUPLE_TYPE_A} Result.make (class_id, gen) |
75 |
else |
76 |
create {TUPLE_TYPE_A} Result.make (class_id, create {ARRAY [TYPE_A]}.make (1, 0)) |
77 |
end |
78 |
-- Note that TUPLE is not expanded by default. |
79 |
if is_exp then |
80 |
Result.set_expanded_mark |
81 |
elseif is_sep then |
82 |
Result.set_separate_mark |
83 |
end |
84 |
if is_expanded then |
85 |
Result.set_expanded_class_mark |
86 |
elseif is_mono then |
87 |
Result.set_monomorph_mark |
88 |
end |
89 |
end |
90 |
|
91 |
invariant |
92 |
types_has_only_one_element: types /= Void implies types.count <= 1 |
93 |
|
94 |
indexing |
95 |
copyright: "Copyright (c) 1984-2006, Eiffel Software" |
96 |
license: "GPL version 2 (see http://www.eiffel.com/licensing/gpl.txt)" |
97 |
licensing_options: "http://www.eiffel.com/licensing" |
98 |
copying: "[ |
99 |
This file is part of Eiffel Software's Eiffel Development Environment. |
100 |
|
101 |
Eiffel Software's Eiffel Development Environment is free |
102 |
software; you can redistribute it and/or modify it under |
103 |
the terms of the GNU General Public License as published |
104 |
by the Free Software Foundation, version 2 of the License |
105 |
(available at the URL listed under "license" above). |
106 |
|
107 |
Eiffel Software's Eiffel Development Environment is |
108 |
distributed in the hope that it will be useful, but |
109 |
WITHOUT ANY WARRANTY; without even the implied warranty |
110 |
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
111 |
See the GNU General Public License for more details. |
112 |
|
113 |
You should have received a copy of the GNU General Public |
114 |
License along with Eiffel Software's Eiffel Development |
115 |
Environment; if not, write to the Free Software Foundation, |
116 |
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
117 |
]" |
118 |
source: "[ |
119 |
Eiffel Software |
120 |
356 Storke Road, Goleta, CA 93117 USA |
121 |
Telephone 805-685-1006, Fax 805-685-6869 |
122 |
Website http://www.eiffel.com |
123 |
Customer support http://support.eiffel.com |
124 |
]" |
125 |
|
126 |
end |