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

Contents of /vendor/gobosoft.com/gobo/4.0d/library/tools/src/eiffel/ast/type/et_qualified_like_identifier.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: 40705 byte(s)
Update 4.0d version with changes in Gobo from 2016/05/09

1 note
2
3 description:
4
5 "Eiffel qualified anchored types"
6
7 library: "Gobo Eiffel Tools Library"
8 copyright: "Copyright (c) 2003-2016, Eric Bezault and others"
9 license: "MIT License"
10 date: "$Date$"
11 revision: "$Revision$"
12
13 deferred class ET_QUALIFIED_LIKE_IDENTIFIER
14
15 inherit
16
17 ET_LIKE_IDENTIFIER
18 redefine
19 reset,
20 reset_qualified_anchored_types,
21 named_type_with_type_mark,
22 shallow_named_type_with_type_mark,
23 named_type_has_class,
24 named_type_is_formal_type,
25 depends_on_qualified_anchored_type,
26 has_formal_types,
27 same_syntactical_qualified_like_identifier_with_type_marks,
28 same_named_class_type_with_type_marks,
29 same_named_formal_parameter_type_with_type_marks,
30 same_named_tuple_type_with_type_marks,
31 same_base_class_type_with_type_marks,
32 same_base_formal_parameter_type_with_type_marks,
33 same_base_tuple_type_with_type_marks,
34 conforms_from_class_type_with_type_marks,
35 conforms_from_formal_parameter_type_with_type_marks,
36 conforms_from_tuple_type_with_type_marks,
37 is_type_reference_with_type_mark,
38 is_type_detachable_with_type_mark
39 end
40
41 feature -- Initialization
42
43 reset
44 -- Reset type as it was just after it was last parsed.
45 do
46 name.reset
47 target_type.reset
48 end
49
50 reset_qualified_anchored_types
51 -- Reset qualified anchored types contained in current type
52 -- as they were just after they were last parsed.
53 do
54 name.reset
55 target_type.reset_qualified_anchored_types
56 end
57
58 feature -- Access
59
60 target_type: ET_TYPE
61 -- Target anchored type
62 deferred
63 ensure
64 target_type_not_void: Result /= Void
65 end
66
67 name: ET_FEATURE_NAME
68 -- Name of the feature in `target_type'
69 -- associated with current type
70 do
71 Result := qualified_name.feature_name
72 ensure then
73 definition: Result = qualified_name.feature_name
74 end
75
76 qualified_name: ET_QUALIFIED_FEATURE_NAME
77 -- Qualified feature name
78
79 seed: INTEGER
80 -- Feature ID of one of the seeds of the
81 -- feature associated with current type;
82 -- 0 if not resolved yet
83 do
84 Result := name.seed
85 end
86
87 named_base_class (a_context: ET_TYPE_CONTEXT): ET_NAMED_CLASS
88 -- Same as `base_class' except that it returns information about this
89 -- class (e.g. its name) as known from the universe it is used from
90 -- (instead of from the universe it is written in).
91 -- Return "*UNKNOWN*" class if unresolved identifier type,
92 -- or unmatched formal generic parameter.
93 local
94 l_class: ET_CLASS
95 l_target_type: ET_TYPE
96 l_target_context: ET_NESTED_TYPE_CONTEXT
97 do
98 if seed = 0 then
99 -- Qualified anchored type not resolved yet.
100 Result := tokens.unknown_class
101 else
102 l_target_type := target_type
103 l_class := l_target_type.base_class (a_context)
104 if attached l_class.seeded_query (seed) as l_query then
105 l_target_context := a_context.as_nested_type_context
106 l_target_context.force_last (l_target_type)
107 Result := l_query.type.named_base_class (l_target_context)
108 l_target_context.remove_last
109 else
110 -- Internal error: an inconsistency has been
111 -- introduced in the AST since we resolved
112 -- current qualified anchored type.
113 Result := tokens.unknown_class
114 end
115 end
116 end
117
118 base_type_with_type_mark (a_type_mark: detachable ET_TYPE_MARK; a_context: ET_TYPE_CONTEXT): ET_BASE_TYPE
119 -- Same as `base_type' except that its type mark status is
120 -- overridden by `a_type_mark', if not Void
121 local
122 l_class: ET_CLASS
123 l_target_type: ET_TYPE
124 l_target_context: ET_NESTED_TYPE_CONTEXT
125 do
126 if seed = 0 then
127 -- Qualified anchored type not resolved yet.
128 Result := tokens.unknown_class
129 else
130 l_target_type := target_type
131 l_class := l_target_type.base_class (a_context)
132 if attached l_class.seeded_query (seed) as l_query then
133 l_target_context := a_context.as_nested_type_context
134 l_target_context.force_last (l_target_type)
135 Result := l_query.type.base_type_with_type_mark (overridden_type_mark (a_type_mark), l_target_context)
136 l_target_context.remove_last
137 else
138 -- Internal error: an inconsistency has been
139 -- introduced in the AST since we resolved
140 -- current qualified anchored type.
141 Result := tokens.unknown_class
142 end
143 end
144 end
145
146 shallow_base_type_with_type_mark (a_type_mark: detachable ET_TYPE_MARK; a_context: ET_TYPE_CONTEXT): ET_BASE_TYPE
147 -- Same as `shallow_base_type' except that its type mark status is
148 -- overridden by `a_type_mark', if not Void
149 local
150 l_class: ET_CLASS
151 l_target_type: ET_TYPE
152 l_target_context: ET_NESTED_TYPE_CONTEXT
153 do
154 if seed = 0 then
155 -- Qualified anchored type not resolved yet.
156 Result := tokens.unknown_class
157 else
158 l_target_type := target_type
159 l_class := l_target_type.base_class (a_context)
160 if attached l_class.seeded_query (seed) as l_query then
161 l_target_context := a_context.as_nested_type_context
162 l_target_context.force_last (l_target_type)
163 -- Here we have to use `base_type' and not `shallow_base_type'
164 -- because otherwise the actual generic parameters will not
165 -- be viewed from `a_context' but from `l_target_context'.
166 Result := l_query.type.base_type_with_type_mark (overridden_type_mark (a_type_mark), l_target_context)
167 l_target_context.remove_last
168 else
169 -- Internal error: an inconsistency has been
170 -- introduced in the AST since we resolved
171 -- current qualified anchored type.
172 Result := tokens.unknown_class
173 end
174 end
175 end
176
177 base_type_actual (i: INTEGER; a_context: ET_TYPE_CONTEXT): ET_NAMED_TYPE
178 -- `i'-th actual generic parameter's type of the base type of current
179 -- type when it appears in `a_context'
180 local
181 l_class: ET_CLASS
182 l_target_type: ET_TYPE
183 l_target_context: ET_NESTED_TYPE_CONTEXT
184 do
185 if seed = 0 then
186 -- Qualified anchored type not resolved yet.
187 Result := tokens.unknown_class
188 else
189 l_target_type := target_type
190 l_class := l_target_type.base_class (a_context)
191 if attached l_class.seeded_query (seed) as l_query then
192 l_target_context := a_context.as_nested_type_context
193 l_target_context.force_last (l_target_type)
194 Result := l_query.type.base_type_actual (i, l_target_context)
195 l_target_context.remove_last
196 else
197 -- Internal error: an inconsistency has been
198 -- introduced in the AST since we resolved
199 -- current qualified anchored type.
200 Result := tokens.unknown_class
201 end
202 end
203 end
204
205 base_type_actual_parameter (i: INTEGER; a_context: ET_TYPE_CONTEXT): ET_ACTUAL_PARAMETER
206 -- `i'-th actual generic parameter of the base type of current
207 -- type when it appears in `a_context'
208 local
209 l_class: ET_CLASS
210 l_target_type: ET_TYPE
211 l_target_context: ET_NESTED_TYPE_CONTEXT
212 do
213 if seed = 0 then
214 -- Qualified anchored type not resolved yet.
215 Result := tokens.unknown_class
216 else
217 l_target_type := target_type
218 l_class := l_target_type.base_class (a_context)
219 if attached l_class.seeded_query (seed) as l_query then
220 l_target_context := a_context.as_nested_type_context
221 l_target_context.force_last (l_target_type)
222 Result := l_query.type.base_type_actual_parameter (i, l_target_context)
223 l_target_context.remove_last
224 else
225 -- Internal error: an inconsistency has been
226 -- introduced in the AST since we resolved
227 -- current qualified anchored type.
228 Result := tokens.unknown_class
229 end
230 end
231 end
232
233 base_type_index_of_label (a_label: ET_IDENTIFIER; a_context: ET_TYPE_CONTEXT): INTEGER
234 -- Index of actual generic parameter with label `a_label' in
235 -- the base type of current type when it appears in `a_context';
236 -- 0 if it does not exist
237 local
238 l_class: ET_CLASS
239 l_target_type: ET_TYPE
240 l_target_context: ET_NESTED_TYPE_CONTEXT
241 do
242 if seed = 0 then
243 -- Qualified anchored type not resolved yet.
244 Result := 0
245 else
246 l_target_type := target_type
247 l_class := l_target_type.base_class (a_context)
248 if attached l_class.seeded_query (seed) as l_query then
249 l_target_context := a_context.as_nested_type_context
250 l_target_context.force_last (l_target_type)
251 Result := l_query.type.base_type_index_of_label (a_label, l_target_context)
252 l_target_context.remove_last
253 else
254 -- Internal error: an inconsistency has been
255 -- introduced in the AST since we resolved
256 -- current qualified anchored type.
257 Result := 0
258 end
259 end
260 end
261
262 named_type_with_type_mark (a_type_mark: detachable ET_TYPE_MARK; a_context: ET_TYPE_CONTEXT): ET_NAMED_TYPE
263 -- Same as `named_type' except that its type mark status is
264 -- overridden by `a_type_mark', if not Void
265 local
266 l_class: ET_CLASS
267 l_target_type: ET_TYPE
268 l_target_context: ET_NESTED_TYPE_CONTEXT
269 do
270 if seed = 0 then
271 -- Qualified anchored type not resolved yet.
272 Result := tokens.unknown_class
273 else
274 l_target_type := target_type
275 l_class := l_target_type.base_class (a_context)
276 if attached l_class.seeded_query (seed) as l_query then
277 l_target_context := a_context.as_nested_type_context
278 l_target_context.force_last (l_target_type)
279 Result := l_query.type.named_type_with_type_mark (overridden_type_mark (a_type_mark), l_target_context)
280 l_target_context.remove_last
281 else
282 -- Internal error: an inconsistency has been
283 -- introduced in the AST since we resolved
284 -- current qualified anchored type.
285 Result := tokens.unknown_class
286 end
287 end
288 end
289
290 shallow_named_type_with_type_mark (a_type_mark: detachable ET_TYPE_MARK; a_context: ET_TYPE_CONTEXT): ET_NAMED_TYPE
291 -- Same as `shallow_named_type' except that its type mark status is
292 -- overridden by `a_type_mark', if not Void
293 local
294 l_class: ET_CLASS
295 l_target_type: ET_TYPE
296 l_target_context: ET_NESTED_TYPE_CONTEXT
297 do
298 if seed = 0 then
299 -- Qualified anchored type not resolved yet.
300 Result := tokens.unknown_class
301 else
302 l_target_type := target_type
303 l_class := l_target_type.base_class (a_context)
304 if attached l_class.seeded_query (seed) as l_query then
305 l_target_context := a_context.as_nested_type_context
306 l_target_context.force_last (l_target_type)
307 -- Here we have to use `named_type' and not `shallow_named_type'
308 -- because otherwise the actual generic parameters will not
309 -- be viewed from `a_context' but from `l_target_context'.
310 Result := l_query.type.named_type_with_type_mark (overridden_type_mark (a_type_mark), l_target_context)
311 l_target_context.remove_last
312 else
313 -- Internal error: an inconsistency has been
314 -- introduced in the AST since we resolved
315 -- current qualified anchored type.
316 Result := tokens.unknown_class
317 end
318 end
319 end
320
321 hash_code: INTEGER
322 -- Hash code
323 do
324 Result := seed
325 end
326
327 position: ET_POSITION
328 -- Position of first character of
329 -- current node in source code
330 do
331 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
332 Result := l_type_mark.position
333 else
334 Result := like_keyword.position
335 end
336 if Result.is_null then
337 Result := target_type.position
338 end
339 end
340
341 last_leaf: ET_AST_LEAF
342 -- Last leaf node in current node
343 do
344 Result := qualified_name.last_leaf
345 end
346
347 feature -- Measurement
348
349 base_type_actual_count (a_context: ET_TYPE_CONTEXT): INTEGER
350 -- Number of actual generic parameters of the base type of current type
351 local
352 l_class: ET_CLASS
353 l_target_type: ET_TYPE
354 l_target_context: ET_NESTED_TYPE_CONTEXT
355 do
356 if seed = 0 then
357 -- Qualified anchored type not resolved yet.
358 Result := 0
359 else
360 l_target_type := target_type
361 l_class := l_target_type.base_class (a_context)
362 if attached l_class.seeded_query (seed) as l_query then
363 l_target_context := a_context.as_nested_type_context
364 l_target_context.force_last (l_target_type)
365 Result := l_query.type.base_type_actual_count (l_target_context)
366 l_target_context.remove_last
367 else
368 -- Internal error: an inconsistency has been
369 -- introduced in the AST since we resolved
370 -- current qualified anchored type.
371 Result := 0
372 end
373 end
374 end
375
376 feature -- Status report
377
378 is_type_expanded_with_type_mark (a_type_mark: detachable ET_TYPE_MARK; a_context: ET_TYPE_CONTEXT): BOOLEAN
379 -- Same as `is_type_expanded' except that the type mark status is
380 -- overridden by `a_type_mark', if not Void
381 local
382 l_class: ET_CLASS
383 l_target_type: ET_TYPE
384 l_target_context: ET_NESTED_TYPE_CONTEXT
385 do
386 if seed = 0 then
387 -- Qualified anchored type not resolved yet.
388 Result := False
389 else
390 l_target_type := target_type
391 l_class := l_target_type.base_class (a_context)
392 if attached l_class.seeded_query (seed) as l_query then
393 l_target_context := a_context.as_nested_type_context
394 l_target_context.force_last (l_target_type)
395 Result := l_query.type.is_type_expanded_with_type_mark (overridden_type_mark (a_type_mark), l_target_context)
396 l_target_context.remove_last
397 else
398 -- Internal error: an inconsistency has been
399 -- introduced in the AST since we resolved
400 -- current qualified anchored type.
401 Result := False
402 end
403 end
404 end
405
406 is_type_reference_with_type_mark (a_type_mark: detachable ET_TYPE_MARK; a_context: ET_TYPE_CONTEXT): BOOLEAN
407 -- Same as `is_type_reference' except that the type mark status is
408 -- overridden by `a_type_mark', if not Void
409 local
410 l_class: ET_CLASS
411 l_target_type: ET_TYPE
412 l_target_context: ET_NESTED_TYPE_CONTEXT
413 do
414 if seed = 0 then
415 -- Qualified anchored type not resolved yet.
416 Result := False
417 else
418 l_target_type := target_type
419 l_class := l_target_type.base_class (a_context)
420 if attached l_class.seeded_query (seed) as l_query then
421 l_target_context := a_context.as_nested_type_context
422 l_target_context.force_last (l_target_type)
423 Result := l_query.type.is_type_reference_with_type_mark (overridden_type_mark (a_type_mark), l_target_context)
424 l_target_context.remove_last
425 else
426 -- Internal error: an inconsistency has been
427 -- introduced in the AST since we resolved
428 -- current qualified anchored type.
429 Result := False
430 end
431 end
432 end
433
434 is_type_attached_with_type_mark (a_type_mark: detachable ET_TYPE_MARK; a_context: ET_TYPE_CONTEXT): BOOLEAN
435 -- Same as `is_type_attached' except that the type mark status is
436 -- overridden by `a_type_mark', if not Void
437 local
438 l_class: ET_CLASS
439 l_target_type: ET_TYPE
440 l_target_context: ET_NESTED_TYPE_CONTEXT
441 do
442 if seed = 0 then
443 -- Qualified anchored type not resolved yet.
444 Result := False
445 else
446 l_target_type := target_type
447 l_class := l_target_type.base_class (a_context)
448 if attached l_class.seeded_query (seed) as l_query then
449 l_target_context := a_context.as_nested_type_context
450 l_target_context.force_last (l_target_type)
451 Result := l_query.type.is_type_attached_with_type_mark (overridden_type_mark (a_type_mark), l_target_context)
452 l_target_context.remove_last
453 else
454 -- Internal error: an inconsistency has been
455 -- introduced in the AST since we resolved
456 -- current qualified anchored type.
457 Result := False
458 end
459 end
460 end
461
462 is_type_detachable_with_type_mark (a_type_mark: detachable ET_TYPE_MARK; a_context: ET_TYPE_CONTEXT): BOOLEAN
463 -- Same as `is_type_detachable' except that the type mark status is
464 -- overridden by `a_type_mark', if not Void
465 local
466 l_class: ET_CLASS
467 l_target_type: ET_TYPE
468 l_target_context: ET_NESTED_TYPE_CONTEXT
469 do
470 if seed = 0 then
471 -- Qualified anchored type not resolved yet.
472 Result := False
473 else
474 l_target_type := target_type
475 l_class := l_target_type.base_class (a_context)
476 if attached l_class.seeded_query (seed) as l_query then
477 l_target_context := a_context.as_nested_type_context
478 l_target_context.force_last (l_target_type)
479 Result := l_query.type.is_type_detachable_with_type_mark (overridden_type_mark (a_type_mark), l_target_context)
480 l_target_context.remove_last
481 else
482 -- Internal error: an inconsistency has been
483 -- introduced in the AST since we resolved
484 -- current qualified anchored type.
485 Result := False
486 end
487 end
488 end
489
490 depends_on_qualified_anchored_type (a_context: ET_TYPE_CONTEXT): BOOLEAN
491 -- Does current type depend on a qualified anchored type when
492 -- viewed from `a_context' when trying to determine its base type?
493 do
494 Result := True
495 end
496
497 has_formal_types (a_context: ET_TYPE_CONTEXT): BOOLEAN
498 -- Does current type contain a formal generic parameter
499 -- when viewed from `a_context'?
500 do
501 Result := target_type.has_formal_types (a_context)
502 end
503
504 named_type_is_formal_type (a_context: ET_TYPE_CONTEXT): BOOLEAN
505 -- Is named type of current type, or if it is a qualified type
506 -- is the named type of its target type (recursively),
507 -- a formal parameter when viewed from `a_context'?
508 local
509 l_base_class: ET_CLASS
510 l_target_type: ET_TYPE
511 l_target_context: ET_NESTED_TYPE_CONTEXT
512 do
513 l_target_type := target_type
514 if l_target_type.named_type_is_formal_type (a_context) then
515 Result := True
516 elseif seed = 0 then
517 -- Qualified anchored type not resolved yet.
518 Result := False
519 else
520 l_base_class := l_target_type.base_class (a_context)
521 if attached l_base_class.seeded_query (seed) as l_query then
522 l_target_context := a_context.as_nested_type_context
523 l_target_context.force_last (l_target_type)
524 Result := l_query.type.named_type_is_formal_type (l_target_context)
525 l_target_context.remove_last
526 else
527 -- Internal error: an inconsistency has been
528 -- introduced in the AST since we resolved
529 -- current qualified anchored type.
530 Result := False
531 end
532 end
533 end
534
535 base_type_has_class (a_class: ET_CLASS; a_context: ET_TYPE_CONTEXT): BOOLEAN
536 -- Does the base type of current type contain `a_class'
537 -- when it appears in `a_context'?
538 local
539 l_base_class: ET_CLASS
540 l_target_type: ET_TYPE
541 l_target_context: ET_NESTED_TYPE_CONTEXT
542 do
543 if seed = 0 then
544 -- Qualified anchored type not resolved yet.
545 Result := a_class.is_unknown
546 else
547 l_target_type := target_type
548 l_base_class := l_target_type.base_class (a_context)
549 if attached l_base_class.seeded_query (seed) as l_query then
550 l_target_context := a_context.as_nested_type_context
551 l_target_context.force_last (l_target_type)
552 Result := l_query.type.base_type_has_class (a_class, l_target_context)
553 l_target_context.remove_last
554 else
555 -- Internal error: an inconsistency has been
556 -- introduced in the AST since we resolved
557 -- current qualified anchored type.
558 Result := a_class.is_unknown
559 end
560 end
561 end
562
563 named_type_has_class (a_class: ET_CLASS; a_context: ET_TYPE_CONTEXT): BOOLEAN
564 -- Does the named type of current type contain `a_class'
565 -- when it appears in `a_context'?
566 local
567 l_base_class: ET_CLASS
568 l_target_type: ET_TYPE
569 l_target_context: ET_NESTED_TYPE_CONTEXT
570 do
571 if seed = 0 then
572 -- Qualified anchored type not resolved yet.
573 Result := a_class.is_unknown
574 else
575 l_target_type := target_type
576 l_base_class := l_target_type.base_class (a_context)
577 if attached l_base_class.seeded_query (seed) as l_query then
578 l_target_context := a_context.as_nested_type_context
579 l_target_context.force_last (l_target_type)
580 Result := l_query.type.named_type_has_class (a_class, l_target_context)
581 l_target_context.remove_last
582 else
583 -- Internal error: an inconsistency has been
584 -- introduced in the AST since we resolved
585 -- current qualified anchored type.
586 Result := a_class.is_unknown
587 end
588 end
589 end
590
591 feature -- Comparison
592
593 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
594 -- Same as `same_syntactical_type' except that the type mark status of `Current'
595 -- and `other' is overridden by `a_type_mark' and `other_type_mark', if not Void
596 do
597 if other = Current and then other_type_mark = a_type_mark and then other_context = a_context then
598 Result := True
599 else
600 Result := other.same_syntactical_qualified_like_identifier_with_type_marks (Current, a_type_mark, a_context, other_type_mark, other_context)
601 end
602 end
603
604 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
605 -- Same as `same_named_type' except that the type mark status of `Current'
606 -- and `other' is overridden by `a_type_mark' and `other_type_mark', if not Void
607 local
608 l_class: ET_CLASS
609 l_target_type: ET_TYPE
610 l_target_context: ET_NESTED_TYPE_CONTEXT
611 do
612 if other = Current and then other_type_mark = a_type_mark and then other_context = a_context then
613 Result := True
614 elseif seed = 0 then
615 -- Qualified anchored type not resolved yet.
616 Result := False
617 else
618 l_target_type := target_type
619 l_class := l_target_type.base_class (a_context)
620 if attached l_class.seeded_query (seed) as l_query then
621 if a_context /= other_context then
622 l_target_context := a_context.as_nested_type_context
623 else
624 l_target_context := a_context.to_nested_type_context
625 end
626 l_target_context.force_last (l_target_type)
627 Result := l_query.type.same_named_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_target_context)
628 l_target_context.remove_last
629 else
630 -- Internal error: an inconsistency has been
631 -- introduced in the AST since we resolved
632 -- current qualified anchored type.
633 Result := False
634 end
635 end
636 end
637
638 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
639 -- Same as `same_base_type' except that the type mark status of `Current'
640 -- and `other' is overridden by `a_type_mark' and `other_type_mark', if not Void
641 local
642 l_class: ET_CLASS
643 l_target_type: ET_TYPE
644 l_target_context: ET_NESTED_TYPE_CONTEXT
645 do
646 if other = Current and then other_type_mark = a_type_mark and then other_context = a_context then
647 Result := True
648 elseif seed = 0 then
649 -- Qualified anchored type not resolved yet.
650 Result := False
651 else
652 l_target_type := target_type
653 l_class := l_target_type.base_class (a_context)
654 if attached l_class.seeded_query (seed) as l_query then
655 if a_context /= other_context then
656 l_target_context := a_context.as_nested_type_context
657 else
658 l_target_context := a_context.to_nested_type_context
659 end
660 l_target_context.force_last (l_target_type)
661 Result := l_query.type.same_base_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_target_context)
662 l_target_context.remove_last
663 else
664 -- Internal error: an inconsistency has been
665 -- introduced in the AST since we resolved
666 -- current qualified anchored type.
667 Result := False
668 end
669 end
670 end
671
672 feature {ET_TYPE, ET_TYPE_CONTEXT} -- Comparison
673
674 same_syntactical_qualified_like_identifier_with_type_marks (other: ET_QUALIFIED_LIKE_IDENTIFIER; 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
675 -- Are current type appearing in `a_context' and `other'
676 -- type appearing in `other_context' the same type?
677 -- (Note: We are NOT comparing the base types here!
678 -- Therefore anchored types are considered the same
679 -- only if they have the same anchor. An anchor type
680 -- is not considered the same as any other type even
681 -- if they have the same base type.)
682 -- Note that the type mark status of `Current' and `other' is
683 -- overridden by `a_type_mark' and `other_type_mark', if not Void
684 local
685 l_query: detachable ET_QUERY
686 l_class: ET_CLASS
687 l_target_type: ET_TYPE
688 l_other_target_type: ET_TYPE
689 do
690 if other = Current and then other_type_mark = a_type_mark and then other_context = a_context then
691 Result := True
692 elseif seed = 0 then
693 -- Qualified anchored type not resolved yet.
694 Result := False
695 elseif a_context.attachment_type_conformance_mode and then not same_attachment_marks_with_default (overridden_type_mark (a_type_mark), other.overridden_type_mark (other_type_mark), Void) then
696 Result := False
697 else
698 -- They should have the same target type.
699 l_target_type := target_type
700 l_other_target_type := other.target_type
701 if l_target_type.same_syntactical_type (l_other_target_type, other_context, a_context) then
702 -- They should refer to the same feature.
703 if other.seed = seed then
704 Result := True
705 else
706 l_class := l_other_target_type.base_class (other_context)
707 l_query := l_class.seeded_query (other.seed)
708 Result := l_query /= Void and then l_query.has_seed (seed)
709 if not Result then
710 l_class := l_target_type.base_class (a_context)
711 l_query := l_class.seeded_query (seed)
712 Result := l_query /= Void and then l_query.has_seed (other.seed)
713 end
714 end
715 end
716 end
717 end
718
719 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
720 -- Do current type appearing in `a_context' and `other' type
721 -- appearing in `other_context' have the same named type?
722 -- Note that the type mark status of `Current' and `other' is
723 -- overridden by `a_type_mark' and `other_type_mark', if not Void
724 local
725 l_class: ET_CLASS
726 l_target_type: ET_TYPE
727 l_target_context: ET_NESTED_TYPE_CONTEXT
728 do
729 if seed = 0 then
730 -- Qualified anchored type not resolved yet.
731 Result := False
732 else
733 l_target_type := target_type
734 l_class := l_target_type.base_class (a_context)
735 if attached l_class.seeded_query (seed) as l_query then
736 if a_context /= other_context then
737 l_target_context := a_context.as_nested_type_context
738 else
739 l_target_context := a_context.to_nested_type_context
740 end
741 l_target_context.force_last (l_target_type)
742 Result := l_query.type.same_named_class_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_target_context)
743 l_target_context.remove_last
744 else
745 -- Internal error: an inconsistency has been
746 -- introduced in the AST since we resolved
747 -- current qualified anchored type.
748 Result := False
749 end
750 end
751 end
752
753 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
754 -- Do current type appearing in `a_context' and `other' type
755 -- appearing in `other_context' have the same named type?
756 -- Note that the type mark status of `Current' and `other' is
757 -- overridden by `a_type_mark' and `other_type_mark', if not Void
758 local
759 l_class: ET_CLASS
760 l_target_type: ET_TYPE
761 l_target_context: ET_NESTED_TYPE_CONTEXT
762 do
763 if seed = 0 then
764 -- Qualified anchored type not resolved yet.
765 Result := False
766 else
767 l_target_type := target_type
768 l_class := l_target_type.base_class (a_context)
769 if attached l_class.seeded_query (seed) as l_query then
770 if a_context /= other_context then
771 l_target_context := a_context.as_nested_type_context
772 else
773 l_target_context := a_context.to_nested_type_context
774 end
775 l_target_context.force_last (l_target_type)
776 Result := l_query.type.same_named_formal_parameter_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_target_context)
777 l_target_context.remove_last
778 else
779 -- Internal error: an inconsistency has been
780 -- introduced in the AST since we resolved
781 -- current qualified anchored type.
782 Result := False
783 end
784 end
785 end
786
787 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
788 -- Do current type appearing in `a_context' and `other' type
789 -- appearing in `other_context' have the same named type?
790 -- Note that the type mark status of `Current' and `other' is
791 -- overridden by `a_type_mark' and `other_type_mark', if not Void
792 local
793 l_class: ET_CLASS
794 l_target_type: ET_TYPE
795 l_target_context: ET_NESTED_TYPE_CONTEXT
796 do
797 if seed = 0 then
798 -- Qualified anchored type not resolved yet.
799 Result := False
800 else
801 l_target_type := target_type
802 l_class := l_target_type.base_class (a_context)
803 if attached l_class.seeded_query (seed) as l_query then
804 if a_context /= other_context then
805 l_target_context := a_context.as_nested_type_context
806 else
807 l_target_context := a_context.to_nested_type_context
808 end
809 l_target_context.force_last (l_target_type)
810 Result := l_query.type.same_named_tuple_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_target_context)
811 l_target_context.remove_last
812 else
813 -- Internal error: an inconsistency has been
814 -- introduced in the AST since we resolved
815 -- current qualified anchored type.
816 Result := False
817 end
818 end
819 end
820
821 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
822 -- Do current type appearing in `a_context' and `other' type
823 -- appearing in `other_context' have the same base type?
824 -- Note that the type mark status of `Current' and `other' is
825 -- overridden by `a_type_mark' and `other_type_mark', if not Void
826 local
827 l_class: ET_CLASS
828 l_target_type: ET_TYPE
829 l_target_context: ET_NESTED_TYPE_CONTEXT
830 do
831 if seed = 0 then
832 -- Qualified anchored type not resolved yet.
833 Result := False
834 else
835 l_target_type := target_type
836 l_class := l_target_type.base_class (a_context)
837 if attached l_class.seeded_query (seed) as l_query then
838 if a_context /= other_context then
839 l_target_context := a_context.as_nested_type_context
840 else
841 l_target_context := a_context.to_nested_type_context
842 end
843 l_target_context.force_last (l_target_type)
844 Result := l_query.type.same_base_class_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_target_context)
845 l_target_context.remove_last
846 else
847 -- Internal error: an inconsistency has been
848 -- introduced in the AST since we resolved
849 -- current qualified anchored type.
850 Result := False
851 end
852 end
853 end
854
855 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
856 -- Do current type appearing in `a_context' and `other' type
857 -- appearing in `other_context' have the same base type?
858 -- Note that the type mark status of `Current' and `other' is
859 -- overridden by `a_type_mark' and `other_type_mark', if not Void
860 local
861 l_class: ET_CLASS
862 l_target_type: ET_TYPE
863 l_target_context: ET_NESTED_TYPE_CONTEXT
864 do
865 if seed = 0 then
866 -- Qualified anchored type not resolved yet.
867 Result := False
868 else
869 l_target_type := target_type
870 l_class := l_target_type.base_class (a_context)
871 if attached l_class.seeded_query (seed) as l_query then
872 if a_context /= other_context then
873 l_target_context := a_context.as_nested_type_context
874 else
875 l_target_context := a_context.to_nested_type_context
876 end
877 l_target_context.force_last (l_target_type)
878 Result := l_query.type.same_base_formal_parameter_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_target_context)
879 l_target_context.remove_last
880 else
881 -- Internal error: an inconsistency has been
882 -- introduced in the AST since we resolved
883 -- current qualified anchored type.
884 Result := False
885 end
886 end
887 end
888
889 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
890 -- Do current type appearing in `a_context' and `other' type
891 -- appearing in `other_context' have the same base type?
892 -- Note that the type mark status of `Current' and `other' is
893 -- overridden by `a_type_mark' and `other_type_mark', if not Void
894 local
895 l_class: ET_CLASS
896 l_target_type: ET_TYPE
897 l_target_context: ET_NESTED_TYPE_CONTEXT
898 do
899 if seed = 0 then
900 -- Qualified anchored type not resolved yet.
901 Result := False
902 else
903 l_target_type := target_type
904 l_class := l_target_type.base_class (a_context)
905 if attached l_class.seeded_query (seed) as l_query then
906 if a_context /= other_context then
907 l_target_context := a_context.as_nested_type_context
908 else
909 l_target_context := a_context.to_nested_type_context
910 end
911 l_target_context.force_last (l_target_type)
912 Result := l_query.type.same_base_tuple_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_target_context)
913 l_target_context.remove_last
914 else
915 -- Internal error: an inconsistency has been
916 -- introduced in the AST since we resolved
917 -- current qualified anchored type.
918 Result := False
919 end
920 end
921 end
922
923 feature -- Conformance
924
925 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
926 -- Same as `conforms_to_type' except that the type mark status of `Current'
927 -- and `other' is overridden by `a_type_mark' and `other_type_mark', if not Void
928 local
929 l_class: ET_CLASS
930 l_target_type: ET_TYPE
931 l_target_context: ET_NESTED_TYPE_CONTEXT
932 do
933 if other = Current and then other_type_mark = a_type_mark and then other_context = a_context then
934 Result := True
935 elseif seed = 0 then
936 -- Qualified anchored type not resolved yet.
937 Result := False
938 else
939 l_target_type := target_type
940 l_class := l_target_type.base_class (a_context)
941 if attached l_class.seeded_query (seed) as l_query then
942 if a_context /= other_context then
943 l_target_context := a_context.as_nested_type_context
944 else
945 l_target_context := a_context.to_nested_type_context
946 end
947 l_target_context.force_last (l_target_type)
948 Result := l_query.type.conforms_to_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_target_context)
949 l_target_context.remove_last
950 else
951 -- Internal error: an inconsistency has been
952 -- introduced in the AST since we resolved
953 -- current qualified anchored type.
954 Result := False
955 end
956 end
957 end
958
959 feature {ET_TYPE, ET_TYPE_CONTEXT} -- Conformance
960
961 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
962 -- Does `other' type appearing in `other_context' conform
963 -- to current type appearing in `a_context'?
964 -- Note that the type mark status of `Current' and `other' is
965 -- overridden by `a_type_mark' and `other_type_mark', if not Void
966 -- (Note: 'current_system.ancestor_builder' is used on the classes
967 -- whose ancestors need to be built in order to check for conformance.)
968 local
969 l_class: ET_CLASS
970 l_target_type: ET_TYPE
971 l_target_context: ET_NESTED_TYPE_CONTEXT
972 do
973 if seed = 0 then
974 -- Qualified anchored type not resolved yet.
975 Result := False
976 else
977 l_target_type := target_type
978 l_class := l_target_type.base_class (a_context)
979 if attached l_class.seeded_query (seed) as l_query then
980 if a_context /= other_context then
981 l_target_context := a_context.as_nested_type_context
982 else
983 l_target_context := a_context.to_nested_type_context
984 end
985 l_target_context.force_last (l_target_type)
986 Result := l_query.type.conforms_from_class_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_target_context)
987 l_target_context.remove_last
988 else
989 -- Internal error: an inconsistency has been
990 -- introduced in the AST since we resolved
991 -- current qualified anchored type.
992 Result := False
993 end
994 end
995 end
996
997 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
998 -- Does `other' type appearing in `other_context' conform
999 -- to current type appearing in `a_context'?
1000 -- Note that the type mark status of `Current' and `other' is
1001 -- overridden by `a_type_mark' and `other_type_mark', if not Void
1002 -- (Note: 'current_system.ancestor_builder' is used on the classes
1003 -- whose ancestors need to be built in order to check for conformance.)
1004 local
1005 l_class: ET_CLASS
1006 l_target_type: ET_TYPE
1007 l_target_context: ET_NESTED_TYPE_CONTEXT
1008 do
1009 if seed = 0 then
1010 -- Qualified anchored type not resolved yet.
1011 Result := False
1012 else
1013 l_target_type := target_type
1014 l_class := l_target_type.base_class (a_context)
1015 if attached l_class.seeded_query (seed) as l_query then
1016 if a_context /= other_context then
1017 l_target_context := a_context.as_nested_type_context
1018 else
1019 l_target_context := a_context.to_nested_type_context
1020 end
1021 l_target_context.force_last (l_target_type)
1022 Result := l_query.type.conforms_from_formal_parameter_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_target_context)
1023 l_target_context.remove_last
1024 else
1025 -- Internal error: an inconsistency has been
1026 -- introduced in the AST since we resolved
1027 -- current qualified anchored type.
1028 Result := False
1029 end
1030 end
1031 end
1032
1033 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
1034 -- Does `other' type appearing in `other_context' conform
1035 -- to current type appearing in `a_context'?
1036 -- Note that the type mark status of `Current' and `other' is
1037 -- overridden by `a_type_mark' and `other_type_mark', if not Void
1038 -- (Note: 'current_system.ancestor_builder' is used on the classes
1039 -- whose ancestors need to be built in order to check for conformance.)
1040 local
1041 l_class: ET_CLASS
1042 l_target_type: ET_TYPE
1043 l_target_context: ET_NESTED_TYPE_CONTEXT
1044 do
1045 if seed = 0 then
1046 -- Qualified anchored type not resolved yet.
1047 Result := False
1048 else
1049 l_target_type := target_type
1050 l_class := l_target_type.base_class (a_context)
1051 if attached l_class.seeded_query (seed) as l_query then
1052 if a_context /= other_context then
1053 l_target_context := a_context.as_nested_type_context
1054 else
1055 l_target_context := a_context.to_nested_type_context
1056 end
1057 l_target_context.force_last (l_target_type)
1058 Result := l_query.type.conforms_from_tuple_type_with_type_marks (other, other_type_mark, other_context, overridden_type_mark (a_type_mark), l_target_context)
1059 l_target_context.remove_last
1060 else
1061 -- Internal error: an inconsistency has been
1062 -- introduced in the AST since we resolved
1063 -- current qualified anchored type.
1064 Result := False
1065 end
1066 end
1067 end
1068
1069 feature -- Resolving
1070
1071 resolve_identifier_type (a_seed: INTEGER)
1072 -- Resolve current type with `a_seed'.
1073 require
1074 a_seed_positive: a_seed > 0
1075 do
1076 name.set_seed (a_seed)
1077 ensure
1078 seed_set: seed = a_seed
1079 end
1080
1081 invariant
1082
1083 qualified_name_not_void: qualified_name /= Void
1084
1085 end

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.23