/[eiffelstudio]/vendor/gobosoft.com/gobo/4.0d/library/tools/src/eiffel/ast/type/et_like_n.e
ViewVC logotype

Contents of /vendor/gobosoft.com/gobo/4.0d/library/tools/src/eiffel/ast/type/et_like_n.e

Parent Directory Parent Directory | Revision Log Revision Log


Revision 98698 - (show annotations)
Mon May 9 13:53:54 2016 UTC (3 years, 5 months ago) by manus
File size: 43572 byte(s)
Update 4.0d version with changes in Gobo from 2016/05/09

1 note
2
3 description:
4
5 "Eiffel types appearing in nested type contexts and representing n-th type in these contexts"
6
7 library: "Gobo Eiffel Tools Library"
8 copyright: "Copyright (c) 2015-2016, Eric Bezault and others"
9 license: "MIT License"
10 date: "$Date$"
11 revision: "$Revision$"
12
13 class ET_LIKE_N
14
15 inherit
16
17 ET_LIKE_TYPE
18 redefine
19 named_type_with_type_mark,
20 shallow_named_type_with_type_mark,
21 named_type_has_class,
22 same_named_class_type_with_type_marks,
23 same_named_formal_parameter_type_with_type_marks,
24 same_named_tuple_type_with_type_marks,
25 same_base_class_type_with_type_marks,
26 same_base_formal_parameter_type_with_type_marks,
27 same_base_tuple_type_with_type_marks,
28 conforms_from_class_type_with_type_marks,
29 conforms_from_formal_parameter_type_with_type_marks,
30 conforms_from_tuple_type_with_type_marks,
31 type_with_type_mark,
32 is_type_reference_with_type_mark,
33 is_type_detachable_with_type_mark
34 end
35
36 create
37
38 make_zero,
39 make
40
41 feature {NONE} -- Initialization
42
43 make_zero (a_type_mark: like type_mark)
44 -- Create a new 'like 0' type.
45 do
46 type_mark := a_type_mark
47 like_keyword := tokens.like_keyword
48 index := 0
49 previous := Current
50 ensure
51 type_mark_set: type_mark = a_type_mark
52 zero: index = 0
53 end
54
55 make (a_type_mark: like type_mark; a_previous: ET_LIKE_N)
56 -- Create a new 'like N' type.
57 require
58 a_previous_not_void: a_previous /= Void
59 do
60 type_mark := a_type_mark
61 like_keyword := tokens.like_keyword
62 previous := a_previous
63 index := a_previous.index + 1
64 ensure
65 type_mark_set: type_mark = a_type_mark
66 previous_set: previous = a_previous
67 index_set: index = a_previous.index + 1
68 end
69
70 feature -- Access
71
72 like_keyword: ET_KEYWORD
73 -- 'like' keyword
74
75 index: INTEGER
76 -- Index in nested type context
77
78 previous: ET_LIKE_N
79 -- Previous index in nested type context
80
81 named_base_class (a_context: ET_TYPE_CONTEXT): ET_NAMED_CLASS
82 -- Same as `base_class' except that it returns information about this
83 -- class (e.g. its name) as known from the universe it is used from
84 -- (instead of from the universe it is written in).
85 -- Return "*UNKNOWN*" class if unresolved identifier type,
86 -- or unmatched formal generic parameter.
87 local
88 l_previous_context: ET_NESTED_TYPE_CONTEXT
89 do
90 l_previous_context := a_context.as_nested_type_context
91 if l_previous_context.valid_index (index) then
92 l_previous_context := a_context.as_nested_type_context
93 l_previous_context.force_last (previous)
94 Result := l_previous_context.item (index).named_base_class (l_previous_context)
95 l_previous_context.remove_last
96 else
97 -- We reached the root context.
98 Result := l_previous_context.root_context.named_base_class
99 end
100 end
101
102 base_type_with_type_mark (a_type_mark: detachable ET_TYPE_MARK; a_context: ET_TYPE_CONTEXT): ET_BASE_TYPE
103 -- Same as `base_type' except that its type mark status is
104 -- overridden by `a_type_mark', if not Void
105 local
106 l_previous_context: ET_NESTED_TYPE_CONTEXT
107 do
108 l_previous_context := a_context.as_nested_type_context
109 if l_previous_context.valid_index (index) then
110 l_previous_context.force_last (previous)
111 Result := l_previous_context.item (index).base_type_with_type_mark (overridden_type_mark (a_type_mark), l_previous_context)
112 l_previous_context.remove_last
113 else
114 -- We reached the root context.
115 l_previous_context.force_last (tokens.like_0)
116 Result := l_previous_context.root_context.base_type_with_type_mark (overridden_type_mark (a_type_mark), l_previous_context)
117 l_previous_context.remove_last
118 end
119 end
120
121 shallow_base_type_with_type_mark (a_type_mark: detachable ET_TYPE_MARK; a_context: ET_TYPE_CONTEXT): ET_BASE_TYPE
122 -- Same as `shallow_base_type' except that its type mark status is
123 -- overridden by `a_type_mark', if not Void
124 local
125 l_previous_context: ET_NESTED_TYPE_CONTEXT
126 do
127 l_previous_context := a_context.as_nested_type_context
128 if l_previous_context.valid_index (index) then
129 l_previous_context.force_last (previous)
130 Result := l_previous_context.item (index).shallow_base_type_with_type_mark (overridden_type_mark (a_type_mark), l_previous_context)
131 l_previous_context.remove_last
132 else
133 -- We reached the root context.
134 l_previous_context.force_last (tokens.like_0)
135 Result := l_previous_context.root_context.shallow_base_type_with_type_mark (overridden_type_mark (a_type_mark), l_previous_context)
136 l_previous_context.remove_last
137 end
138 end
139
140 base_type_actual (i: INTEGER; a_context: ET_TYPE_CONTEXT): ET_NAMED_TYPE
141 -- `i'-th actual generic parameter's type of the base type of current
142 -- type when it appears in `a_context'
143 local
144 l_previous_context: ET_NESTED_TYPE_CONTEXT
145 do
146 l_previous_context := a_context.as_nested_type_context
147 if l_previous_context.valid_index (index) then
148 l_previous_context.force_last (previous)
149 Result := l_previous_context.item (index).base_type_actual (i, l_previous_context)
150 l_previous_context.remove_last
151 else
152 -- We reached the root context.
153 l_previous_context.force_last (tokens.like_0)
154 Result := l_previous_context.root_context.base_type_actual (i, l_previous_context)
155 l_previous_context.remove_last
156 end
157 end
158
159 base_type_actual_parameter (i: INTEGER; a_context: ET_TYPE_CONTEXT): ET_ACTUAL_PARAMETER
160 -- `i'-th actual generic parameter of the base type of current
161 -- type when it appears in `a_context'
162 local
163 l_previous_context: ET_NESTED_TYPE_CONTEXT
164 do
165 l_previous_context := a_context.as_nested_type_context
166 if l_previous_context.valid_index (index) then
167 l_previous_context.force_last (previous)
168 Result := l_previous_context.item (index).base_type_actual_parameter (i, l_previous_context)
169 l_previous_context.remove_last
170 else
171 -- We reached the root context.
172 l_previous_context.force_last (tokens.like_0)
173 Result := l_previous_context.root_context.base_type_actual_parameter (i, l_previous_context)
174 l_previous_context.remove_last
175 end
176 end
177
178 base_type_index_of_label (a_label: ET_IDENTIFIER; a_context: ET_TYPE_CONTEXT): INTEGER
179 -- Index of actual generic parameter with label `a_label' in
180 -- the base type of current type when it appears in `a_context';
181 -- 0 if it does not exist
182 local
183 l_previous_context: ET_NESTED_TYPE_CONTEXT
184 do
185 l_previous_context := a_context.as_nested_type_context
186 if l_previous_context.valid_index (index) then
187 l_previous_context.force_last (previous)
188 Result := l_previous_context.item (index).base_type_index_of_label (a_label, l_previous_context)
189 l_previous_context.remove_last
190 else
191 -- We reached the root context.
192 l_previous_context.force_last (tokens.like_0)
193 Result := l_previous_context.root_context.base_type_index_of_label (a_label, l_previous_context)
194 l_previous_context.remove_last
195 end
196 end
197
198 named_type_with_type_mark (a_type_mark: detachable ET_TYPE_MARK; a_context: ET_TYPE_CONTEXT): ET_NAMED_TYPE
199 -- Same as `named_type' except that its type mark status is
200 -- overridden by `a_type_mark', if not Void
201 local
202 l_previous_context: ET_NESTED_TYPE_CONTEXT
203 do
204 l_previous_context := a_context.as_nested_type_context
205 if l_previous_context.valid_index (index) then
206 l_previous_context.force_last (previous)
207 Result := l_previous_context.item (index).named_type_with_type_mark (overridden_type_mark (a_type_mark), l_previous_context)
208 l_previous_context.remove_last
209 else
210 -- We reached the root context.
211 l_previous_context.force_last (tokens.like_0)
212 Result := l_previous_context.root_context.named_type_with_type_mark (overridden_type_mark (a_type_mark), l_previous_context)
213 l_previous_context.remove_last
214 end
215 end
216
217 shallow_named_type_with_type_mark (a_type_mark: detachable ET_TYPE_MARK; a_context: ET_TYPE_CONTEXT): ET_NAMED_TYPE
218 -- Same as `shallow_named_type' except that its type mark status is
219 -- overridden by `a_type_mark', if not Void
220 local
221 l_previous_context: ET_NESTED_TYPE_CONTEXT
222 do
223 l_previous_context := a_context.as_nested_type_context
224 if l_previous_context.valid_index (index) then
225 l_previous_context.force_last (previous)
226 Result := l_previous_context.item (index).shallow_named_type_with_type_mark (overridden_type_mark (a_type_mark), l_previous_context)
227 l_previous_context.remove_last
228 else
229 -- We reached the root context.
230 l_previous_context.force_last (tokens.like_0)
231 Result := l_previous_context.root_context.shallow_named_type_with_type_mark (overridden_type_mark (a_type_mark), l_previous_context)
232 l_previous_context.remove_last
233 end
234 end
235
236 type_with_type_mark (a_type_mark: detachable ET_TYPE_MARK): ET_LIKE_N
237 -- Current type whose type mark status is
238 -- overridden by `a_type_mark', if not Void
239 local
240 l_type_mark: detachable ET_TYPE_MARK
241 do
242 l_type_mark := overridden_type_mark (a_type_mark)
243 if l_type_mark = type_mark then
244 Result := Current
245 else
246 create Result.make (a_type_mark, previous)
247 Result.set_like_keyword (like_keyword)
248 end
249 end
250
251 hash_code: INTEGER
252 -- Hash code
253 do
254 Result := 1
255 end
256
257 position: ET_POSITION
258 -- Position of first character of
259 -- current node in source code
260 do
261 if attached type_mark as l_type_mark and then not l_type_mark.is_implicit_mark and then not l_type_mark.position.is_null then
262 Result := l_type_mark.position
263 else
264 Result := like_keyword.position
265 end
266 end
267
268 last_leaf: ET_AST_LEAF
269 -- Last leaf node in current node
270 do
271 Result := like_keyword
272 end
273
274 feature -- Measurement
275
276 base_type_actual_count (a_context: ET_TYPE_CONTEXT): INTEGER
277 -- Number of actual generic parameters of the base type of current type
278 local
279 l_previous_context: ET_NESTED_TYPE_CONTEXT
280 do
281 l_previous_context := a_context.as_nested_type_context
282 if l_previous_context.valid_index (index) then
283 l_previous_context.force_last (previous)
284 Result := l_previous_context.item (index).base_type_actual_count (l_previous_context)
285 l_previous_context.remove_last
286 else
287 -- We reached the root context.
288 l_previous_context.force_last (tokens.like_0)
289 Result := l_previous_context.root_context.base_type_actual_count (l_previous_context)
290 l_previous_context.remove_last
291 end
292 end
293
294 feature -- Setting
295
296 set_like_keyword (a_like: like like_keyword)
297 -- Set `like_keyword' to `a_like'.
298 require
299 a_like_not_void: a_like /= Void
300 do
301 like_keyword := a_like
302 ensure
303 like_keyword_set: like_keyword = a_like
304 end
305
306 feature -- Status report
307
308 is_type_expanded_with_type_mark (a_type_mark: detachable ET_TYPE_MARK; a_context: ET_TYPE_CONTEXT): BOOLEAN
309 -- Same as `is_type_expanded' except that the type mark status is
310 -- overridden by `a_type_mark', if not Void
311 local
312 l_previous_context: ET_NESTED_TYPE_CONTEXT
313 do
314 l_previous_context := a_context.as_nested_type_context
315 if l_previous_context.valid_index (index) then
316 l_previous_context.force_last (previous)
317 Result := l_previous_context.item (index).is_type_expanded_with_type_mark (overridden_type_mark (a_type_mark), l_previous_context)
318 l_previous_context.remove_last
319 else
320 -- We reached the root context.
321 l_previous_context.force_last (tokens.like_0)
322 Result := l_previous_context.root_context.is_type_expanded_with_type_mark (overridden_type_mark (a_type_mark), l_previous_context)
323 l_previous_context.remove_last
324 end
325 end
326
327 is_type_reference_with_type_mark (a_type_mark: detachable ET_TYPE_MARK; a_context: ET_TYPE_CONTEXT): BOOLEAN
328 -- Same as `is_type_reference' except that the type mark status is
329 -- overridden by `a_type_mark', if not Void
330 local
331 l_previous_context: ET_NESTED_TYPE_CONTEXT
332 do
333 l_previous_context := a_context.as_nested_type_context
334 if l_previous_context.valid_index (index) then
335 l_previous_context.force_last (previous)
336 Result := l_previous_context.item (index).is_type_reference_with_type_mark (overridden_type_mark (a_type_mark), l_previous_context)
337 l_previous_context.remove_last
338 else
339 -- We reached the root context.
340 l_previous_context.force_last (tokens.like_0)
341 Result := l_previous_context.root_context.is_type_reference_with_type_mark (overridden_type_mark (a_type_mark), l_previous_context)
342 l_previous_context.remove_last
343 end
344 end
345
346 is_type_attached_with_type_mark (a_type_mark: detachable ET_TYPE_MARK; a_context: ET_TYPE_CONTEXT): BOOLEAN
347 -- Same as `is_type_attached' except that the type mark status is
348 -- overridden by `a_type_mark', if not Void
349 local
350 l_previous_context: ET_NESTED_TYPE_CONTEXT
351 do
352 l_previous_context := a_context.as_nested_type_context
353 if l_previous_context.valid_index (index) then
354 l_previous_context.force_last (previous)
355 Result := l_previous_context.item (index).is_type_attached_with_type_mark (overridden_type_mark (a_type_mark), l_previous_context)
356 l_previous_context.remove_last
357 else
358 -- We reached the root context.
359 l_previous_context.force_last (tokens.like_0)
360 Result := l_previous_context.root_context.is_type_attached_with_type_mark (overridden_type_mark (a_type_mark), l_previous_context)
361 l_previous_context.remove_last
362 end
363 end
364
365 is_type_detachable_with_type_mark (a_type_mark: detachable ET_TYPE_MARK; a_context: ET_TYPE_CONTEXT): BOOLEAN
366 -- Same as `is_type_detachable' except that the type mark status is
367 -- overridden by `a_type_mark', if not Void
368 local
369 l_previous_context: ET_NESTED_TYPE_CONTEXT
370 do
371 l_previous_context := a_context.as_nested_type_context
372 if l_previous_context.valid_index (index) then
373 l_previous_context.force_last (previous)
374 Result := l_previous_context.item (index).is_type_detachable_with_type_mark (overridden_type_mark (a_type_mark), l_previous_context)
375 l_previous_context.remove_last
376 else
377 -- We reached the root context.
378 l_previous_context.force_last (tokens.like_0)
379 Result := l_previous_context.root_context.is_type_detachable_with_type_mark (overridden_type_mark (a_type_mark), l_previous_context)
380 l_previous_context.remove_last
381 end
382 end
383
384 base_type_has_class (a_class: ET_CLASS; a_context: ET_TYPE_CONTEXT): BOOLEAN
385 -- Does the base type of current type contain `a_class'
386 -- when it appears in `a_context'?
387 local
388 l_previous_context: ET_NESTED_TYPE_CONTEXT
389 do
390 l_previous_context := a_context.as_nested_type_context
391 if l_previous_context.valid_index (index) then
392 l_previous_context.force_last (previous)
393 Result := l_previous_context.item (index).base_type_has_class (a_class, l_previous_context)
394 l_previous_context.remove_last
395 else
396 -- We reached the root context.
397 l_previous_context.force_last (tokens.like_0)
398 Result := l_previous_context.root_context.base_type_has_class (a_class, l_previous_context)
399 l_previous_context.remove_last
400 end
401 end
402
403 named_type_has_class (a_class: ET_CLASS; a_context: ET_TYPE_CONTEXT): BOOLEAN
404 -- Does the named type of current type contain `a_class'
405 -- when it appears in `a_context'?
406 local
407 l_previous_context: ET_NESTED_TYPE_CONTEXT
408 do
409 l_previous_context := a_context.as_nested_type_context
410 if l_previous_context.valid_index (index) then
411 l_previous_context.force_last (previous)
412 Result := l_previous_context.item (index).named_type_has_class (a_class, l_previous_context)
413 l_previous_context.remove_last
414 else
415 -- We reached the root context.
416 l_previous_context.force_last (tokens.like_0)
417 Result := l_previous_context.root_context.named_type_has_class (a_class, l_previous_context)
418 l_previous_context.remove_last
419 end
420 end
421
422 feature -- Comparison
423
424 same_syntactical_type_with_type_marks (other: ET_TYPE; other_type_mark: detachable ET_TYPE_MARK; other_context: ET_TYPE_CONTEXT; a_type_mark: detachable ET_TYPE_MARK; a_context: ET_TYPE_CONTEXT): BOOLEAN
425 -- Same as `same_syntactical_type' except that the type mark status of `Current'
426 -- and `other' is overridden by `a_type_mark' and `other_type_mark', if not Void
427 do
428 -- 'like N' is not a syntactical type.
429 Result := False
430 end
431
432 same_named_type_with_type_marks (other: ET_TYPE; other_type_mark: detachable ET_TYPE_MARK; other_context: ET_TYPE_CONTEXT; a_type_mark: detachable ET_TYPE_MARK; a_context: ET_TYPE_CONTEXT): BOOLEAN
433 -- Same as `same_named_type' except that the type mark status of `Current'
434 -- and `other' is overridden by `a_type_mark' and `other_type_mark', if not Void
435 local
436 l_previous_context: ET_NESTED_TYPE_CONTEXT
437 do
438 if other = Current and then other_type_mark = a_type_mark and then other_context = a_context then
439 Result := True
440 else
441 l_previous_context := a_context.as_nested_type_context
442 if l_previous_context.valid_index (index) then
443 if a_context /= other_context then
444 l_previous_context.force_last (previous)
445 Result := l_previous_context.item (index).same_named_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_previous_context)
446 l_previous_context.remove_last
447 else
448 l_previous_context := a_context.to_nested_type_context
449 l_previous_context.force_last (previous)
450 Result := l_previous_context.item (index).same_named_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_previous_context)
451 end
452 else
453 -- We reached the root context.
454 if l_previous_context.is_root_context then
455 Result := l_previous_context.root_context.same_named_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_previous_context)
456 elseif a_context /= other_context then
457 l_previous_context.force_last (tokens.like_0)
458 Result := l_previous_context.root_context.same_named_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_previous_context)
459 l_previous_context.remove_last
460 else
461 l_previous_context := a_context.to_nested_type_context
462 l_previous_context.force_last (tokens.like_0)
463 Result := l_previous_context.root_context.same_named_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_previous_context)
464 end
465 end
466 end
467 end
468
469 same_base_type_with_type_marks (other: ET_TYPE; other_type_mark: detachable ET_TYPE_MARK; other_context: ET_TYPE_CONTEXT; a_type_mark: detachable ET_TYPE_MARK; a_context: ET_TYPE_CONTEXT): BOOLEAN
470 -- Same as `same_base_type' except that the type mark status of `Current'
471 -- and `other' is overridden by `a_type_mark' and `other_type_mark', if not Void
472 local
473 l_previous_context: ET_NESTED_TYPE_CONTEXT
474 do
475 if other = Current and then other_type_mark = a_type_mark and then other_context = a_context then
476 Result := True
477 else
478 l_previous_context := a_context.as_nested_type_context
479 if l_previous_context.valid_index (index) then
480 if a_context /= other_context then
481 l_previous_context.force_last (previous)
482 Result := l_previous_context.item (index).same_base_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_previous_context)
483 l_previous_context.remove_last
484 else
485 l_previous_context := a_context.to_nested_type_context
486 l_previous_context.force_last (previous)
487 Result := l_previous_context.item (index).same_base_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_previous_context)
488 end
489 else
490 -- We reached the root context.
491 if l_previous_context.is_root_context then
492 Result := l_previous_context.root_context.same_base_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_previous_context)
493 elseif a_context /= other_context then
494 l_previous_context.force_last (tokens.like_0)
495 Result := l_previous_context.root_context.same_base_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_previous_context)
496 l_previous_context.remove_last
497 else
498 l_previous_context := a_context.to_nested_type_context
499 l_previous_context.force_last (tokens.like_0)
500 Result := l_previous_context.root_context.same_base_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_previous_context)
501 end
502 end
503 end
504 end
505
506 feature {ET_TYPE, ET_TYPE_CONTEXT} -- Comparison
507
508 same_named_class_type_with_type_marks (other: ET_CLASS_TYPE; other_type_mark: detachable ET_TYPE_MARK; other_context: ET_TYPE_CONTEXT; a_type_mark: detachable ET_TYPE_MARK; a_context: ET_TYPE_CONTEXT): BOOLEAN
509 -- Do current type appearing in `a_context' and `other' type
510 -- appearing in `other_context' have the same named type?
511 -- Note that the type mark status of `Current' and `other' is
512 -- overridden by `a_type_mark' and `other_type_mark', if not Void
513 local
514 l_previous_context: ET_NESTED_TYPE_CONTEXT
515 do
516 l_previous_context := a_context.as_nested_type_context
517 if l_previous_context.valid_index (index) then
518 if a_context /= other_context then
519 l_previous_context.force_last (previous)
520 Result := l_previous_context.item (index).same_named_class_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_previous_context)
521 l_previous_context.remove_last
522 else
523 l_previous_context := a_context.to_nested_type_context
524 l_previous_context.force_last (previous)
525 Result := l_previous_context.item (index).same_named_class_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_previous_context)
526 end
527 else
528 -- We reached the root context.
529 if l_previous_context.is_root_context then
530 Result := l_previous_context.root_context.same_named_class_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_previous_context)
531 elseif a_context /= other_context then
532 l_previous_context.force_last (tokens.like_0)
533 Result := l_previous_context.root_context.same_named_class_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_previous_context)
534 l_previous_context.remove_last
535 else
536 l_previous_context := a_context.to_nested_type_context
537 l_previous_context.force_last (tokens.like_0)
538 Result := l_previous_context.root_context.same_named_class_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_previous_context)
539 end
540 end
541 end
542
543 same_named_formal_parameter_type_with_type_marks (other: ET_FORMAL_PARAMETER_TYPE; other_type_mark: detachable ET_TYPE_MARK; other_context: ET_TYPE_CONTEXT; a_type_mark: detachable ET_TYPE_MARK; a_context: ET_TYPE_CONTEXT): BOOLEAN
544 -- Do current type appearing in `a_context' and `other' type
545 -- appearing in `other_context' have the same named type?
546 -- Note that the type mark status of `Current' and `other' is
547 -- overridden by `a_type_mark' and `other_type_mark', if not Void
548 local
549 l_previous_context: ET_NESTED_TYPE_CONTEXT
550 do
551 l_previous_context := a_context.as_nested_type_context
552 if l_previous_context.valid_index (index) then
553 if a_context /= other_context then
554 l_previous_context.force_last (previous)
555 Result := l_previous_context.item (index).same_named_formal_parameter_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_previous_context)
556 l_previous_context.remove_last
557 else
558 l_previous_context := a_context.to_nested_type_context
559 l_previous_context.force_last (previous)
560 Result := l_previous_context.item (index).same_named_formal_parameter_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_previous_context)
561 end
562 else
563 -- We reached the root context.
564 if l_previous_context.is_root_context then
565 Result := l_previous_context.root_context.same_named_formal_parameter_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_previous_context)
566 elseif a_context /= other_context then
567 l_previous_context.force_last (tokens.like_0)
568 Result := l_previous_context.root_context.same_named_formal_parameter_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_previous_context)
569 l_previous_context.remove_last
570 else
571 l_previous_context := a_context.to_nested_type_context
572 l_previous_context.force_last (tokens.like_0)
573 Result := l_previous_context.root_context.same_named_formal_parameter_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_previous_context)
574 end
575 end
576 end
577
578 same_named_tuple_type_with_type_marks (other: ET_TUPLE_TYPE; other_type_mark: detachable ET_TYPE_MARK; other_context: ET_TYPE_CONTEXT; a_type_mark: detachable ET_TYPE_MARK; a_context: ET_TYPE_CONTEXT): BOOLEAN
579 -- Do current type appearing in `a_context' and `other' type
580 -- appearing in `other_context' have the same named type?
581 -- Note that the type mark status of `Current' and `other' is
582 -- overridden by `a_type_mark' and `other_type_mark', if not Void
583 local
584 l_previous_context: ET_NESTED_TYPE_CONTEXT
585 do
586 l_previous_context := a_context.as_nested_type_context
587 if l_previous_context.valid_index (index) then
588 if a_context /= other_context then
589 l_previous_context.force_last (previous)
590 Result := l_previous_context.item (index).same_named_tuple_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_previous_context)
591 l_previous_context.remove_last
592 else
593 l_previous_context := a_context.to_nested_type_context
594 l_previous_context.force_last (previous)
595 Result := l_previous_context.item (index).same_named_tuple_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_previous_context)
596 end
597 else
598 -- We reached the root context.
599 if l_previous_context.is_root_context then
600 Result := l_previous_context.root_context.same_named_tuple_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_previous_context)
601 elseif a_context /= other_context then
602 l_previous_context.force_last (tokens.like_0)
603 Result := l_previous_context.root_context.same_named_tuple_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_previous_context)
604 l_previous_context.remove_last
605 else
606 l_previous_context := a_context.to_nested_type_context
607 l_previous_context.force_last (tokens.like_0)
608 Result := l_previous_context.root_context.same_named_tuple_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_previous_context)
609 end
610 end
611 end
612
613 same_base_class_type_with_type_marks (other: ET_CLASS_TYPE; other_type_mark: detachable ET_TYPE_MARK; other_context: ET_TYPE_CONTEXT; a_type_mark: detachable ET_TYPE_MARK; a_context: ET_TYPE_CONTEXT): BOOLEAN
614 -- Do current type appearing in `a_context' and `other' type
615 -- appearing in `other_context' have the same base type?
616 -- Note that the type mark status of `Current' and `other' is
617 -- overridden by `a_type_mark' and `other_type_mark', if not Void
618 local
619 l_previous_context: ET_NESTED_TYPE_CONTEXT
620 do
621 l_previous_context := a_context.as_nested_type_context
622 if l_previous_context.valid_index (index) then
623 if a_context /= other_context then
624 l_previous_context.force_last (previous)
625 Result := l_previous_context.item (index).same_base_class_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_previous_context)
626 l_previous_context.remove_last
627 else
628 l_previous_context := a_context.to_nested_type_context
629 l_previous_context.force_last (previous)
630 Result := l_previous_context.item (index).same_base_class_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_previous_context)
631 end
632 else
633 -- We reached the root context.
634 if l_previous_context.is_root_context then
635 Result := l_previous_context.root_context.same_base_class_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_previous_context)
636 elseif a_context /= other_context then
637 l_previous_context.force_last (tokens.like_0)
638 Result := l_previous_context.root_context.same_base_class_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_previous_context)
639 l_previous_context.remove_last
640 else
641 l_previous_context := a_context.to_nested_type_context
642 l_previous_context.force_last (tokens.like_0)
643 Result := l_previous_context.root_context.same_base_class_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_previous_context)
644 end
645 end
646 end
647
648 same_base_formal_parameter_type_with_type_marks (other: ET_FORMAL_PARAMETER_TYPE; other_type_mark: detachable ET_TYPE_MARK; other_context: ET_TYPE_CONTEXT; a_type_mark: detachable ET_TYPE_MARK; a_context: ET_TYPE_CONTEXT): BOOLEAN
649 -- Do current type appearing in `a_context' and `other' type
650 -- appearing in `other_context' have the same base type?
651 -- Note that the type mark status of `Current' and `other' is
652 -- overridden by `a_type_mark' and `other_type_mark', if not Void
653 local
654 l_previous_context: ET_NESTED_TYPE_CONTEXT
655 do
656 l_previous_context := a_context.as_nested_type_context
657 if l_previous_context.valid_index (index) then
658 if a_context /= other_context then
659 l_previous_context.force_last (previous)
660 Result := l_previous_context.item (index).same_base_formal_parameter_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_previous_context)
661 l_previous_context.remove_last
662 else
663 l_previous_context := a_context.to_nested_type_context
664 l_previous_context.force_last (previous)
665 Result := l_previous_context.item (index).same_base_formal_parameter_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_previous_context)
666 end
667 else
668 -- We reached the root context.
669 if l_previous_context.is_root_context then
670 Result := l_previous_context.root_context.same_base_formal_parameter_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_previous_context)
671 elseif a_context /= other_context then
672 l_previous_context.force_last (tokens.like_0)
673 Result := l_previous_context.root_context.same_base_formal_parameter_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_previous_context)
674 l_previous_context.remove_last
675 else
676 l_previous_context := a_context.to_nested_type_context
677 l_previous_context.force_last (tokens.like_0)
678 Result := l_previous_context.root_context.same_base_formal_parameter_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_previous_context)
679 end
680 end
681 end
682
683 same_base_tuple_type_with_type_marks (other: ET_TUPLE_TYPE; other_type_mark: detachable ET_TYPE_MARK; other_context: ET_TYPE_CONTEXT; a_type_mark: detachable ET_TYPE_MARK; a_context: ET_TYPE_CONTEXT): BOOLEAN
684 -- Do current type appearing in `a_context' and `other' type
685 -- appearing in `other_context' have the same base type?
686 -- Note that the type mark status of `Current' and `other' is
687 -- overridden by `a_type_mark' and `other_type_mark', if not Void
688 local
689 l_previous_context: ET_NESTED_TYPE_CONTEXT
690 do
691 l_previous_context := a_context.as_nested_type_context
692 if l_previous_context.valid_index (index) then
693 if a_context /= other_context then
694 l_previous_context.force_last (previous)
695 Result := l_previous_context.item (index).same_base_tuple_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_previous_context)
696 l_previous_context.remove_last
697 else
698 l_previous_context := a_context.to_nested_type_context
699 l_previous_context.force_last (previous)
700 Result := l_previous_context.item (index).same_base_tuple_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_previous_context)
701 end
702 else
703 -- We reached the root context.
704 if l_previous_context.is_root_context then
705 Result := l_previous_context.root_context.same_base_tuple_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_previous_context)
706 elseif a_context /= other_context then
707 l_previous_context.force_last (tokens.like_0)
708 Result := l_previous_context.root_context.same_base_tuple_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_previous_context)
709 l_previous_context.remove_last
710 else
711 l_previous_context := a_context.to_nested_type_context
712 l_previous_context.force_last (tokens.like_0)
713 Result := l_previous_context.root_context.same_base_tuple_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_previous_context)
714 end
715 end
716 end
717
718 feature -- Conformance
719
720 conforms_to_type_with_type_marks (other: ET_TYPE; other_type_mark: detachable ET_TYPE_MARK; other_context: ET_TYPE_CONTEXT; a_type_mark: detachable ET_TYPE_MARK; a_context: ET_TYPE_CONTEXT): BOOLEAN
721 -- Same as `conforms_to_type' except that the type mark status of `Current'
722 -- and `other' is overridden by `a_type_mark' and `other_type_mark', if not Void
723 local
724 l_previous_context: ET_NESTED_TYPE_CONTEXT
725 do
726 if other = Current and then other_type_mark = a_type_mark and then other_context = a_context then
727 Result := True
728 else
729 l_previous_context := a_context.as_nested_type_context
730 if l_previous_context.valid_index (index) then
731 if a_context /= other_context then
732 l_previous_context.force_last (previous)
733 Result := l_previous_context.item (index).conforms_to_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_previous_context)
734 l_previous_context.remove_last
735 else
736 l_previous_context := a_context.to_nested_type_context
737 l_previous_context.force_last (previous)
738 Result := l_previous_context.item (index).conforms_to_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_previous_context)
739 end
740 else
741 -- We reached the root context.
742 if l_previous_context.is_root_context then
743 Result := l_previous_context.root_context.conforms_to_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_previous_context)
744 elseif a_context /= other_context then
745 l_previous_context.force_last (tokens.like_0)
746 Result := l_previous_context.root_context.conforms_to_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_previous_context)
747 l_previous_context.remove_last
748 else
749 l_previous_context := a_context.to_nested_type_context
750 l_previous_context.force_last (tokens.like_0)
751 Result := l_previous_context.root_context.conforms_to_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_previous_context)
752 end
753 end
754 end
755 end
756
757 feature {ET_TYPE, ET_TYPE_CONTEXT} -- Conformance
758
759 conforms_from_class_type_with_type_marks (other: ET_CLASS_TYPE; other_type_mark: detachable ET_TYPE_MARK; other_context: ET_TYPE_CONTEXT; a_type_mark: detachable ET_TYPE_MARK; a_context: ET_TYPE_CONTEXT): BOOLEAN
760 -- Does `other' type appearing in `other_context' conform
761 -- to current type appearing in `a_context'?
762 -- Note that the type mark status of `Current' and `other' is
763 -- overridden by `a_type_mark' and `other_type_mark', if not Void
764 -- (Note: 'current_system.ancestor_builder' is used on the classes
765 -- whose ancestors need to be built in order to check for conformance.)
766 local
767 l_previous_context: ET_NESTED_TYPE_CONTEXT
768 do
769 l_previous_context := a_context.as_nested_type_context
770 if l_previous_context.valid_index (index) then
771 if a_context /= other_context then
772 l_previous_context.force_last (previous)
773 Result := l_previous_context.item (index).conforms_from_class_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_previous_context)
774 l_previous_context.remove_last
775 else
776 l_previous_context := a_context.to_nested_type_context
777 l_previous_context.force_last (previous)
778 Result := l_previous_context.item (index).conforms_from_class_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_previous_context)
779 end
780 else
781 -- We reached the root context.
782 if l_previous_context.is_root_context then
783 Result := l_previous_context.root_context.conforms_from_class_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_previous_context)
784 elseif a_context /= other_context then
785 l_previous_context.force_last (tokens.like_0)
786 Result := l_previous_context.root_context.conforms_from_class_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_previous_context)
787 l_previous_context.remove_last
788 else
789 l_previous_context := a_context.to_nested_type_context
790 l_previous_context.force_last (tokens.like_0)
791 Result := l_previous_context.root_context.conforms_from_class_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_previous_context)
792 end
793 end
794 end
795
796 conforms_from_formal_parameter_type_with_type_marks (other: ET_FORMAL_PARAMETER_TYPE; other_type_mark: detachable ET_TYPE_MARK; other_context: ET_TYPE_CONTEXT; a_type_mark: detachable ET_TYPE_MARK; a_context: ET_TYPE_CONTEXT): BOOLEAN
797 -- Does `other' type appearing in `other_context' conform
798 -- to current type appearing in `a_context'?
799 -- Note that the type mark status of `Current' and `other' is
800 -- overridden by `a_type_mark' and `other_type_mark', if not Void
801 -- (Note: 'current_system.ancestor_builder' is used on the classes
802 -- whose ancestors need to be built in order to check for conformance.)
803 local
804 l_previous_context: ET_NESTED_TYPE_CONTEXT
805 do
806 l_previous_context := a_context.as_nested_type_context
807 if l_previous_context.valid_index (index) then
808 if a_context /= other_context then
809 l_previous_context.force_last (previous)
810 Result := l_previous_context.item (index).conforms_from_formal_parameter_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_previous_context)
811 l_previous_context.remove_last
812 else
813 l_previous_context := a_context.to_nested_type_context
814 l_previous_context.force_last (previous)
815 Result := l_previous_context.item (index).conforms_from_formal_parameter_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_previous_context)
816 end
817 else
818 -- We reached the root context.
819 if l_previous_context.is_root_context then
820 Result := l_previous_context.root_context.conforms_from_formal_parameter_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_previous_context)
821 elseif a_context /= other_context then
822 l_previous_context.force_last (tokens.like_0)
823 Result := l_previous_context.root_context.conforms_from_formal_parameter_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_previous_context)
824 l_previous_context.remove_last
825 else
826 l_previous_context := a_context.to_nested_type_context
827 l_previous_context.force_last (tokens.like_0)
828 Result := l_previous_context.root_context.conforms_from_formal_parameter_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_previous_context)
829 end
830 end
831 end
832
833 conforms_from_tuple_type_with_type_marks (other: ET_TUPLE_TYPE; other_type_mark: detachable ET_TYPE_MARK; other_context: ET_TYPE_CONTEXT; a_type_mark: detachable ET_TYPE_MARK; a_context: ET_TYPE_CONTEXT): BOOLEAN
834 -- Does `other' type appearing in `other_context' conform
835 -- to current type appearing in `a_context'?
836 -- Note that the type mark status of `Current' and `other' is
837 -- overridden by `a_type_mark' and `other_type_mark', if not Void
838 -- (Note: 'current_system.ancestor_builder' is used on the classes
839 -- whose ancestors need to be built in order to check for conformance.)
840 local
841 l_previous_context: ET_NESTED_TYPE_CONTEXT
842 do
843 l_previous_context := a_context.as_nested_type_context
844 if l_previous_context.valid_index (index) then
845 if a_context /= other_context then
846 l_previous_context.force_last (previous)
847 Result := l_previous_context.item (index).conforms_from_tuple_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_previous_context)
848 l_previous_context.remove_last
849 else
850 l_previous_context := a_context.to_nested_type_context
851 l_previous_context.force_last (previous)
852 Result := l_previous_context.item (index).conforms_from_tuple_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_previous_context)
853 end
854 else
855 -- We reached the root context.
856 if l_previous_context.is_root_context then
857 Result := l_previous_context.root_context.conforms_from_tuple_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_previous_context)
858 elseif a_context /= other_context then
859 l_previous_context.force_last (tokens.like_0)
860 Result := l_previous_context.root_context.conforms_from_tuple_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_previous_context)
861 l_previous_context.remove_last
862 else
863 l_previous_context := a_context.to_nested_type_context
864 l_previous_context.force_last (tokens.like_0)
865 Result := l_previous_context.root_context.conforms_from_tuple_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_previous_context)
866 end
867 end
868 end
869
870 feature -- Output
871
872 append_to_string (a_string: STRING)
873 -- Append textual representation of
874 -- current type to `a_string'.
875 do
876 if attached type_mark as l_type_mark then
877 if l_type_mark.is_implicit_mark then
878 a_string.append_character ('[')
879 end
880 a_string.append_string (l_type_mark.text)
881 if l_type_mark.is_implicit_mark then
882 a_string.append_character (']')
883 end
884 a_string.append_character (' ')
885 end
886 a_string.append_string (like_space)
887 a_string.append_integer (index)
888 end
889
890 feature -- Processing
891
892 process (a_processor: ET_AST_PROCESSOR)
893 -- Process current node.
894 do
895 a_processor.process_like_n (Current)
896 end
897
898 invariant
899
900 index_not_negative: index >= 0
901 previous_not_void: previous /= Void
902 previous_definition: previous.index = (index - 1).max (0)
903
904 end

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.23