/[eiffelstudio]/branches/CAT_mono/Src/Eiffel/API/evaluated_type/like_type_a.e
ViewVC logotype

Contents of /branches/CAT_mono/Src/Eiffel/API/evaluated_type/like_type_a.e

Parent Directory Parent Directory | Revision Log Revision Log


Revision 56027 - (show annotations)
Tue Dec 6 10:43:09 2005 UTC (14 years, 1 month ago) by alexk
Original Path: trunk/Src/bench/Eiffel/API/evaluated_type/like_type_a.e
File size: 3807 byte(s)
Redefined `conformance_type' to call this feature on `actual_type' because `actual_type' may yield another anchored type. This fixes eweasel test valid171.
1 indexing
2 description: "Representation of an anchored type"
3 date: "$Date$"
4 revision: "$Revision$"
5
6 deferred class
7 LIKE_TYPE_A
8
9 inherit
10 TYPE_A
11 undefine
12 instantiation_in, same_as, solved_type
13 redefine
14 actual_type,
15 conformance_type,
16 convert_to,
17 has_associated_class,
18 has_like,
19 instantiated_in,
20 is_basic,
21 is_expanded,
22 is_external,
23 is_like,
24 is_loose,
25 is_none,
26 is_reference,
27 meta_type
28 end
29
30 SHARED_LIKE_CONTROLER
31
32 feature -- Properties
33
34 actual_type: TYPE_A
35 -- Actual type of the anchored type in a given class
36
37 conformance_type: TYPE_A is
38 -- Type which is used to check conformance
39 do
40 -- `conformance_type' has to be called because
41 -- `actual_type' may yield yet another anchored type.
42 Result := actual_type.conformance_type
43 end
44
45 is_like: BOOLEAN is True
46 -- Is the type anchored one ?
47
48 has_like: BOOLEAN is True
49 -- Does the type have anchored type in its definition ?
50
51 is_loose: BOOLEAN is True
52 -- Does type depend on formal generic parameters and/or anchors?
53
54 is_basic: BOOLEAN is
55 -- Is the current actual type a basic one ?
56 do
57 Result := actual_type.is_basic
58 end
59
60 is_external: BOOLEAN is
61 -- Is current type based on an external class?
62 do
63 Result := actual_type.is_external
64 end
65
66 is_reference: BOOLEAN is
67 -- Is current actual type a reference one?
68 do
69 Result := actual_type.is_reference
70 end
71
72 is_expanded: BOOLEAN is
73 -- Is current actual type an expanded one?
74 do
75 Result := actual_type.is_expanded
76 end
77
78 is_none: BOOLEAN is
79 -- Is current actual type NONE?
80 do
81 Result := actual_type.is_none
82 end
83
84 feature -- Access
85
86 same_as (other: TYPE_A): BOOLEAN is
87 -- Is the current type the same as `other' ?
88 deferred
89 end
90
91 has_associated_class: BOOLEAN is
92 -- Does Current have an associated class?
93 do
94 Result := actual_type /= Void and then
95 actual_type.has_associated_class
96 end
97
98 associated_class: CLASS_C is
99 -- Associated class
100 do
101 Result := actual_type.associated_class
102 end
103
104 feature -- Primitives
105
106 set_actual_type (a: TYPE_A) is
107 -- Assign `a' to `actual_type'.
108 do
109 actual_type := a
110 end
111
112 solved_type (feat_table: FEATURE_TABLE f: FEATURE_I): like Current is
113 -- Calculated type in function of the feature `f' which has
114 -- the type Current and the feautre table `feat_table
115 deferred
116 end
117
118 instantiation_in (type: TYPE_A written_id: INTEGER): TYPE_A is
119 -- Instantiation of Current in the context of `class_type',
120 -- assuming that Current is written in class of id `written_id'.
121 deferred
122 end
123
124 instantiated_in (class_type: TYPE_A): TYPE_A is
125 -- Instantiation of Current in the context of `class_type'
126 -- assuming that Current is written in the associated class
127 -- of `class_type'.
128 local
129 t: like Current
130 do
131 t := twin
132 t.set_actual_type (actual_type.instantiated_in (class_type))
133 Result := t
134 end
135
136 conform_to (other: TYPE_A): BOOLEAN is
137 -- Does `actual_type' conform to `other'?
138 do
139 Result := actual_type.conform_to (other.conformance_type)
140 end
141
142 convert_to (a_context_class: CLASS_C; a_target_type: TYPE_A): BOOLEAN is
143 -- Does current convert to `a_target_type' in `a_context_class'?
144 -- Update `last_conversion_info' of AST_CONTEXT.
145 do
146 Result := actual_type.convert_to (a_context_class, a_target_type)
147 end
148
149 type_i: TYPE_I is
150 -- Reduced type of `actual_type'
151 local
152 cl_type : CL_TYPE_I
153 do
154 Result := actual_type.type_i
155 cl_type ?= Result
156
157 if cl_type /= Void and then not cl_type.is_expanded then
158 -- Remember that it's an anchored type, not needed
159 -- when handling expanded types.
160 cl_type.set_cr_info (create_info)
161 end
162 end
163
164 meta_type: TYPE_I is
165 -- C type for `actual_type'
166 do
167 Result := actual_type.meta_type
168 end
169
170 end -- class LIKE_TYPE_A

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.23