/[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 55790 - (show annotations)
Fri Nov 18 08:16:50 2005 UTC (14 years, 2 months ago) by alexk
Original Path: trunk/Src/bench/Eiffel/API/evaluated_type/like_type_a.e
File size: 3521 byte(s)
Changed conformance tests to use a new feature `conformance_type'
because now `actual_type' can return LIKE_CURRENT due to changes
in processing of "like Current" type.
Changed signature of `instantiated_in' to accept LIKE_CURRENT that can
now be used during type checking in addition to the previously used
CL_TYPE_A.
Moved declaration of `class_id' into the class LIKE_FEATURE because it
is used only there.

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 same_as, solved_type, instantiation_in
13 redefine
14 actual_type, has_like, is_loose, is_like, is_external,
15 is_basic, instantiated_in, meta_type,
16 has_associated_class,
17 is_reference, is_expanded, is_none, convert_to
18 end
19
20 SHARED_LIKE_CONTROLER
21
22 feature -- Properties
23
24 actual_type: TYPE_A
25 -- Actual type of the anchored type in a given class
26
27 is_like: BOOLEAN is True
28 -- Is the type anchored one ?
29
30 has_like: BOOLEAN is True
31 -- Does the type have anchored type in its definition ?
32
33 is_loose: BOOLEAN is True
34 -- Does type depend on formal generic parameters and/or anchors?
35
36 is_basic: BOOLEAN is
37 -- Is the current actual type a basic one ?
38 do
39 Result := actual_type.is_basic
40 end
41
42 is_external: BOOLEAN is
43 -- Is current type based on an external class?
44 do
45 Result := actual_type.is_external
46 end
47
48 is_reference: BOOLEAN is
49 -- Is current actual type a reference one?
50 do
51 Result := actual_type.is_reference
52 end
53
54 is_expanded: BOOLEAN is
55 -- Is current actual type an expanded one?
56 do
57 Result := actual_type.is_expanded
58 end
59
60 is_none: BOOLEAN is
61 -- Is current actual type NONE?
62 do
63 Result := actual_type.is_none
64 end
65
66 feature -- Access
67
68 same_as (other: TYPE_A): BOOLEAN is
69 -- Is the current type the same as `other' ?
70 deferred
71 end
72
73 has_associated_class: BOOLEAN is
74 -- Does Current have an associated class?
75 do
76 Result := actual_type /= Void and then
77 actual_type.has_associated_class
78 end
79
80 associated_class: CLASS_C is
81 -- Associated class
82 do
83 Result := actual_type.associated_class
84 end
85
86 feature -- Primitives
87
88 set_actual_type (a: TYPE_A) is
89 -- Assign `a' to `actual_type'.
90 do
91 actual_type := a
92 end
93
94 solved_type (feat_table: FEATURE_TABLE f: FEATURE_I): like Current is
95 -- Calculated type in function of the feature `f' which has
96 -- the type Current and the feautre table `feat_table
97 deferred
98 end
99
100 instantiation_in (type: TYPE_A written_id: INTEGER): TYPE_A is
101 -- Instantiation of Current in the context of `class_type',
102 -- assuming that Current is written in class of id `written_id'.
103 deferred
104 end
105
106 instantiated_in (class_type: TYPE_A): TYPE_A is
107 -- Instantiation of Current in the context of `class_type'
108 -- assuming that Current is written in the associated class
109 -- of `class_type'.
110 local
111 t: like Current
112 do
113 t := twin
114 t.set_actual_type (actual_type.instantiated_in (class_type))
115 Result := t
116 end
117
118 conform_to (other: TYPE_A): BOOLEAN is
119 -- Does `actual_type' conform to `other'?
120 do
121 Result := actual_type.conform_to (other.conformance_type)
122 end
123
124 convert_to (a_context_class: CLASS_C; a_target_type: TYPE_A): BOOLEAN is
125 -- Does current convert to `a_target_type' in `a_context_class'?
126 -- Update `last_conversion_info' of AST_CONTEXT.
127 do
128 Result := actual_type.convert_to (a_context_class, a_target_type)
129 end
130
131 type_i: TYPE_I is
132 -- Reduced type of `actual_type'
133 local
134 cl_type : CL_TYPE_I
135 do
136 Result := actual_type.type_i
137 cl_type ?= Result
138
139 if cl_type /= Void and then not cl_type.is_expanded then
140 -- Remember that it's an anchored type, not needed
141 -- when handling expanded types.
142 cl_type.set_cr_info (create_info)
143 end
144 end
145
146 meta_type: TYPE_I is
147 -- C type for `actual_type'
148 do
149 Result := actual_type.meta_type
150 end
151
152 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