/[eiffelstudio]/branches/eth/eve/Src/Eiffel/eiffel/generation/entry.e
ViewVC logotype

Contents of /branches/eth/eve/Src/Eiffel/eiffel/generation/entry.e

Parent Directory Parent Directory | Revision Log Revision Log


Revision 94983 - (show annotations)
Fri May 2 11:05:28 2014 UTC (5 years, 5 months ago) by jasonw
File size: 5653 byte(s)
<<Merged from trunk#94978.>>
1 note
2 legal: "See notice at end of class."
3 status: "See notice at end of class."
4 -- Abstract description of an entry in a routine table (instance of
5 -- POLY_TABLE)
6
7 deferred class ENTRY
8
9 inherit
10 COMPARABLE
11 undefine
12 is_equal
13 end
14
15 SHARED_WORKBENCH
16
17 COMPILER_EXPORTER
18
19 SHARED_BYTE_CONTEXT
20 export
21 {NONE} all
22 end
23
24 feature -- comparison
25
26 is_less alias "<" (other: ENTRY): BOOLEAN
27 -- Is `other' greater than Current?
28 do
29 Result := type_id < other.type_id
30 end
31
32 feature -- from ENTRY
33
34 type_id: INTEGER
35 -- Type id of the entry
36
37 type: TYPE_A
38 -- Result type fo the entry
39
40 set_type_id (i: INTEGER)
41 -- Assign `i' to `type_id'.
42 do
43 type_id := i;
44 end;
45
46 set_type (t: TYPE_A)
47 -- Assign `t' to `type'.
48 do
49 type := t;
50 end;
51
52 feature -- for dead code removal
53
54 is_attribute: BOOLEAN
55 -- is the feature_i associated an attribute ?
56 do
57 end
58
59 is_deferred: BOOLEAN
60 -- Is the feature_i associated a deferred routine?
61 do
62 end
63
64 feature_id: INTEGER
65 -- feature id of the feature associated to the entry
66
67 set_feature_id (i: INTEGER)
68 do
69 feature_id := i
70 end
71
72 feature -- Previously in POLY_UNIT
73
74 class_id: INTEGER
75 -- Id of the class associated to the current_unit
76
77 type_a: TYPE_A
78 -- Result type of the polymorphic entry
79
80 set_class_id (i: INTEGER)
81 -- Assign `i' to `class_id'
82 do
83 class_id := i
84 end
85
86 set_type_a (t: TYPE_A)
87 -- Assign `t' to `type_a'.
88 do
89 type_a := t
90 end
91
92 feature -- previously in POLY_UNIT
93
94 entry (class_type: CLASS_TYPE; a_alias: BOOLEAN): ENTRY
95 -- Entry in a poly-table for final mode
96 require
97 class_type_not_void: class_type /= Void
98 deferred
99 end;
100
101 feature_type (class_type: CLASS_TYPE): TYPE_A
102 -- Type id of the result type in `class_type'.
103 require
104 good_argument: class_type /= Void
105 do
106 Result := type_a
107 if Result.is_like_current then
108 -- We need to instantiate `like Current' in the context of `class_type'
109 -- to fix eweasel test#exec035.
110 -- Associated actual type is always attached.
111 Result := Result.instantiated_in (class_type.type.as_attached_in (class_type.associated_class))
112 end
113 end
114
115 feature -- updates
116
117 update (class_type: CLASS_TYPE)
118 -- Enlarged current entry to manage correctly polymorphism with generics.
119 require
120 class_type_not_void: class_type /= Void
121 do
122 set_type_id (class_type.type_id)
123 set_type (feature_type (class_type))
124 end
125
126 feature -- from ENTRY
127
128 used: BOOLEAN
129 -- Is the entry used ?
130 deferred
131 end;
132
133 static_feature_type_id: INTEGER
134 -- Type id of the Result type
135 local
136 l_context_type: CL_TYPE_A
137 do
138 l_context_type := system.class_type_of_id (type_id).type
139 if type.has_associated_class_type (l_context_type) then
140 Result := type.static_type_id (l_context_type)
141 end
142 end
143
144 generated_static_feature_type_id (buffer: GENERATION_BUFFER)
145 -- Textual representation of type id of the Result type
146 do
147 buffer.put_static_type_id (static_feature_type_id)
148 end;
149
150 feature_type_id: INTEGER
151 -- Type id of the Result type
152 local
153 l_context_type: CL_TYPE_A
154 do
155 l_context_type := system.class_type_of_id (type_id).type
156 if type.has_associated_class_type (l_context_type) then
157 Result := type.type_id (l_context_type)
158 end
159 end
160
161 needs_extended_info: BOOLEAN
162 -- Is `type' a type which needs more data to be resolved at run-time?
163 --| Currently it is only generics, formals, anchors and types which are attached.
164 --| We exclude expanded types since they are by default attached and thus only have
165 --| one type at runtime.
166 do
167 Result := type.has_generics or else not type.is_explicit or else
168 (not type.is_expanded and then type.is_attached)
169 end
170
171 generate_cid (buffer: GENERATION_BUFFER; final_mode: BOOLEAN)
172 -- Generate list of type id's of generic type
173 -- separated by commas.
174 require
175 is_generic : needs_extended_info
176 do
177 type.generate_cid (buffer, final_mode, False, system.class_type_of_id (type_id).type)
178 end
179
180 make_gen_type_byte_code (ba: BYTE_ARRAY)
181 -- Make byte code for type of current entry.
182 require
183 is_generic : needs_extended_info
184 do
185 type.make_type_byte_code (ba, False, system.class_type_of_id (type_id).type)
186 end;
187
188 feature -- Status report
189
190 is_initialization_required: BOOLEAN
191 -- Is initialization of an attribute required?
192 deferred
193 end
194
195 note
196 copyright: "Copyright (c) 1984-2011, Eiffel Software"
197 license: "GPL version 2 (see http://www.eiffel.com/licensing/gpl.txt)"
198 licensing_options: "http://www.eiffel.com/licensing"
199 copying: "[
200 This file is part of Eiffel Software's Eiffel Development Environment.
201
202 Eiffel Software's Eiffel Development Environment is free
203 software; you can redistribute it and/or modify it under
204 the terms of the GNU General Public License as published
205 by the Free Software Foundation, version 2 of the License
206 (available at the URL listed under "license" above).
207
208 Eiffel Software's Eiffel Development Environment is
209 distributed in the hope that it will be useful, but
210 WITHOUT ANY WARRANTY; without even the implied warranty
211 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
212 See the GNU General Public License for more details.
213
214 You should have received a copy of the GNU General Public
215 License along with Eiffel Software's Eiffel Development
216 Environment; if not, write to the Free Software Foundation,
217 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
218 ]"
219 source: "[
220 Eiffel Software
221 5949 Hollister Ave., Goleta, CA 93117 USA
222 Telephone 805-685-1006, Fax 805-685-6869
223 Website http://www.eiffel.com
224 Customer support http://support.eiffel.com
225 ]"
226
227 end

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.23