/[eiffelstudio]/branches/CAT_mono/Src/Eiffel/eiffel/AST/parser_override/type_a.e
ViewVC logotype

Contents of /branches/CAT_mono/Src/Eiffel/eiffel/AST/parser_override/type_a.e

Parent Directory Parent Directory | Revision Log Revision Log


Revision 69868 - (show annotations)
Fri Aug 3 22:28:26 2007 UTC (12 years, 6 months ago) by martins
File size: 27016 byte(s)
enabled more types to store monomorph information
1 indexing
2 description: "Actual type description."
3 legal: "See notice at end of class."
4 status: "See notice at end of class."
5 date: "$Date$"
6 revision: "$Revision$"
7
8 deferred class TYPE_A
9
10 inherit
11 SHARED_TEXT_ITEMS
12 export
13 {NONE} all
14 end
15
16 SHARED_EIFFEL_PROJECT
17 export
18 {NONE} all
19 end
20
21 SHARED_WORKBENCH
22
23 SHARED_TYPE_I
24 export
25 {NONE} all
26 end
27
28 COMPILER_EXPORTER
29 export
30 {NONE} all
31 end
32
33 SHARED_GENERIC_CONSTRAINT
34
35 SHARED_ERROR_HANDLER
36 export
37 {NONE} all
38 end
39
40 SHARED_AST_CONTEXT
41 export
42 {NONE} all
43 end
44
45 CONF_CONSTANTS
46 export
47 {NONE} all
48 end
49
50 feature -- Visitor
51
52 process (v: TYPE_A_VISITOR) is
53 -- Process current element.
54 require
55 v_not_void: v /= Void
56 v_is_valid: v.is_valid
57 deferred
58 end
59
60 feature -- Roundtrip/Token
61
62 first_token (a_list: LEAF_AS_LIST): LEAF_AS is
63 do
64 end
65
66 last_token (a_list: LEAF_AS_LIST): LEAF_AS is
67 do
68 end
69
70 feature -- Properties
71
72 has_renaming: BOOLEAN is
73 -- Does current type have renamed features?
74 -- This can occur in code like: "G -> A rename a as b end"
75 do
76 Result := false
77 end
78
79 has_associated_class: BOOLEAN is
80 -- Does Current have an associated class?
81 do
82 Result := not (is_void or else is_formal or else is_none or else is_type_set or else is_open_type)
83 ensure
84 Yes_if_is: Result implies not (is_void or else
85 is_formal or else is_none or else
86 is_type_set or else is_open_type)
87 end
88
89 generics: ARRAY [TYPE_A] is
90 -- Actual generic types
91 do
92 -- Void
93 end
94
95 is_type_set: BOOLEAN is
96 -- Is curren type a type_set?
97 -- | example: {A, B}
98 do
99 -- False
100 end
101
102 is_valid: BOOLEAN is
103 -- The associated class is still in the system
104 do
105 Result := True
106 end
107
108 is_integer: BOOLEAN is
109 -- Is the current actual type an integer type ?
110 do
111 -- Do nothing
112 end
113
114 is_natural: BOOLEAN is
115 -- Is current actual type a natural type?
116 do
117 -- Do nothing
118 end
119
120 is_real_32: BOOLEAN is
121 -- Is the current actual type a real 32 bits type ?
122 do
123 -- Do nothing
124 end
125
126 is_real_64: BOOLEAN is
127 -- Is the current actual type a real 64 bits type ?
128 do
129 -- Do nothing
130 end
131
132 is_character: BOOLEAN is
133 -- Is the current actual type a character type ?
134 do
135 -- Do nothing
136 end
137
138 is_character_32: BOOLEAN is
139 -- Is the current actual type a character 32 bits type ?
140 do
141 -- Do nothing
142 end
143
144 is_boolean: BOOLEAN is
145 -- Is the current actual type a boolean type ?
146 do
147 -- Do nothing
148 end
149
150 is_bits: BOOLEAN is
151 -- Is the current actual type a bits type ?
152 do
153 -- Do nothing
154 end
155
156 is_formal: BOOLEAN is
157 -- Is the current actual type a formal generic ?
158 do
159 -- Do nothing
160 end
161
162 is_expanded: BOOLEAN is
163 -- Is the current actual type an expanded one ?
164 do
165 -- Do nothing
166 end
167
168 is_enum: BOOLEAN is
169 -- Is the current actual type an external enum one?
170 do
171 -- Do nothing
172 end
173
174 is_renamed_type: BOOLEAN is
175 -- Is current type an instance of `RENAMED_TYPE_A [TYPE_A]'?
176 -- If so there is the possibility that some features of this type are renamed.
177 do
178 end
179
180 is_reference: BOOLEAN is
181 -- Is current actual type a reference one?
182 do
183 Result := not is_expanded
184 end
185
186 is_true_expanded: BOOLEAN is
187 -- Is current actual type an expanded one which is not basic?
188 do
189 Result := is_expanded and not is_basic
190 end
191
192 is_basic: BOOLEAN is
193 -- Is the current actual type a basic type ?
194 do
195 -- Do nothing
196 end
197
198 is_external: BOOLEAN is
199 -- Is current type based on an external one?
200 do
201 end
202
203 is_separate: BOOLEAN is
204 -- Is the current actual type a separate one ?
205 do
206 -- Do nothing
207 end
208
209 is_none: BOOLEAN is
210 -- Is the current actual type a none type ?
211 do
212 -- Do nothing
213 end
214
215 is_like: BOOLEAN is
216 -- Is the current type an anchored one ?
217 do
218 -- Do nothing
219 end
220
221 is_like_argument: BOOLEAN is
222 -- Is the current type a like argument?
223 do
224 -- Do nothing
225 end
226
227 is_like_feature: BOOLEAN is
228 -- Is the current type a like feature?
229 do
230 -- Do nothing
231 end
232
233 is_named_tuple: BOOLEAN is
234 -- Is the current type a tuple with labels?
235 do
236 -- Do nothing
237 end
238
239 is_pointer: BOOLEAN is
240 -- Is the current type a pointer type ?
241 do
242 -- Do nothing
243 end
244
245 is_typed_pointer: BOOLEAN is
246 -- Is current type a typed pointer type ?
247 do
248 -- Do nothing
249 end
250
251 is_tuple: BOOLEAN is
252 -- Is it a TUPLE type
253 do
254 -- Do nothing
255 end
256
257 is_named_type: BOOLEAN is
258 -- Is it a named type?
259 do
260 end
261
262 is_full_named_type: BOOLEAN is
263 -- Is it a full named type?
264 do
265 ensure
266 is_full_named_type_consistent: Result implies is_named_type
267 end
268
269 is_solved: BOOLEAN is
270 do
271 Result := True
272 end
273
274 has_like: BOOLEAN is
275 -- Has the type anchored type in its definition ?
276 do
277 -- Do nothing
278 end
279
280 has_like_argument: BOOLEAN is
281 -- Has the type like argument in its definition?
282 do
283 -- Do nothing
284 end
285
286 has_formal_generic: BOOLEAN is
287 -- Has type a formal generic parameter?
288 do
289 -- False for non-generic type.
290 end
291
292 is_loose: BOOLEAN is
293 -- Does type depend on formal generic parameters and/or anchors?
294 do
295 -- Do nothing
296 ensure
297 definition: Result = (has_like or has_formal_generic)
298 end
299
300 is_void: BOOLEAN is
301 -- Is the type void (procedure type) ?
302 do
303 end
304
305 is_like_current: BOOLEAN is
306 -- Is the current type a anchored type on Current ?
307 do
308 -- Do nothing
309 end
310
311 frozen is_referencing_current: BOOLEAN is
312 -- Is this type anchored in someway to `Current'?
313 --| This is mainly a helper function to increase code readability.
314 local
315 l_type, l_old_type: TYPE_A
316 do
317 Result := actual_type.is_like_current
318 end
319
320 is_monomorph: BOOLEAN is
321 -- Is the current type monomorph?
322 do
323 -- Do nothing
324 end
325
326 is_open_type: BOOLEAN is
327 -- Is the current type an open type?
328 do
329 -- Do nothing
330 end
331
332 feature -- Comparison
333
334 frozen is_safe_equivalent (other: TYPE_A): BOOLEAN is
335 -- Is the current type the same as `other' ?
336 --| `deep_equal' cannot be used as for STRINGS, the area
337 --| can have a different size but the STRING is still
338 --| the same (problem detected for LIKE_FEATURE). Xavier
339 local
340 l_other: like Current
341 do
342 Result := other /= Void and then other.same_type (Current)
343 if Result then
344 l_other ?= other
345 check l_other_not_void: l_other /= Void end
346 Result := is_equivalent (l_other)
347 end
348 end;
349
350 frozen equivalent (o1, o2: TYPE_A): BOOLEAN is
351 -- Are `o1' and `o2' equivalent ?
352 -- this feature is similar to `deep_equal'
353 -- but ARRAYs and STRINGs are processed correctly
354 -- (`deep_equal' will compare the size of the `area')
355 do
356 if o1 = Void then
357 Result := o2 = Void
358 else
359 Result := o2 /= Void and then o2.same_type (o1) and then
360 o1.is_equivalent (o2)
361 end
362 end
363
364 is_equivalent (other: like Current): BOOLEAN is
365 -- Is `other' equivalent to the current object ?
366 require
367 arg_non_void: other /= Void
368 same_type: same_type (other)
369 deferred
370 end
371
372 same_as (other: TYPE_A): BOOLEAN is
373 -- Is the current type the same as `other' ?
374 require
375 other_attached: other /= Void
376 do
377 -- Do nothing
378 end
379
380 feature -- Access
381
382 associated_class: CLASS_C is
383 -- Class associated to the current type.
384 require
385 has_associated_class: has_associated_class
386 deferred
387 end
388
389 actual_type: TYPE_A is
390 -- Actual type of the interpreted type
391 --| *** FIXME this will become obsolete
392 do
393 Result := Current
394 ensure
395 Result_not_void: Result /= Void
396 end
397
398 conformance_type: TYPE_A is
399 -- Type which is used to check conformance
400 do
401 Result := actual_type
402 ensure
403 Result_not_void: Result /= Void
404 end
405
406 deep_actual_type: TYPE_A is
407 -- Actual type; recursive on generic types
408 -- NOTE by M.S: Needed for ROUTINEs - perhaps
409 -- this is the intended meaning
410 -- of 'actual_type' - but 'actual_type'
411 -- does not recurs on generics(?)!
412 do
413 Result := actual_type
414 end
415
416 has_generics: BOOLEAN is
417 -- Has the current type generics types ?
418 do
419 Result := generics /= Void
420 end
421
422 intrinsic_type: TYPE_A is
423 -- Default type of a manifest constant.
424 do
425 Result := Current
426 ensure
427 result_not_void: Result /= Void
428 end
429
430 renaming: RENAMING_A is
431 -- Renaming of current type.
432 do
433 -- Result := Void
434 end
435
436 feature -- Output
437
438 frozen append_to (a_text_formatter: TEXT_FORMATTER) is
439 -- Append `Current' to `text'.
440 do
441 ext_append_to (a_text_formatter, Void)
442 end
443
444 dump: STRING is
445 -- Dumped trace
446 deferred
447 end
448
449 ext_append_to (a_text_formatter: TEXT_FORMATTER; c: CLASS_C) is
450 -- Append `Current' to `text'.
451 -- `f' is used to retreive the generic type or argument name as string.
452 -- This replaces the old "G#2" or "arg#1" texts in feature signature views.
453 -- Actually used in FORMAL_A and LIKE_ARGUMENT.
454 require
455 a_text_formatter_not_void: a_text_formatter /= Void
456 deferred
457 end
458
459 feature -- Conversion
460
461 to_type_set: TYPE_SET_A is
462 -- Create a type set containing one element which is `Current'.
463 do
464 create Result.make (1)
465 Result.extend (create {RENAMED_TYPE_A [TYPE_A]}.make (Current, Void))
466 ensure
467 to_type_set_not_void: Result /= Void
468 end
469
470 feature {COMPILER_EXPORTER} -- Access
471
472 has_expanded: BOOLEAN is
473 -- Has the current type some expanded types in itself ?
474 do
475 -- Do nothing
476 end
477
478 type_i: TYPE_I is
479 -- C type
480 require
481 is_valid: is_valid
482 deferred
483 end
484
485 meta_type: TYPE_I is
486 -- Meta type
487 require
488 is_valid: is_valid
489 do
490 Result := type_i
491 end
492
493 is_numeric: BOOLEAN is
494 -- Is the current actual type a numeric type ?
495 do
496 -- Do nothing
497 end
498
499 check_const_gen_conformance (a_gen_type: GEN_TYPE_A; a_target_type: TYPE_A; a_class: CLASS_C; i: INTEGER) is
500 -- Is `Current' a valid generic parameter at position `i' of `gen_type'?
501 require
502 a_gen_type_not_void: a_gen_type /= Void
503 a_target_type_not_void: a_target_type /= Void
504 a_class_not_void: a_class /= Void
505 i_non_negative: i > 0
506 local
507 l_vtcg7: VTCG7
508 l_formal_a: FORMAL_A
509 l_target_type: TYPE_A
510 do
511 if a_target_type.is_formal then
512 -- If we find a formal, then we get the actual generic at its position
513 -- and check wheter Current conforms to it.
514 -- Example: class A [G -> H, H] end
515 -- B[G -> A[STRING, COMPARABLE]]
516 -- `Current' is STRING
517 -- `a_target_type' is H
518 -- Note: We loop over all constraints of `G' an call `check_const_gen_conformance'.
519 -- We replace `H' with `COMPARABLE' and check whether `STRING' conforms to `COMPARABLE'.
520 l_formal_a ?= a_target_type
521 check indeed_a_formal_a: l_formal_a /= Void end
522 l_target_type := a_gen_type.generics.item (l_formal_a.position)
523 else
524 l_target_type := a_target_type
525 end
526
527 if not conform_to (l_target_type) then
528 -- FIXME: Manu 02/04/2004 We should be checking convertibility here,
529 -- but for the moment it is not yet possible because this check is done
530 -- before we do degree 4. What we need to implement is the ability
531 -- to check converitibility without having to go through a full
532 -- degree 4
533 reset_constraint_error_list
534 generate_constraint_error (a_gen_type, Current.to_type_set, l_target_type.to_type_set, i, Void)
535 create l_vtcg7
536 l_vtcg7.set_in_constraint (True)
537 l_vtcg7.set_class (a_class)
538 l_vtcg7.set_error_list (constraint_error_list)
539 l_vtcg7.set_parent_type (a_gen_type)
540 Error_handler.insert_error (l_vtcg7)
541 end
542 end
543
544 conform_to (other: TYPE_A): BOOLEAN is
545 -- Does Current conform to `other' ?
546 -- If catcall checking is activated, this prints warnings if the conformance
547 -- check would fail with monomorphic types.
548 require
549 is_valid: is_valid
550 other_not_void: other /= Void
551 other_is_valid: other.is_valid
552 local
553 l_cat_result: BOOLEAN
554 l_pcat: PCAT
555 do
556 if system.current_class /= Void and then system.current_class.is_cat_call_detection then
557
558 -- Increase check level. This tells us when we are on the lowest
559 -- level of checking a generic class so we emit the warning only once
560 conformance_check.level := conformance_check.level + 1
561 if conformance_check.level = 1 then
562 conformance_check.cat_result := True
563 end
564
565 -- Conformance check ignoring monomorphic types, but checking for variant generics
566 Result := is_conforming_descendant (other)
567 l_cat_result := Result
568
569 -- Conformance check for monomorphic types. Only check if:
570 -- * The two types are conforming descendants
571 -- * `other' is monomorphic
572 -- * Current is not NONE (NONE conforms to monomorphic types)
573 -- * Current is not an open type (open types conform to everything)
574 if l_cat_result and then other.is_monomorph and then not is_none and then not is_open_type then
575 if other.is_formal then
576 check is_formal end
577 -- monomorphic generics only conform to itself
578 l_cat_result := is_equivalent (other)
579 else
580 -- monomorphic types need to be of the same class
581 l_cat_result := has_associated_class and then other.has_associated_class and then associated_class.class_id = other.associated_class.class_id
582 end
583 end
584 if l_cat_result xor Result then
585 conformance_check.cat_result := False
586 end
587
588 -- If result is not the same (in any of the checks, even recursively for generics)
589 -- and it's the first level (i.e. the base class for a generic)
590 -- then we emit a warning
591 if conformance_check.level = 1 and then not conformance_check.cat_result then
592 create l_pcat
593 l_pcat.set_class (system.current_class)
594 l_pcat.set_source_type (Current)
595 l_pcat.set_target_type (other)
596 if context.current_feature /= Void then
597 l_pcat.set_feature (context.current_feature)
598 l_pcat.set_location (context.current_feature.e_feature.ast.start_location)
599 end
600 error_handler.insert_warning (l_pcat)
601 end
602 conformance_check.level := conformance_check.level - 1
603 else
604 -- Conformance check ignoring monomorphic types. This will also check variant generics,
605 -- but if a generic check fails it only sets `conformance_check.cat_result' to False which
606 -- is ignored here
607 Result := is_conforming_descendant (other)
608 end
609 end
610
611 silent_conform_to (other: TYPE_A): BOOLEAN is
612 -- Does Current conform to `other' ?
613 -- This does not print warnings if conformance check would
614 -- fail using monomorphic types
615 require
616 is_valid: is_valid
617 other_not_void: other /= Void
618 other_is_valid: other.is_valid
619 do
620 if system.current_class.is_cat_call_detection then
621
622 -- Increase check level. This prevents subsequent "conform_to" features
623 -- to not print warnings
624 conformance_check.level := conformance_check.level + 1
625 if conformance_check.level = 1 then
626 conformance_check.cat_result := True
627 end
628
629 -- Conformance check ignoring monomorphic types, but checking for variant generics
630 Result := is_conforming_descendant (other)
631
632 conformance_check.level := conformance_check.level - 1
633 else
634 -- Conformance check ignoring monomorphic types. This will also check variant generics,
635 -- but if a generic check fails it only sets `conformance_check.cat_result' to False which
636 -- is ignored here
637 Result := is_conforming_descendant (other)
638 end
639 end
640
641 is_conforming_descendant (other: TYPE_A): BOOLEAN is
642 -- Does Current conform to `other' ?
643 -- Do not care about monomorphic types.
644 require
645 is_valid: is_valid
646 other_not_void: other /= Void
647 other_is_valid: other.is_valid
648 deferred
649 end
650
651 conformance_check: TUPLE [level: INTEGER; cat_result: BOOLEAN]
652 -- Tuple used to hold information about current conformance check.
653 -- If `level' is 0, the conformance check starts, otherwise we are
654 -- checking generic parameters.
655 once
656 Result := [0, True]
657 end
658
659 is_conformant_to (other: TYPE_A): BOOLEAN is
660 -- Does Current inherit from other?
661 -- Most of the time, it is equivalent to `conform_to' except
662 -- when current is an expanded type.
663 require
664 is_valid: is_valid
665 other_not_void: other /= Void
666 other_is_valid: other.is_valid
667 do
668 Result := conform_to (other)
669 end
670
671 convert_to (a_context_class: CLASS_C; a_target_type: TYPE_A): BOOLEAN is
672 -- Does current convert to `a_target_type' in `a_context_class'?
673 -- Update `last_conversion_info' of AST_CONTEXT.
674 require
675 a_context_class_not_void: a_context_class /= Void
676 a_target_type_not_void: a_target_type /= Void
677 do
678 Result := False
679 context.set_last_conversion_info (Void)
680 ensure
681 context_set: Result implies context.last_conversion_info /= Void
682 end
683
684 valid_generic (type: TYPE_A): BOOLEAN is
685 -- Do the generic parameter of `type' conform to those of
686 -- Current ?
687 require
688 type_not_void: type /= Void
689 conforming_type: type.associated_class.conform_to (associated_class)
690 do
691 end
692
693 actual_argument_type (a_arg_types: ARRAY [TYPE_A]): TYPE_A is
694 -- Type including like argument process based on `a_arg_types'.
695 require
696 a_arg_types_not_void: a_arg_types /= Void
697 do
698 Result := Current
699 end
700
701 instantiation_in (type: TYPE_A; written_id: INTEGER): TYPE_A is
702 -- Instantiation of Current in the context of `type'
703 -- assuming that Current is written in the class of id `written_id'.
704 require
705 good_argument: type /= Void
706 positive_id: written_id > 0
707 do
708 Result := Current
709 end
710
711 instantiated_in (class_type: TYPE_A): TYPE_A is
712 -- Instantiation of Current in the context of `class_type'
713 -- assuming that Current is written in the associated class
714 -- of `class_type'.
715 require
716 good_argument: class_type /= Void
717 do
718 Result := Current
719 end
720
721 evaluated_type_in_descendant (a_ancestor, a_descendant: CLASS_C; a_feature: FEATURE_I): TYPE_A is
722 -- Evaluate `Current' written in `a_ancestor' in the context of `a_descendant' class.
723 -- If `a_feature' is not Void, then it is the feature seen from `a_descendant' from where
724 -- `Current' appears (i.e. not in an inheritance clause).
725 -- FIXME: it would be nice to have an assertion that checks the validity of a type
726 -- in a class (for example that FORMAL_A #3 would not make sense in a class with only
727 -- one formal generic parameter).
728 require
729 type_is_valid: is_valid
730 a_ancestor_not_void: a_ancestor /= Void
731 a_ancestor_valid: a_ancestor.is_valid
732 a_ancestor_compiled: a_ancestor.has_feature_table
733 a_descendant_not_void: a_descendant /= Void
734 a_descendant_valid: a_descendant.is_valid
735 a_descendant_compiled: a_descendant.has_feature_table
736 real_descendant: a_descendant.conform_to (a_ancestor)
737 a_feature_valid: a_feature /= Void implies
738 (a_feature.written_class.conform_to (a_ancestor) and
739 a_descendant.conform_to (a_feature.written_class))
740 is_feature_needed: has_like implies a_feature /= Void
741 do
742 Result := Current
743 ensure
744 same_object: (a_ancestor = a_descendant) implies Result = Current
745 end
746
747 duplicate: like Current is
748 -- Duplication
749 do
750 Result := twin
751 end
752
753 good_generics: BOOLEAN is
754 -- Has the base class exactly the same number of generic
755 -- parameters in its formal generic declarations ?
756 do
757 Result := True
758 end
759
760 error_generics: VTUG is
761 -- Build the error if `good_generics' returns False
762 do
763 end
764
765 check_constraints (a_type_context: CLASS_C; a_context_feature: FEATURE_I; a_check_creation_readiness: BOOLEAN) is
766 -- Check the constained genericity validity rule and leave
767 -- error info in `constraint_error_list'
768 require
769 good_argument: a_type_context /= Void
770 good_generic_count: good_generics
771 do
772 end
773
774 check_labels (a_context_class: CLASS_C; a_node: TYPE_AS) is
775 -- Check validity of `labels' of current in `a_context_class'.
776 require
777 a_context_class_not_void: a_context_class /= Void
778 do
779 end
780
781 expanded_deferred: BOOLEAN is
782 -- Is the expanded type deferred ?
783 require
784 has_expanded
785 local
786 act_type: TYPE_A
787 do
788 act_type := actual_type
789 Result := act_type.is_expanded and then
790 act_type.associated_class.is_deferred
791 end
792
793 valid_expanded_creation (class_c: CLASS_C): BOOLEAN is
794 -- Is the expanded type has an associated class with one
795 -- creation routine with no arguments only, exported to
796 -- `a_class'
797 require
798 has_expanded
799 local
800 a_class: CLASS_C
801 creators: HASH_TABLE [EXPORT_I, STRING]
802 l_export: EXPORT_I
803 do
804 if is_expanded then
805 a_class := associated_class
806 if a_class.is_external then
807 Result := True
808 else
809 creators := a_class.creators
810 if creators = Void then
811 Result := True
812 else
813 creators.search (a_class.default_create_feature.feature_name)
814 if creators.found then
815 l_export := creators.found_item
816 Result := l_export.valid_for (class_c)
817 end
818 end
819 end
820 else
821 Result := True
822 end
823 end
824
825 is_ancestor_valid: BOOLEAN is
826 -- Is type ancestor valid?
827 -- (This is currently checked only for expanded types that have
828 -- an external ancestor, that is not supported by CIL code generation.)
829 require
830 il_generation: system.il_generation
831 do
832 Result := True
833 if is_expanded and then not is_external and then associated_class.has_external_ancestor_class then
834 Result := False
835 end
836 end
837
838 create_info: CREATE_INFO is
839 -- Byte code information for entity type creation
840 require
841 is_valid: is_valid
842 deferred
843 end
844
845 check_for_obsolete_class (current_class: CLASS_C) is
846 -- Check for obsolete class from Current. If
847 -- obsolete then display warning message.
848 require
849 good_arg: current_class /= Void
850 local
851 ass_class: CLASS_C
852 warn: OBS_CLASS_WARN
853 do
854 if not current_class.is_obsolete then
855 if actual_type.has_associated_class then
856 ass_class := actual_type.associated_class
857 if ass_class.is_obsolete and then ass_class.lace_class.options.is_warning_enabled (w_obsolete_class) then
858 create warn
859 warn.set_class (current_class)
860 warn.set_obsolete_class (ass_class)
861 Error_handler.insert_warning (warn)
862 end
863 end
864 end
865 end
866
867 update_dependance (feat_depend: FEATURE_DEPENDANCE) is
868 -- Update dependency for Dead Code Removal
869 do
870 end
871
872 feature {COMPILER_EXPORTER}
873
874 format (ctxt: TEXT_FORMATTER_DECORATOR) is
875 -- Reconstitute text
876 do
877 ctxt.process_string_text (dump, Void)
878 end
879
880 feature {NONE} -- Implementation
881
882 delayed_convert_constraint_check (
883 context_class: CLASS_C;
884 gen_type: GEN_TYPE_A
885 a_set_to_check, a_constraint_types: TYPE_SET_A;
886 i: INTEGER;
887 in_constraint: BOOLEAN)
888 is
889 -- Check that if we have class A [G -> ANY] and we found A [X] where
890 -- X is expanded, then it exists a conversion routine from X to reference X
891 -- and that `reference X' conforms to the constraint ANY.
892 -- Delayed because could not be done during degree 4 since information
893 -- about conversion routine is usually not yet computed.
894 require
895 context_class_not_void: context_class /= Void
896 gen_type_not_void: gen_type /= Void
897 a_set_to_check_not_void: a_set_to_check /= Void
898 a_constraint_types_not_void: a_constraint_types /= Void
899 a_set_to_check_is_expanded: a_set_to_check.has_expanded
900 not_a_constraint_type_is_reference: not a_constraint_types.has_expanded
901 local
902 l_vtcg7: VTCG7
903 l_to_check, l_constraint_type: TYPE_A
904 do
905 reset_constraint_error_list
906
907 -- Only used in case of a single constraint!!
908 l_constraint_type := a_constraint_types.first.type
909
910 if context_class.is_valid and a_set_to_check.is_valid then
911 l_to_check := a_set_to_check.first.type
912 if a_set_to_check.count /= 1 or else a_constraint_types.count /= 1 then
913 generate_constraint_error (gen_type, l_to_check, a_constraint_types, i, Void)
914 -- The feature listed in the creation constraint has
915 -- not been declared in the constraint class.
916 create l_vtcg7
917 l_vtcg7.set_in_constraint (in_constraint)
918 l_vtcg7.set_class (context_class)
919 l_vtcg7.set_error_list (constraint_error_list)
920 l_vtcg7.set_parent_type (gen_type)
921 Error_handler.insert_error (l_vtcg7)
922 elseif
923 not (l_to_check.convert_to (context_class, l_constraint_type) and
924 l_to_check.is_conformant_to (l_constraint_type))
925 then
926 generate_constraint_error (gen_type, l_to_check, a_constraint_types, i, Void)
927 -- The feature listed in the creation constraint has
928 -- not been declared in the constraint class.
929 create l_vtcg7
930 l_vtcg7.set_in_constraint (in_constraint)
931 l_vtcg7.set_class (context_class)
932 l_vtcg7.set_error_list (constraint_error_list)
933 l_vtcg7.set_parent_type (gen_type)
934 Error_handler.insert_error (l_vtcg7)
935 end
936 end
937 end
938
939 generate_constraint_error (gen_type: GEN_TYPE_A; current_type: TYPE_A; constraint_type: TYPE_A; position: INTEGER; a_unmatched_creation_constraints: LIST[FEATURE_I]) is
940 -- Build the error corresponding to the VTCG error
941 local
942 constraint_info: CONSTRAINT_INFO
943 l_current_type_set, l_constraint_type_set: TYPE_SET_A
944 do
945 l_current_type_set := current_type.to_type_set
946 l_constraint_type_set := constraint_type.to_type_set
947 create constraint_info
948 constraint_info.set_type (gen_type)
949 constraint_info.set_actual_type_set (l_current_type_set)
950 constraint_info.set_formal_number (position)
951 constraint_info.set_constraint_types (l_constraint_type_set)
952 constraint_info.set_unmatched_creation_constraints (a_unmatched_creation_constraints)
953 constraint_error_list.extend (constraint_info)
954 end
955
956 invariant
957 -- A generic type should at least have one generic parameter.
958 -- A tuple however is an eception and can have no generic parameter.
959 generics_not_void_implies_generics_not_empty_or_tuple: (generics /= Void implies (not generics.is_empty or is_tuple))
960
961 indexing
962 copyright: "Copyright (c) 1984-2006, Eiffel Software"
963 license: "GPL version 2 (see http://www.eiffel.com/licensing/gpl.txt)"
964 licensing_options: "http://www.eiffel.com/licensing"
965 copying: "[
966 This file is part of Eiffel Software's Eiffel Development Environment.
967
968 Eiffel Software's Eiffel Development Environment is free
969 software; you can redistribute it and/or modify it under
970 the terms of the GNU General Public License as published
971 by the Free Software Foundation, version 2 of the License
972 (available at the URL listed under "license" above).
973
974 Eiffel Software's Eiffel Development Environment is
975 distributed in the hope that it will be useful, but
976 WITHOUT ANY WARRANTY; without even the implied warranty
977 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
978 See the GNU General Public License for more details.
979
980 You should have received a copy of the GNU General Public
981 License along with Eiffel Software's Eiffel Development
982 Environment; if not, write to the Free Software Foundation,
983 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
984 ]"
985 source: "[
986 Eiffel Software
987 356 Storke Road, Goleta, CA 93117 USA
988 Telephone 805-685-1006, Fax 805-685-6869
989 Website http://www.eiffel.com
990 Customer support http://support.eiffel.com
991 ]"
992
993 end -- class TYPE_A

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.23