/[eiffelstudio]/vendor/gobosoft.com/gobo/4.0d/library/tools/src/eiffel/dynamic/et_dynamic_type_builder.e
ViewVC logotype

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

1 note
2
3 description:
4
5 "Eiffel dynamic type builders"
6
7 library: "Gobo Eiffel Tools Library"
8 copyright: "Copyright (c) 2004-2016, Eric Bezault and others"
9 license: "MIT License"
10 date: "$Date$"
11 revision: "$Revision$"
12
13 class ET_DYNAMIC_TYPE_BUILDER
14
15 inherit
16
17 ET_DYNAMIC_TYPE_SET_BUILDER
18 undefine
19 error_handler,
20 set_fatal_error
21 redefine
22 has_fatal_error
23 end
24
25 ET_FEATURE_CHECKER
26 rename
27 make as make_feature_checker
28 undefine
29 current_system
30 redefine
31 has_fatal_error,
32 check_external_function_validity,
33 check_external_procedure_validity,
34 check_check_instruction_validity,
35 check_debug_instruction_validity,
36 check_loop_invariant_validity,
37 check_loop_variant_validity,
38 report_across_cursor,
39 report_across_cursor_declaration,
40 report_across_expression,
41 report_assignment,
42 report_assignment_attempt,
43 report_attribute_address,
44 report_attribute_assignment_target,
45 report_boolean_constant,
46 report_character_8_constant,
47 report_character_32_constant,
48 report_builtin_conversion,
49 report_creation_expression,
50 report_creation_instruction,
51 report_current,
52 report_current_type_needed,
53 report_equality_expression,
54 report_formal_argument,
55 report_formal_argument_declaration,
56 report_function_address,
57 report_inline_agent_formal_argument_declaration,
58 report_inline_agent_local_variable_declaration,
59 report_inline_agent_result_declaration,
60 report_integer_8_constant,
61 report_integer_16_constant,
62 report_integer_32_constant,
63 report_integer_64_constant,
64 report_local_assignment_target,
65 report_local_variable,
66 report_local_variable_declaration,
67 report_manifest_array,
68 report_manifest_tuple,
69 report_manifest_type,
70 report_named_object_test,
71 report_natural_8_constant,
72 report_natural_16_constant,
73 report_natural_32_constant,
74 report_natural_64_constant,
75 report_object_equality_expression,
76 report_object_test,
77 report_object_test_type,
78 report_object_test_local,
79 report_pointer_expression,
80 report_precursor_expression,
81 report_precursor_instruction,
82 report_procedure_address,
83 report_procedure_inline_agent,
84 report_qualified_call_expression,
85 report_qualified_call_instruction,
86 report_qualified_procedure_call_agent,
87 report_qualified_query_call_agent,
88 report_query_inline_agent,
89 report_real_32_constant,
90 report_real_64_constant,
91 report_result,
92 report_result_assignment_target,
93 report_static_call_expression,
94 report_static_call_instruction,
95 report_string_8_constant,
96 report_string_32_constant,
97 report_strip_expression,
98 report_tuple_label_call_agent,
99 report_tuple_label_expression,
100 report_tuple_label_setter,
101 report_typed_pointer_expression,
102 report_unqualified_call_expression,
103 report_unqualified_call_instruction,
104 report_unqualified_procedure_call_agent,
105 report_unqualified_query_call_agent,
106 report_void_constant,
107 feature_checker
108 end
109
110 ET_TOKEN_CODES
111 export {NONE} all end
112
113 KL_IMPORTED_STRING_ROUTINES
114 export {NONE} all end
115
116 KL_IMPORTED_ANY_ROUTINES
117 export {NONE} all end
118
119 create
120
121 make
122
123 feature {NONE} -- Initialization
124
125 make (a_system: like current_dynamic_system)
126 -- Create a new dynamic type set builder.
127 require
128 a_system_not_void: a_system /= Void
129 do
130 current_dynamic_system := a_system
131 make_feature_checker
132 create feature_checker.make
133 current_dynamic_type := dummy_dynamic_type
134 current_dynamic_feature := dummy_dynamic_feature
135 create dynamic_type_sets.make_with_capacity (1000)
136 object_id_dynamic_type_set := dummy_dynamic_type
137 create current_index.make (0)
138 create result_index.make (0)
139 create constant_indexes.make_map (16)
140 create none_index.make (0)
141 catcall_error_mode := True
142 ensure
143 current_dynamic_system_set: current_dynamic_system = a_system
144 end
145
146 feature -- Factory
147
148 new_dynamic_type_set (a_type: ET_DYNAMIC_TYPE): ET_DYNAMIC_TYPE_SET
149 -- New dynamic type set
150 do
151 Result := a_type.conforming_dynamic_types
152 end
153
154 feature -- Status report
155
156 has_fatal_error: BOOLEAN
157 -- Has a fatal error occurred when building
158 -- dynamic type sets?
159
160 feature -- Generation
161
162 build_dynamic_type_sets
163 -- Build dynamic type sets for `current_dynamic_system'.
164 -- Set `has_fatal_error' if a fatal error occurred.
165 local
166 i, nb: INTEGER
167 l_type: ET_DYNAMIC_TYPE
168 l_other_type: ET_DYNAMIC_TYPE
169 j, nb2: INTEGER
170 l_features: ET_DYNAMIC_FEATURE_LIST
171 l_feature: ET_DYNAMIC_FEATURE
172 l_precursor: detachable ET_DYNAMIC_PRECURSOR
173 l_other_precursors: detachable ET_DYNAMIC_PRECURSOR_LIST
174 k, nb3: INTEGER
175 l_dynamic_types: DS_ARRAYED_LIST [ET_DYNAMIC_TYPE]
176 l_call: detachable ET_DYNAMIC_QUALIFIED_CALL
177 l_count: INTEGER
178 old_nb: INTEGER
179 old_object_id_dynamic_type_set: ET_DYNAMIC_TYPE_SET
180 l_equality: detachable ET_DYNAMIC_EQUALITY_EXPRESSION
181 l_object_equality: detachable ET_DYNAMIC_OBJECT_EQUALITY_EXPRESSION
182 do
183 has_fatal_error := False
184 old_object_id_dynamic_type_set := object_id_dynamic_type_set
185 object_id_dynamic_type_set := new_dynamic_type_set (current_dynamic_system.any_type)
186 l_dynamic_types := current_dynamic_system.dynamic_types
187 is_built := False
188 from until is_built loop
189 is_built := True
190 nb := l_dynamic_types.count
191 from i := 1 until i > nb loop
192 l_type := l_dynamic_types.item (i)
193 -- Process dynamic queries.
194 l_features := l_type.queries
195 nb2 := l_features.count
196 from j := 1 until j > nb2 loop
197 l_feature := l_features.item (j)
198 if not l_feature.is_built then
199 is_built := False
200 build_feature_dynamic_type_sets (l_feature, l_type)
201 -- `build_feature_dynamic_type_sets' may have
202 -- added other features to the list.
203 nb2 := l_features.count
204 -- `build_feature_dynamic_type_sets' may have
205 -- added other types to the list.
206 nb := l_dynamic_types.count
207 l_precursor := l_feature.first_precursor
208 if l_precursor /= Void then
209 if not l_precursor.is_built then
210 is_built := False
211 build_feature_dynamic_type_sets (l_precursor, l_type)
212 -- `build_feature_dynamic_type_sets' may have
213 -- added other features to the list.
214 nb2 := l_features.count
215 -- `build_feature_dynamic_type_sets' may have
216 -- added other types to the list.
217 nb := l_dynamic_types.count
218 end
219 l_other_precursors := l_feature.other_precursors
220 if l_other_precursors /= Void then
221 nb3 := l_other_precursors.count
222 from k := 1 until k > nb3 loop
223 l_precursor := l_other_precursors.item (k)
224 if not l_precursor.is_built then
225 is_built := False
226 build_feature_dynamic_type_sets (l_precursor, l_type)
227 -- `build_feature_dynamic_type_sets' may have
228 -- added other precursors to the list.
229 nb3 := l_other_precursors.count
230 -- `build_feature_dynamic_type_sets' may have
231 -- added other features to the list.
232 nb2 := l_features.count
233 -- `build_feature_dynamic_type_sets' may have
234 -- added other types to the list.
235 nb := l_dynamic_types.count
236 end
237 k := k + 1
238 end
239 end
240 end
241 end
242 j := j + 1
243 end
244 -- Process dynamic procedures.
245 l_features := l_type.procedures
246 nb2 := l_features.count
247 from j := 1 until j > nb2 loop
248 l_feature := l_features.item (j)
249 if not l_feature.is_built then
250 is_built := False
251 build_feature_dynamic_type_sets (l_feature, l_type)
252 -- `build_feature_dynamic_type_sets' may have
253 -- added other features to the list.
254 nb2 := l_features.count
255 -- `build_feature_dynamic_type_sets' may have
256 -- added other types to the list.
257 nb := l_dynamic_types.count
258 l_precursor := l_feature.first_precursor
259 if l_precursor /= Void then
260 if not l_precursor.is_built then
261 is_built := False
262 build_feature_dynamic_type_sets (l_precursor, l_type)
263 -- `build_feature_dynamic_type_sets' may have
264 -- added other features to the list.
265 nb2 := l_features.count
266 -- `build_feature_dynamic_type_sets' may have
267 -- added other types to the list.
268 nb := l_dynamic_types.count
269 end
270 l_other_precursors := l_feature.other_precursors
271 if l_other_precursors /= Void then
272 nb3 := l_other_precursors.count
273 from k := 1 until k > nb3 loop
274 l_precursor := l_other_precursors.item (k)
275 if not l_precursor.is_built then
276 is_built := False
277 build_feature_dynamic_type_sets (l_precursor, l_type)
278 -- `build_feature_dynamic_type_sets' may have
279 -- added other precursors to the list.
280 nb3 := l_other_precursors.count
281 -- `build_feature_dynamic_type_sets' may have
282 -- added other features to the list.
283 nb2 := l_features.count
284 -- `build_feature_dynamic_type_sets' may have
285 -- added other types to the list.
286 nb := l_dynamic_types.count
287 end
288 k := k + 1
289 end
290 end
291 end
292 end
293 j := j + 1
294 end
295 -- Process dynamic qualified query calls.
296 from
297 l_call := l_type.query_calls
298 until
299 l_call = Void
300 loop
301 l_count := l_call.count
302 l_call.propagate_types (Current)
303 if l_call.count /= l_count then
304 is_built := False
305 end
306 l_call := l_call.next
307 end
308 -- Process dynamic qualified procedure calls.
309 from
310 l_call := l_type.procedure_calls
311 until
312 l_call = Void
313 loop
314 l_count := l_call.count
315 l_call.propagate_types (Current)
316 if l_call.count /= l_count then
317 is_built := False
318 end
319 l_call := l_call.next
320 end
321 -- Process dynamic equality expressions.
322 from
323 l_equality := l_type.equality_expressions
324 until
325 l_equality = Void
326 loop
327 l_count := l_equality.count
328 l_equality.propagate_types (Current)
329 if l_equality.count /= l_count then
330 is_built := False
331 end
332 l_equality := l_equality.next
333 end
334 -- Process dynamic object-equality expressions.
335 from
336 l_object_equality := l_type.object_equality_expressions
337 until
338 l_object_equality = Void
339 loop
340 l_count := l_object_equality.count
341 l_object_equality.propagate_types (Current)
342 if l_object_equality.count /= l_count then
343 is_built := False
344 end
345 l_object_equality := l_object_equality.next
346 end
347 i := i + 1
348 end
349 -- Process dynamic types.
350 from i := 1 until i > nb loop
351 l_type := l_dynamic_types.item (i)
352 from
353 if l_type.was_alive then
354 j := old_nb + 1
355 elseif l_type.is_alive then
356 j := 1
357 l_type.set_was_alive
358 else
359 j := nb + 1
360 end
361 until
362 j > nb
363 loop
364 l_other_type := l_dynamic_types.item (j)
365 if l_type.conforms_to_type (l_other_type) then
366 l_other_type.conforming_dynamic_types.put_type (l_type)
367 end
368 j := j + 1
369 end
370 i := i + 1
371 end
372 old_nb := nb
373 end
374 check_catcall_validity
375 object_id_dynamic_type_set := old_object_id_dynamic_type_set
376 end
377
378 feature {ET_DYNAMIC_QUALIFIED_CALL} -- Generation
379
380 propagate_call_type (a_type: ET_DYNAMIC_TYPE; a_call: ET_DYNAMIC_QUALIFIED_CALL)
381 -- Propagate `a_type' from target type set `a_call'.
382 local
383 l_target_type_set: ET_DYNAMIC_TYPE_SET
384 l_dynamic_feature: detachable ET_DYNAMIC_FEATURE
385 do
386 if not a_call.is_tuple_label then
387 l_dynamic_feature := a_call.seeded_dynamic_feature (a_type, current_dynamic_system)
388 if l_dynamic_feature = Void then
389 l_target_type_set := a_call.target_type_set
390 if a_type.conforms_to_type (l_target_type_set.static_type) then
391 -- Internal error: there should be a feature with seed
392 -- `l_seed' in all descendants of `l_target_type_set.static_type'.
393 set_fatal_error
394 error_handler.report_giaaa_error
395 else
396 -- The error has already been reported somewhere else.
397 end
398 else
399 l_dynamic_feature.set_regular (True)
400 end
401 else
402 a_call.put_type_with_tuple_label (a_type, Current)
403 end
404 end
405
406 feature {ET_DYNAMIC_QUALIFIED_CALL} -- Generation
407
408 propagate_tuple_label_expression_dynamic_types (a_call: ET_DYNAMIC_QUALIFIED_QUERY_CALL; a_type: ET_DYNAMIC_TYPE)
409 -- Propagate dynamic types of the label in tuple `a_type' to
410 -- the dynamic type set of the result type of `a_call'.
411 local
412 l_item_type_sets: ET_DYNAMIC_TYPE_SET_LIST
413 l_index: INTEGER
414 l_label_type_set: ET_DYNAMIC_TYPE_SET
415 l_result_type_set: ET_DYNAMIC_TYPE_SET
416 old_feature: ET_DYNAMIC_FEATURE
417 old_type: ET_DYNAMIC_TYPE
418 do
419 old_feature := current_dynamic_feature
420 current_dynamic_feature := a_call.current_feature
421 old_type := current_dynamic_type
422 current_dynamic_type := a_call.current_type
423 if not attached {ET_DYNAMIC_TUPLE_TYPE} a_type as l_tuple_type then
424 -- Internal error: the target of a label expression
425 -- should be a Tuple.
426 set_fatal_error
427 error_handler.report_giaaa_error
428 else
429 l_result_type_set := a_call.result_type_set
430 l_item_type_sets := l_tuple_type.item_type_sets
431 l_index := a_call.static_call.name.seed
432 if not l_item_type_sets.valid_index (l_index) then
433 -- Internal error: invalid label index.
434 set_fatal_error
435 error_handler.report_giaaa_error
436 else
437 l_label_type_set := l_item_type_sets.item (l_index)
438 propagate_tuple_label_result_dynamic_types (l_label_type_set, l_result_type_set)
439 end
440 end
441 current_dynamic_feature := old_feature
442 current_dynamic_type := old_type
443 end
444
445 propagate_tuple_label_setter_dynamic_types (a_call: ET_DYNAMIC_QUALIFIED_PROCEDURE_CALL; a_type: ET_DYNAMIC_TYPE)
446 -- Propagate dynamic types of the source of tuple label setter `a_call'
447 -- to the dynamic type set of the corresponding tuple label in `a_type'.
448 local
449 l_item_type_sets: ET_DYNAMIC_TYPE_SET_LIST
450 l_index: INTEGER
451 l_label_type_set: ET_DYNAMIC_TYPE_SET
452 old_feature: ET_DYNAMIC_FEATURE
453 old_type: ET_DYNAMIC_TYPE
454 do
455 old_feature := current_dynamic_feature
456 current_dynamic_feature := a_call.current_feature
457 old_type := current_dynamic_type
458 current_dynamic_type := a_call.current_type
459 if not attached {ET_DYNAMIC_TUPLE_TYPE} a_type as l_tuple_type then
460 -- Internal error: the target of a label expression
461 -- should be a Tuple.
462 set_fatal_error
463 error_handler.report_giaaa_error
464 elseif not attached {ET_ASSIGNER_INSTRUCTION} a_call.static_call as l_assigner then
465 -- Internal error: the call should be a tuple label assigner.
466 set_fatal_error
467 error_handler.report_giaaa_error
468 else
469 l_item_type_sets := l_tuple_type.item_type_sets
470 l_index := a_call.static_call.name.seed
471 if not l_item_type_sets.valid_index (l_index) then
472 -- Internal error: invalid label index.
473 set_fatal_error
474 error_handler.report_giaaa_error
475 else
476 l_label_type_set := l_item_type_sets.item (l_index)
477 propagate_tuple_label_argument_dynamic_types (l_label_type_set, l_assigner)
478 end
479 end
480 current_dynamic_feature := old_feature
481 current_dynamic_type := old_type
482 end
483
484 feature {ET_DYNAMIC_OBJECT_EQUALITY_EXPRESSION, ET_DYNAMIC_EQUALITY_EXPRESSION} -- Generation
485
486 propagate_is_equal_argument_type (a_type: ET_DYNAMIC_TYPE; a_feature: ET_DYNAMIC_FEATURE)
487 -- Propagate `a_type' as argument of `a_feature', the feature being the
488 -- feature 'is_equal' possibly used internally in object equality ('~' and '/~')
489 -- or in equality ('=' and '/=') when the target type is expanded.
490 local
491 l_formal_type_set: detachable ET_DYNAMIC_TYPE_SET
492 do
493 l_formal_type_set := a_feature.argument_type_set (1)
494 if l_formal_type_set /= Void and then a_type.conforms_to_type (l_formal_type_set.static_type) then
495 propagate_builtin_actual_argument_dynamic_types (a_type, 1, a_feature)
496 end
497 end
498
499 feature {ET_DYNAMIC_SYSTEM} -- Generation
500
501 propagate_type_of_type_result_type (a_type: ET_DYNAMIC_TYPE; a_feature: ET_DYNAMIC_FEATURE)
502 -- Propagate `a_type' to the dynamic type set of the result of the
503 -- built-in feature `a_feature' corresponding to "INTERNAL.type_of_type".
504 do
505 propagate_builtin_result_dynamic_types (a_type, a_feature)
506 end
507
508 feature {ET_DYNAMIC_TUPLE_TYPE} -- Generation
509
510 build_tuple_item (a_tuple_type: ET_DYNAMIC_TUPLE_TYPE; an_item_feature: ET_DYNAMIC_FEATURE)
511 -- Build type set of result type of `an_item_feature' from `a_tuple_type'.
512 do
513 -- Do nothing.
514 end
515
516 build_tuple_put (a_tuple_type: ET_DYNAMIC_TUPLE_TYPE; a_put_feature: ET_DYNAMIC_FEATURE)
517 -- Build type set of argument type of `a_put_feature' from `a_tuple_type'.
518 do
519 -- Do nothing.
520 end
521
522 feature {ET_DYNAMIC_ROUTINE_TYPE} -- Generation
523
524 build_agent_call (an_agent_type: ET_DYNAMIC_ROUTINE_TYPE; a_call_feature: ET_DYNAMIC_FEATURE)
525 -- Build type set of argument type of `a_call_feature' from `an_agent_type'.
526 do
527 -- Do nothing
528 end
529
530 feature {ET_DYNAMIC_FEATURE} -- Generation
531
532 object_id_dynamic_type_set: ET_DYNAMIC_TYPE_SET
533 -- Dynamic type set of objects that have been registered through
534 -- the object_id mechanism of class "IDENTIFIED" and related classes
535
536 feature {NONE} -- Generation
537
538 is_built: BOOLEAN
539 -- Have the dynamic type sets of `current_dynamic_system' all been built?
540
541 build_feature_dynamic_type_sets (a_feature: ET_DYNAMIC_FEATURE; a_current_dynamic_type: ET_DYNAMIC_TYPE)
542 -- Build dynamic type sets for `a_feature' in `a_current_dynamic_type'.
543 require
544 a_feature_not_void: a_feature /= Void
545 a_current_dynamic_type_not_void: a_current_dynamic_type /= Void
546 local
547 old_feature: ET_DYNAMIC_FEATURE
548 old_type: ET_DYNAMIC_TYPE
549 l_argument_type_sets: ET_DYNAMIC_TYPE_SET_LIST
550 l_dynamic_type_sets: ET_DYNAMIC_TYPE_SET_LIST
551 l_result_type_set: detachable ET_DYNAMIC_TYPE_SET
552 i, nb: INTEGER
553 had_error: BOOLEAN
554 do
555 old_feature := current_dynamic_feature
556 current_dynamic_feature := a_feature
557 old_type := current_dynamic_type
558 current_dynamic_type := a_current_dynamic_type
559 -- Dynamic type sets for arguments are stored first
560 -- in `dynamic_type_sets'.
561 l_argument_type_sets := a_feature.dynamic_type_sets
562 nb := l_argument_type_sets.count
563 from i := 1 until i > nb loop
564 dynamic_type_sets.force_last (l_argument_type_sets.item (i))
565 i := i + 1
566 end
567 a_feature.set_dynamic_type_sets (dynamic_type_sets)
568 if not a_feature.is_builtin then
569 -- We consider that there is no guarantee that the 'Result' of
570 -- a non-built-in feature can never be Void. To ensure that
571 -- we would need to perform some code flow analysis.
572 l_result_type_set := a_feature.result_type_set
573 if l_result_type_set /= Void and then not l_result_type_set.is_expanded then
574 l_result_type_set.propagate_can_be_void (current_dynamic_system.none_type)
575 end
576 end
577 had_error := has_fatal_error
578 a_feature.set_current_type_needed (False)
579 if a_feature.is_precursor then
580 check_precursor_feature_validity (a_feature.static_feature, a_current_dynamic_type.base_type)
581 else
582 check_feature_validity (a_feature.static_feature, a_current_dynamic_type.base_type)
583 end
584 if had_error then
585 set_fatal_error
586 end
587 nb := dynamic_type_sets.count
588 create l_dynamic_type_sets.make_with_capacity (nb)
589 from i := 1 until i > nb loop
590 l_dynamic_type_sets.put_last (dynamic_type_sets.item (i))
591 i := i + 1
592 end
593 a_feature.set_dynamic_type_sets (l_dynamic_type_sets)
594 a_feature.set_built (True)
595 current_index.put (0)
596 result_index.put (0)
597 constant_indexes.wipe_out
598 none_index.put (0)
599 dynamic_type_sets.wipe_out
600 current_dynamic_feature := old_feature
601 current_dynamic_type := old_type
602 end
603
604 feature {NONE} -- CAT-calls
605
606 check_catcall_validity
607 -- Check CAT-call validity.
608 local
609 i, nb: INTEGER
610 l_call: detachable ET_DYNAMIC_QUALIFIED_CALL
611 l_dynamic_types: DS_ARRAYED_LIST [ET_DYNAMIC_TYPE]
612 l_type: ET_DYNAMIC_TYPE
613 do
614 if catcall_error_mode or catcall_warning_mode then
615 l_dynamic_types := current_dynamic_system.dynamic_types
616 nb := l_dynamic_types.count
617 from i := 1 until i > nb loop
618 l_type := l_dynamic_types.item (i)
619 from
620 l_call := l_type.query_calls
621 until
622 l_call = Void
623 loop
624 check_catcall_call_validity (l_call)
625 l_call := l_call.next
626 end
627 from
628 l_call := l_type.procedure_calls
629 until
630 l_call = Void
631 loop
632 check_catcall_call_validity (l_call)
633 l_call := l_call.next
634 end
635 i := i + 1
636 end
637 end
638 end
639
640 check_catcall_call_validity (a_call: ET_DYNAMIC_QUALIFIED_CALL)
641 -- Check CAT-call validity of `a_call'.
642 require
643 a_call_not_void: a_call /= Void
644 local
645 l_target_type_set: ET_DYNAMIC_TYPE_SET
646 i, nb: INTEGER
647 do
648 l_target_type_set := a_call.target_type_set
649 nb := l_target_type_set.count
650 from i := 1 until i > nb loop
651 check_catcall_target_validity (l_target_type_set.dynamic_type (i), a_call)
652 i := i + 1
653 end
654 end
655
656 check_catcall_target_validity (a_type: ET_DYNAMIC_TYPE; a_call: ET_DYNAMIC_QUALIFIED_CALL)
657 -- Check whether target type `a_type' introduces CAT-calls in `a_call'.
658 require
659 a_type_not_void: a_type /= Void
660 a_call_not_void: a_call /= Void
661 local
662 l_dynamic_feature: detachable ET_DYNAMIC_FEATURE
663 l_actuals: detachable ET_ARGUMENT_OPERANDS
664 l_current_feature: ET_DYNAMIC_FEATURE
665 i, nb: INTEGER
666 l_source_type_set: detachable ET_DYNAMIC_TYPE_SET
667 l_target_type_set: detachable ET_DYNAMIC_TYPE_SET
668 j, nb2: INTEGER
669 l_source_type: ET_DYNAMIC_TYPE
670 l_target_type: ET_DYNAMIC_TYPE
671 l_item_type_sets: ET_DYNAMIC_TYPE_SET_LIST
672 l_seed: INTEGER
673 do
674 if a_call.is_tuple_label then
675 -- Check the case of Tuple label setter. For example:
676 -- t1: TUPLE [l: ANY]
677 -- t2: TUPLE [l: STRING]
678 -- t1 := t2
679 -- t1.l := 3
680 l_actuals := a_call.static_call.arguments
681 if l_actuals /= Void and then l_actuals.count = 1 then
682 l_current_feature := a_call.current_feature
683 if not attached {ET_DYNAMIC_TUPLE_TYPE} a_type as l_tuple_dynamic_type then
684 -- Internal error: the target of the call is a Tuple.
685 set_fatal_error
686 error_handler.report_giaaa_error
687 else
688 l_item_type_sets := l_tuple_dynamic_type.item_type_sets
689 l_seed := a_call.static_call.name.seed
690 if not l_item_type_sets.valid_index (l_seed) then
691 -- Internal error: invalid Tuple label.
692 set_fatal_error
693 error_handler.report_giaaa_error
694 else
695 l_target_type_set := l_item_type_sets.item (l_seed)
696 l_target_type := l_target_type_set.static_type
697 l_current_feature := a_call.current_feature
698 l_source_type_set := l_current_feature.dynamic_type_set (l_actuals.actual_argument (1))
699 if l_source_type_set = Void then
700 -- Internal error: the dynamic type sets of the actual
701 -- argument should be known at this stage.
702 set_fatal_error
703 error_handler.report_giaaa_error
704 else
705 nb2 := l_source_type_set.count
706 from j := 1 until j > nb2 loop
707 l_source_type := l_source_type_set.dynamic_type (j)
708 if not l_source_type.conforms_to_type (l_target_type) then
709 report_catcall_error (a_type, Void, 1, l_target_type, l_target_type_set, l_source_type, l_source_type_set, a_call)
710 end
711 j := j + 1
712 end
713 end
714 end
715 end
716 end
717 else
718 l_dynamic_feature := a_call.seeded_dynamic_feature (a_type, current_dynamic_system)
719 if l_dynamic_feature = Void then
720 -- Internal error: there should be a feature in all
721 -- descendants of `a_call.target_type_set.static_type'.
722 set_fatal_error
723 error_handler.report_giaaa_error
724 else
725 l_actuals := a_call.static_call.arguments
726 if l_actuals /= Void then
727 nb := l_actuals.count
728 if nb > 0 then
729 l_current_feature := a_call.current_feature
730 from i := 1 until i > nb loop
731 l_target_type_set := l_dynamic_feature.argument_type_set (i)
732 if l_target_type_set = Void then
733 -- Internal error: it has already been checked somewhere else
734 -- that there was the same number of formal arguments in
735 -- feature redeclaration.
736 set_fatal_error
737 error_handler.report_giaaa_error
738 else
739 l_target_type := l_target_type_set.static_type
740 l_source_type_set := l_current_feature.dynamic_type_set (l_actuals.actual_argument (i))
741 if l_source_type_set = Void then
742 -- Internal error: the dynamic type sets of the actual
743 -- arguments should be known at this stage.
744 set_fatal_error
745 error_handler.report_giaaa_error
746 else
747 nb2 := l_source_type_set.count
748 from j := 1 until j > nb2 loop
749 l_source_type := l_source_type_set.dynamic_type (j)
750 if not l_source_type.conforms_to_type (l_target_type) then
751 report_catcall_error (a_type, l_dynamic_feature, i, l_target_type, l_target_type_set, l_source_type, l_source_type_set, a_call)
752 end
753 j := j + 1
754 end
755 end
756 end
757 i := i + 1
758 end
759 end
760 end
761 end
762 end
763 end
764
765 report_catcall_error (a_target_type: ET_DYNAMIC_TYPE; a_dynamic_feature: detachable ET_DYNAMIC_FEATURE;
766 arg: INTEGER; a_formal_type: ET_DYNAMIC_TYPE; a_formal_type_set: ET_DYNAMIC_TYPE_SET;
767 an_actual_type: ET_DYNAMIC_TYPE; an_actual_type_set: ET_DYNAMIC_TYPE_SET; a_call: ET_DYNAMIC_QUALIFIED_CALL)
768 -- Report a CAT-call error in `a_call'. When the target is of type `a_target_type', we
769 -- try to pass to the corresponding feature `a_dynamic_feature' an actual argument of
770 -- type `an_actual_type' (which is one of the types of `an_actual_type_set') which
771 -- does not conform to the type of the `arg'-th corresponding formal argument
772 -- `a_formal_type' (which is one of the types of `a_formal_type_set').
773 -- When `a_dynamic_feature' is Void, then the call is assumed to be a Tuple label setter.
774 require
775 a_target_type_not_void: a_target_type /= Void
776 a_call_not_void: a_call /= Void
777 a_dynamic_feature_not_void_or_tuple_label_setter: a_call.is_tuple_label xor a_dynamic_feature /= Void
778 a_formal_type_not_void: a_formal_type /= Void
779 a_formal_type_set_not_void: a_formal_type_set /= Void
780 an_actual_type_not_void: an_actual_type /= Void
781 an_actual_type_set_not_void: an_actual_type_set /= Void
782 valid_arg: attached a_call.static_call.arguments as l_static_arguments and then l_static_arguments.valid_index (arg)
783 local
784 l_message: STRING
785 do
786 -- TODO: better error message reporting.
787 l_message := shared_error_message
788 STRING_.wipe_out (l_message)
789 append_catcall_error_message (l_message, a_target_type, a_dynamic_feature, arg, a_formal_type, a_formal_type_set, an_actual_type, an_actual_type_set, a_call)
790 if catcall_error_mode then
791 -- CAT-calls are considered as fatal errors.
792 set_fatal_error
793 end
794 error_handler.report_catcall_error (l_message)
795 STRING_.wipe_out (l_message)
796 end
797
798 append_catcall_error_message (a_message: STRING; a_target_type: ET_DYNAMIC_TYPE; a_dynamic_feature: detachable ET_DYNAMIC_FEATURE;
799 arg: INTEGER; a_formal_type: ET_DYNAMIC_TYPE; a_formal_type_set: ET_DYNAMIC_TYPE_SET;
800 an_actual_type: ET_DYNAMIC_TYPE; an_actual_type_set: ET_DYNAMIC_TYPE_SET; a_call: ET_DYNAMIC_QUALIFIED_CALL)
801 -- Append to `a_message' the error message of a CAT-call error in `a_call'.
802 -- When the target is of type `a_target_type', we try to pass to the corresponding
803 -- feature `a_dynamic_feature' an actual argument of type `an_actual_type' (which
804 -- is one of the types of `an_actual_type_set') which does not conform to the type
805 -- of the `arg'-th corresponding formal argument `a_formal_type' (which is one of
806 -- the types of `a_formal_type_set').
807 -- When `a_dynamic_feature' is Void, then the call is assumed to be a Tuple label setter.
808 require
809 a_message_not_void: a_message /= Void
810 a_call_not_void: a_call /= Void
811 a_target_type_not_void: a_target_type /= Void
812 a_dynamic_feature_not_void_or_tuple_label_setter: a_call.is_tuple_label xor a_dynamic_feature /= Void
813 a_formal_type_not_void: a_formal_type /= Void
814 a_formal_type_set_not_void: a_formal_type_set /= Void
815 an_actual_type_not_void: an_actual_type /= Void
816 an_actual_type_set_not_void: an_actual_type_set /= Void
817 valid_arg: attached a_call.static_call.arguments as l_static_arguments and then l_static_arguments.valid_index (arg)
818 local
819 l_class_impl: ET_CLASS
820 l_position: ET_POSITION
821 do
822 a_message.append_string ("[CATCALL] class ")
823 a_message.append_string (a_call.current_type.base_type.to_text)
824 a_message.append_string (" (")
825 l_class_impl := a_call.current_feature.static_feature.implementation_class
826 if a_call.current_type.base_type.base_class /= l_class_impl then
827 a_message.append_string (l_class_impl.upper_name)
828 a_message.append_character (',')
829 end
830 l_position := a_call.position
831 a_message.append_string (l_position.line.out)
832 a_message.append_character (',')
833 a_message.append_string (l_position.column.out)
834 a_message.append_string ("): type '")
835 a_message.append_string (an_actual_type.base_type.to_text)
836 if a_dynamic_feature /= Void then
837 a_message.append_string ("' of actual argument #")
838 a_message.append_string (arg.out)
839 a_message.append_string (" does not conform to type '")
840 a_message.append_string (a_formal_type.base_type.to_text)
841 a_message.append_string ("' of formal argument in feature `")
842 a_message.append_string (a_dynamic_feature.static_feature.name.name)
843 a_message.append_string ("' in class '")
844 else
845 a_message.append_string ("' of source of Tuple label assigner does not conform to type '")
846 a_message.append_string (a_formal_type.base_type.to_text)
847 a_message.append_string ("' of Tuple item #")
848 a_message.append_string (a_call.static_call.name.seed.out)
849 a_message.append_string (" in type '")
850 end
851 a_message.append_string (a_target_type.base_type.to_text)
852 a_message.append_string ("%'")
853 end
854
855 shared_error_message: STRING
856 -- Shared error message (used in `report_catcall_error')
857 once
858 create Result.make (200)
859 ensure
860 shared_error_message_not_void: Result /= Void
861 end
862
863 feature {NONE} -- Feature validity
864
865 check_external_function_validity (a_feature: ET_EXTERNAL_FUNCTION)
866 -- Check validity of `a_feature'.
867 -- Set `has_fatal_error' if a fatal error occurred.
868 local
869 l_dynamic_type: ET_DYNAMIC_TYPE
870 do
871 Precursor (a_feature)
872 if not has_fatal_error then
873 if a_feature.is_builtin and then not a_feature.is_builtin_unknown then
874 check_external_builtin_function_validity (a_feature)
875 elseif a_feature.type.same_base_type_with_type_marks (current_universe_impl.string_type, tokens.implicit_attached_type_mark, current_type, tokens.implicit_attached_type_mark, current_type) then
876 if current_type = current_dynamic_type.base_type then
877 l_dynamic_type := result_type_set.static_type
878 mark_string_type_alive (l_dynamic_type)
879 propagate_builtin_result_dynamic_types (l_dynamic_type, current_dynamic_feature)
880 end
881 elseif not a_feature.type.is_type_expanded (current_type) then
882 -- TODO: build full dynamic type sets, recursively.
883 error_handler.report_warning_message ("Dynamic type set not built for external feature " + current_type.to_text + "." + a_feature.lower_name)
884 end
885 end
886 end
887
888 check_external_builtin_function_validity (a_feature: ET_EXTERNAL_FUNCTION)
889 -- Check validity of `a_feature'.
890 -- `a_feature' is a built-in function.
891 -- Set `has_fatal_error' if a fatal error occurred.
892 require
893 a_feature_not_void: a_feature /= Void
894 a_feature_is_builtin: a_feature.is_builtin
895 builtin_feature_known: not a_feature.is_builtin_unknown
896 local
897 l_builtin_class: INTEGER
898 do
899 l_builtin_class := a_feature.builtin_code // builtin_capacity
900 inspect l_builtin_class
901 when builtin_any_class then
902 inspect a_feature.builtin_code \\ builtin_capacity
903 when builtin_any_twin then
904 report_builtin_any_twin (a_feature)
905 else
906 report_builtin_function (a_feature)
907 end
908 when builtin_function_class then
909 inspect a_feature.builtin_code \\ builtin_capacity
910 when builtin_function_item then
911 report_builtin_function_item (a_feature)
912 else
913 report_builtin_function (a_feature)
914 end
915 when builtin_identified_class then
916 inspect a_feature.builtin_code \\ builtin_capacity
917 when builtin_identified_eif_id_object then
918 report_builtin_identified_eif_id_object (a_feature)
919 when builtin_identified_eif_object_id then
920 report_builtin_identified_eif_object_id (a_feature)
921 else
922 report_builtin_function (a_feature)
923 end
924 when builtin_internal_class then
925 inspect a_feature.builtin_code \\ builtin_capacity
926 when builtin_internal_type_of_type then
927 report_builtin_internal_type_of_type (a_feature)
928 else
929 report_builtin_function (a_feature)
930 end
931 when builtin_exception_manager_class then
932 inspect a_feature.builtin_code \\ builtin_capacity
933 when builtin_exception_manager_exception_from_code then
934 report_builtin_exception_manager_exception_from_code (a_feature)
935 when builtin_exception_manager_is_caught then
936 report_builtin_exception_manager_is_caught (a_feature)
937 when builtin_exception_manager_is_ignorable then
938 report_builtin_exception_manager_is_ignorable (a_feature)
939 when builtin_exception_manager_is_ignored then
940 report_builtin_exception_manager_is_ignored (a_feature)
941 when builtin_exception_manager_is_raisable then
942 report_builtin_exception_manager_is_raisable (a_feature)
943 when builtin_exception_manager_last_exception then
944 report_builtin_exception_manager_last_exception (a_feature)
945 when builtin_exception_manager_type_of_code then
946 report_builtin_exception_manager_type_of_code (a_feature)
947 else
948 report_builtin_function (a_feature)
949 end
950 when builtin_exception_manager_factory_class then
951 inspect a_feature.builtin_code \\ builtin_capacity
952 when builtin_exception_manager_factory_exception_manager then
953 report_builtin_exception_manager_factory_exception_manager (a_feature)
954 else
955 report_builtin_function (a_feature)
956 end
957 when builtin_special_class then
958 inspect a_feature.builtin_code \\ builtin_capacity
959 when builtin_special_item then
960 report_builtin_special_item (a_feature)
961 else
962 report_builtin_function (a_feature)
963 end
964 when builtin_tuple_class then
965 inspect a_feature.builtin_code \\ builtin_capacity
966 when builtin_tuple_reference_item then
967 report_builtin_tuple_reference_item (a_feature)
968 else
969 report_builtin_function (a_feature)
970 end
971 when builtin_type_class then
972 inspect a_feature.builtin_code \\ builtin_capacity
973 when builtin_type_default then
974 report_builtin_type_default (a_feature)
975 when builtin_type_field then
976 report_builtin_type_field (a_feature)
977 when builtin_type_field_count then
978 report_builtin_type_field_count (a_feature)
979 when builtin_type_field_static_type then
980 report_builtin_type_field_static_type (a_feature)
981 when builtin_type_generic_parameter_type then
982 report_builtin_type_generic_parameter_type (a_feature)
983 when builtin_type_new_instance then
984 report_builtin_type_new_instance (a_feature)
985 when builtin_type_new_special_any_instance then
986 report_builtin_type_new_special_any_instance (a_feature)
987 else
988 report_builtin_function (a_feature)
989 end
990 else
991 report_builtin_function (a_feature)
992 end
993 end
994
995 check_external_procedure_validity (a_feature: ET_EXTERNAL_PROCEDURE)
996 -- Check validity of `a_feature'.
997 -- Set `has_fatal_error' if a fatal error occurred.
998 do
999 Precursor (a_feature)
1000 if not has_fatal_error then
1001 if a_feature.is_builtin and then not a_feature.is_builtin_unknown then
1002 check_external_builtin_procedure_validity (a_feature)
1003 end
1004 end
1005 end
1006
1007 check_external_builtin_procedure_validity (a_feature: ET_EXTERNAL_PROCEDURE)
1008 -- Check validity of `a_feature'.
1009 -- `a_feature' is a built-in procedure.
1010 -- Set `has_fatal_error' if a fatal error occurred.
1011 require
1012 a_feature_not_void: a_feature /= Void
1013 a_feature_is_builtin: a_feature.is_builtin
1014 builtin_feature_known: not a_feature.is_builtin_unknown
1015 local
1016 l_builtin_class: INTEGER
1017 do
1018 l_builtin_class := a_feature.builtin_code // builtin_capacity
1019 inspect l_builtin_class
1020 when builtin_exception_manager_class then
1021 inspect a_feature.builtin_code \\ builtin_capacity
1022 when builtin_exception_manager_catch then
1023 report_builtin_exception_manager_catch (a_feature)
1024 when builtin_exception_manager_ignore then
1025 report_builtin_exception_manager_ignore (a_feature)
1026 when builtin_exception_manager_raise then
1027 report_builtin_exception_manager_raise (a_feature)
1028 when builtin_exception_manager_set_is_ignored then
1029 report_builtin_exception_manager_set_is_ignored (a_feature)
1030 else
1031 report_builtin_procedure (a_feature)
1032 end
1033 when builtin_tuple_class then
1034 inspect a_feature.builtin_code \\ builtin_capacity
1035 when builtin_tuple_put_reference then
1036 report_builtin_tuple_put_reference (a_feature)
1037 else
1038 report_builtin_procedure (a_feature)
1039 end
1040 when builtin_type_class then
1041 inspect a_feature.builtin_code \\ builtin_capacity
1042 when builtin_type_set_reference_field then
1043 report_builtin_type_set_reference_field (a_feature)
1044 else
1045 report_builtin_procedure (a_feature)
1046 end
1047 else
1048 report_builtin_procedure (a_feature)
1049 end
1050 end
1051
1052 feature {NONE} -- Instruction validity
1053
1054 check_check_instruction_validity (an_instruction: ET_CHECK_INSTRUCTION)
1055 -- Check validity of `an_instruction'.
1056 -- Set `has_fatal_error' if a fatal error occurred.
1057 do
1058 if not no_assertion or else an_instruction.then_compound /= Void then
1059 precursor (an_instruction)
1060 else
1061 has_fatal_error := False
1062 end
1063 end
1064
1065 check_debug_instruction_validity (an_instruction: ET_DEBUG_INSTRUCTION)
1066 -- Check validity of `an_instruction'.
1067 -- Set `has_fatal_error' if a fatal error occurred.
1068 do
1069 if not no_debug then
1070 precursor (an_instruction)
1071 else
1072 has_fatal_error := False
1073 end
1074 end
1075
1076 check_loop_invariant_validity (an_invariant: ET_LOOP_INVARIANTS)
1077 -- Check validity of `an_invariant'.
1078 -- Set `has_fatal_error' if a fatal error occurred.
1079 do
1080 if not no_assertion then
1081 precursor (an_invariant)
1082 else
1083 has_fatal_error := False
1084 end
1085 end
1086
1087 check_loop_variant_validity (a_variant: ET_VARIANT)
1088 -- Check validity of `a_variant'.
1089 -- Set `has_fatal_error' if a fatal error occurred.
1090 do
1091 if not no_assertion then
1092 precursor (a_variant)
1093 else
1094 has_fatal_error := False
1095 end
1096 end
1097
1098 feature {NONE} -- Event handling
1099
1100 report_across_cursor (a_name: ET_IDENTIFIER; a_across_component: ET_ACROSS_COMPONENT)
1101 -- Report that a call to across cursor `a_name' has been processed.
1102 do
1103 if current_type = current_dynamic_type.base_type then
1104 a_name.set_index (a_across_component.cursor_name.index)
1105 end
1106 end
1107
1108 report_across_cursor_declaration (a_name: ET_IDENTIFIER; a_across_component: ET_ACROSS_COMPONENT)
1109 -- Report that the declaration of the across cursor `a_name' has been processed.
1110 do
1111 if current_type = current_dynamic_type.base_type then
1112 -- Take care of the type of the across cursor.
1113 a_name.set_index (a_across_component.new_cursor_expression.index)
1114 end
1115 end
1116
1117 report_across_expression (a_across_expression: ET_ACROSS_EXPRESSION)
1118 -- Report that the across expression `a_across_expression' has been processed.
1119 do
1120 report_constant_expression (a_across_expression, current_universe_impl.boolean_type)
1121 end
1122
1123 report_assignment (an_instruction: ET_ASSIGNMENT)
1124 -- Report that an assignment instruction has been processed.
1125 do
1126 if current_type = current_dynamic_type.base_type then
1127 propagate_assignment_dynamic_types (an_instruction)
1128 end
1129 end
1130
1131 report_assignment_attempt (an_instruction: ET_ASSIGNMENT_ATTEMPT)
1132 -- Report that an assignment attempt instruction has been processed.
1133 do
1134 if current_type = current_dynamic_type.base_type then
1135 propagate_assignment_attempt_dynamic_types (an_instruction)
1136 end
1137 end
1138
1139 report_attribute_address (an_expression: ET_FEATURE_ADDRESS; an_attribute: ET_QUERY)
1140 -- Report that attribute `an_attribute' has been processed
1141 -- as target of feature address `an_expression'.
1142 local
1143 l_dynamic_attribute: ET_DYNAMIC_FEATURE
1144 do
1145 if current_type = current_dynamic_type.base_type then
1146 l_dynamic_attribute := current_dynamic_type.dynamic_query (an_attribute, current_dynamic_system)
1147 -- TODO: the dynamic type set of `l_dynamic_attribute' may be altered when
1148 -- its address is passed to an external routine.
1149 end
1150 end
1151
1152 report_attribute_assignment_target (a_writable: ET_WRITABLE; an_attribute: ET_QUERY)
1153 -- Report that attribute `a_writable' has been processed
1154 -- as target of an assignment (attempt).
1155 local
1156 l_dynamic_type_set: detachable ET_DYNAMIC_TYPE_SET
1157 do
1158 if current_type = current_dynamic_type.base_type then
1159 l_dynamic_type_set := current_dynamic_type.dynamic_query (an_attribute, current_dynamic_system).result_type_set
1160 if l_dynamic_type_set = Void then
1161 -- Internal error: the result type set of an attribute cannot be void.
1162 set_fatal_error
1163 error_handler.report_giaaa_error
1164 else
1165 set_dynamic_type_set (l_dynamic_type_set, a_writable)
1166 end
1167 end
1168 end
1169
1170 report_boolean_constant (a_constant: ET_BOOLEAN_CONSTANT; a_type: ET_CLASS_TYPE)
1171 -- Report that a boolean of type `a_type' in the context
1172 -- of `current_type' has been processed.
1173 do
1174 report_constant_expression (a_constant, a_type)
1175 end
1176
1177 report_character_8_constant (a_constant: ET_CHARACTER_CONSTANT; a_type: ET_CLASS_TYPE)
1178 -- Report that a character_8 of type `a_type' in the context
1179 -- of `current_type' has been processed.
1180 do
1181 report_constant_expression (a_constant, a_type)
1182 end
1183
1184 report_character_32_constant (a_constant: ET_CHARACTER_CONSTANT; a_type: ET_CLASS_TYPE)
1185 -- Report that a character_32 of type `a_type' in the context
1186 -- of `current_type' has been processed.
1187 do
1188 report_constant_expression (a_constant, a_type)
1189 end
1190
1191 report_builtin_conversion (an_expression: ET_CONVERT_BUILTIN_EXPRESSION; a_target_type: ET_TYPE)
1192 -- Report that a built-in convert expression has been processed,
1193 -- where `a_target_type' in the context of `current_type' is
1194 -- the type of the expression after the conversion occurred.
1195 local
1196 l_source_type_set: detachable ET_DYNAMIC_TYPE_SET
1197 l_source_type: ET_DYNAMIC_TYPE
1198 l_target_type: ET_DYNAMIC_TYPE
1199 do
1200 if current_type = current_dynamic_type.base_type then
1201 l_source_type_set := dynamic_type_set (an_expression.expression)
1202 if l_source_type_set = Void then
1203 -- Internal error: the dynamic type set of the source
1204 -- should be known at this stage.
1205 set_fatal_error
1206 error_handler.report_giaaa_error
1207 else
1208 l_source_type := l_source_type_set.static_type
1209 if l_source_type.base_type.conforms_to_type (a_target_type, current_type, current_type) then
1210 -- TODO: built-in feature with formal generic parameter? Should not be needed with ECMA Eiffel.
1211 set_dynamic_type_set (l_source_type_set, an_expression)
1212 else
1213 -- TODO: built-in feature between basic types? Should not be needed with ECMA Eiffel.
1214 l_target_type := current_dynamic_system.dynamic_type (a_target_type, current_type)
1215 set_dynamic_type_set (l_target_type, an_expression)
1216 end
1217 end
1218 end
1219 end
1220
1221 report_constant_expression (a_expression: ET_EXPRESSION; a_type: ET_CLASS_TYPE)
1222 -- Report that `a_expression', whose type is always `a_type'
1223 -- in the context of `current_type', has been processed.
1224 require
1225 no_error: not has_fatal_error
1226 a_expression_not_void: a_expression /= Void
1227 a_type_not_void: a_type /= Void
1228 local
1229 l_dynamic_type: ET_DYNAMIC_TYPE
1230 do
1231 if current_type = current_dynamic_type.base_type then
1232 l_dynamic_type := current_dynamic_system.dynamic_type (a_type, current_type)
1233 mark_type_alive (l_dynamic_type)
1234 constant_indexes.search (l_dynamic_type)
1235 if constant_indexes.found and a_expression.index = 0 then
1236 a_expression.set_index (constant_indexes.found_item)
1237 end
1238 set_dynamic_type_set (l_dynamic_type, a_expression)
1239 if not constant_indexes.found then
1240 constant_indexes.force_last (a_expression.index, l_dynamic_type)
1241 end
1242 end
1243 end
1244
1245 report_creation_expression (an_expression: ET_CREATION_EXPRESSION; a_creation_type: ET_TYPE; a_procedure: ET_PROCEDURE)
1246 -- Report that a creation expression, with creation type
1247 -- `a_creation_type' in context of `current_type', has
1248 -- been processed.
1249 local
1250 i, nb: INTEGER
1251 l_dynamic_procedure: ET_DYNAMIC_FEATURE
1252 l_dynamic_creation_type: ET_DYNAMIC_TYPE
1253 l_actual: ET_EXPRESSION
1254 do
1255 if current_type = current_dynamic_type.base_type then
1256 l_dynamic_creation_type := current_dynamic_system.dynamic_type (a_creation_type, current_type)
1257 l_dynamic_procedure := l_dynamic_creation_type.dynamic_procedure (a_procedure, current_dynamic_system)
1258 l_dynamic_procedure.set_creation (True)
1259 mark_type_alive (l_dynamic_creation_type)
1260 if attached an_expression.arguments as l_actuals then
1261 nb := l_actuals.count
1262 from i := 1 until i > nb loop
1263 l_actual := l_actuals.actual_argument (i)
1264 propagate_argument_operand_dynamic_types (l_actual, i, l_dynamic_procedure)
1265 i := i + 1
1266 end
1267 end
1268 set_dynamic_type_set (l_dynamic_creation_type, an_expression)
1269 end
1270 end
1271
1272 report_creation_instruction (an_instruction: ET_CREATION_INSTRUCTION; a_creation_type: ET_TYPE; a_procedure: ET_PROCEDURE)
1273 -- Report that a creation instruction, with creation type
1274 -- `a_creation_type' in context of `current_type', has
1275 -- been processed.
1276 local
1277 i, nb: INTEGER
1278 l_dynamic_procedure: ET_DYNAMIC_FEATURE
1279 l_dynamic_creation_type: ET_DYNAMIC_TYPE
1280 l_actual: ET_EXPRESSION
1281 do
1282 if current_type = current_dynamic_type.base_type then
1283 l_dynamic_creation_type := current_dynamic_system.dynamic_type (a_creation_type, current_type)
1284 l_dynamic_procedure := l_dynamic_creation_type.dynamic_procedure (a_procedure, current_dynamic_system)
1285 l_dynamic_procedure.set_creation (True)
1286 mark_type_alive (l_dynamic_creation_type)
1287 if attached an_instruction.arguments as l_actuals then
1288 nb := l_actuals.count
1289 from i := 1 until i > nb loop
1290 l_actual := l_actuals.actual_argument (i)
1291 propagate_argument_operand_dynamic_types (l_actual, i, l_dynamic_procedure)
1292 i := i + 1
1293 end
1294 end
1295 propagate_creation_dynamic_type (l_dynamic_creation_type, an_instruction)
1296 end
1297 end
1298
1299 report_current (an_expression: ET_CURRENT)
1300 -- Report that the current entity has been processed.
1301 do
1302 if current_type = current_dynamic_type.base_type then
1303 if an_expression.index = 0 and current_index.item /= 0 then
1304 an_expression.set_index (current_index.item)
1305 end
1306 set_dynamic_type_set (current_dynamic_type, an_expression)
1307 if current_index.item = 0 then
1308 current_index.put (an_expression.index)
1309 end
1310 end
1311 end
1312
1313 report_current_type_needed
1314 -- Report that the current type is needed to execute the feature being analyzed.
1315 -- This might be needed for optimization purposes.
1316 do
1317 if current_type = current_dynamic_type.base_type then
1318 current_dynamic_feature.set_current_type_needed (True)
1319 end
1320 end
1321
1322 report_equality_expression (an_expression: ET_EQUALITY_EXPRESSION)
1323 -- Report that an equality expression has been processed.
1324 local
1325 l_equality: ET_DYNAMIC_EQUALITY_EXPRESSION
1326 l_target_type_set: detachable ET_DYNAMIC_TYPE_SET
1327 do
1328 if current_type = current_dynamic_type.base_type then
1329 report_constant_expression (an_expression, current_universe_impl.boolean_type)
1330 l_target_type_set := dynamic_type_set (an_expression.left)
1331 if l_target_type_set = Void then
1332 -- Internal error: the dynamic type sets of the
1333 -- left operand should be known at this stage.
1334 set_fatal_error
1335 error_handler.report_giaaa_error
1336 else
1337 create l_equality.make (an_expression, l_target_type_set, current_dynamic_feature, current_dynamic_type)
1338 l_target_type_set.static_type.put_equality_expression (l_equality)
1339 propagate_equality_expression_target_dynamic_types (l_equality)
1340 end
1341 end
1342 end
1343
1344 report_formal_argument (a_name: ET_IDENTIFIER; a_formal: ET_FORMAL_ARGUMENT)
1345 -- Report that a call to formal argument `a_name' has been processed.
1346 do
1347 if current_type = current_dynamic_type.base_type then
1348 a_name.set_index (a_formal.name.index)
1349 end
1350 end
1351
1352 report_formal_argument_declaration (a_formal: ET_FORMAL_ARGUMENT)
1353 -- Report that the declaration of the formal
1354 -- argument `a_formal' of a feature has been processed.
1355 do
1356 -- The dynamic type sets of formal arguments of features have
1357 -- already been set when creating the corresponding dynamic
1358 -- feature (see ET_DYNAMIC_FEATURE.make).
1359 end
1360
1361 report_function_address (an_expression: ET_FEATURE_ADDRESS; a_query: ET_QUERY)
1362 -- Report that function `a_query' has been processed
1363 -- as target of feature address `an_expression'.
1364 local
1365 l_dynamic_query: ET_DYNAMIC_FEATURE
1366 do
1367 if current_type = current_dynamic_type.base_type then
1368 l_dynamic_query := current_dynamic_type.dynamic_query (a_query, current_dynamic_system)
1369 l_dynamic_query.set_address (True)
1370 -- TODO: the dynamic type set of the formal arguments of `l_dynamic_query'
1371 -- may be altered when its address is passed to an external routine.
1372 end
1373 end
1374
1375 report_inline_agent (an_expression: ET_INLINE_AGENT; a_type: ET_TYPE; a_context: ET_TYPE_CONTEXT)
1376 -- Report that an inline agent of type `a_type' in `a_context' has been processed.
1377 require
1378 no_error: not has_fatal_error
1379 an_expression_not_void: an_expression /= Void
1380 a_type_not_void: a_type /= Void
1381 a_context_not_void: a_context /= Void
1382 a_context_valid: a_context.is_valid_context
1383 local
1384 l_dynamic_type: ET_DYNAMIC_TYPE
1385 l_open_operand_type_sets: ET_DYNAMIC_TYPE_SET_LIST
1386 l_open_operand_type_set: ET_DYNAMIC_TYPE_SET
1387 l_result_type_set: detachable ET_DYNAMIC_TYPE_SET
1388 l_formals: detachable ET_FORMAL_ARGUMENT_LIST
1389 l_formal_type_set: detachable ET_DYNAMIC_TYPE_SET
1390 l_actuals: detachable ET_AGENT_ARGUMENT_OPERANDS
1391 l_actual: ET_AGENT_ARGUMENT_OPERAND
1392 i, nb: INTEGER
1393 j, nb2: INTEGER
1394 l_target: ET_AGENT_TARGET
1395 do
1396 l_dynamic_type := current_dynamic_system.dynamic_type (a_type, a_context)
1397 mark_type_alive (l_dynamic_type)
1398 set_dynamic_type_set (l_dynamic_type, an_expression)
1399 if not attached {ET_DYNAMIC_ROUTINE_TYPE} l_dynamic_type as l_agent_type then
1400 -- Internal error: the dynamic type of an agent should be an agent type.
1401 set_fatal_error
1402 error_handler.report_giaaa_error
1403 else
1404 -- Set dynamic type set of implicit 'Current' target.
1405 l_target := an_expression.target
1406 if l_target.index = 0 and current_index.item /= 0 then
1407 l_target.set_index (current_index.item)
1408 end
1409 set_dynamic_type_set (current_dynamic_type, l_target)
1410 if current_index.item = 0 then
1411 current_index.put (l_target.index)
1412 end
1413 -- Dynamic type set of 'Result'.
1414 l_result_type_set := l_agent_type.result_type_set
1415 if l_result_type_set /= Void then
1416 propagate_inline_agent_result_dynamic_types (an_expression, l_result_type_set)
1417 end
1418 -- Set dynamic type sets of open operands.
1419 l_actuals := an_expression.actual_arguments
1420 if l_actuals /= Void then
1421 nb := l_actuals.count
1422 if nb > 0 then
1423 l_formals := an_expression.formal_arguments
1424 if l_formals = Void or else l_formals.count /= nb then
1425 -- Internal error: it has already been checked somewhere else
1426 -- that there was the same number of actual and formal arguments.
1427 set_fatal_error
1428 error_handler.report_giaaa_error
1429 else
1430 l_open_operand_type_sets := l_agent_type.open_operand_type_sets
1431 nb2 := l_open_operand_type_sets.count
1432 from i := 1 until i > nb loop
1433 l_formal_type_set := dynamic_type_set (l_formals.formal_argument (i).name)
1434 if l_formal_type_set = Void then
1435 -- Internal error: the dynamic type sets of the formal
1436 -- arguments should be known at this stage.
1437 set_fatal_error
1438 error_handler.report_giaaa_error
1439 else
1440 l_actual := l_actuals.actual_argument (i)
1441 if attached {ET_EXPRESSION} l_actual as l_actual_expression then
1442 propagate_argument_dynamic_types (l_actual_expression, l_formal_type_set)
1443 else
1444 -- Open operand.
1445 j := j + 1
1446 if j > nb2 then
1447 -- Internal error: missing open operands.
1448 set_fatal_error
1449 error_handler.report_giaaa_error
1450 else
1451 l_open_operand_type_set := l_open_operand_type_sets.item (j)
1452 set_dynamic_type_set (l_open_operand_type_set, l_actual)
1453 propagate_argument_dynamic_types (l_actual, l_formal_type_set)
1454 end
1455 end
1456 end
1457 i := i + 1
1458 end
1459 if j < nb2 then
1460 -- Internal error: too many open operands.
1461 set_fatal_error
1462 error_handler.report_giaaa_error
1463 end
1464 end
1465 end
1466 end
1467 propagate_agent_closed_operands_dynamic_types (an_expression, l_agent_type)
1468 end
1469 end
1470
1471 report_inline_agent_formal_argument_declaration (a_formal: ET_FORMAL_ARGUMENT)
1472 -- Report that the declaration of the formal argument `a_formal'
1473 -- of an inline agent has been processed.
1474 local
1475 l_dynamic_type: ET_DYNAMIC_TYPE
1476 l_dynamic_type_set: ET_DYNAMIC_TYPE_SET
1477 do
1478 if current_type = current_dynamic_type.base_type then
1479 l_dynamic_type := current_dynamic_system.dynamic_type (a_formal.type, current_type)
1480 l_dynamic_type_set := new_dynamic_type_set (l_dynamic_type)
1481 -- Unless proven otherwise after possible attachments,
1482 -- a formal actual argument is assumed to be never Void.
1483 l_dynamic_type_set.set_never_void
1484 set_dynamic_type_set (l_dynamic_type_set, a_formal.name)
1485 end
1486 end
1487
1488 report_inline_agent_local_variable_declaration (a_local: ET_LOCAL_VARIABLE)
1489 -- Report that the declaration of the local variable `a_local'
1490 -- of an inline agent has been processed.
1491 local
1492 l_dynamic_type: ET_DYNAMIC_TYPE
1493 l_dynamic_type_set: ET_DYNAMIC_TYPE_SET
1494 do
1495 if current_type = current_dynamic_type.base_type then
1496 l_dynamic_type := current_dynamic_system.dynamic_type (a_local.type, current_type)
1497 l_dynamic_type_set := new_dynamic_type_set (l_dynamic_type)
1498 set_dynamic_type_set (l_dynamic_type_set, a_local.name)
1499 end
1500 end
1501
1502 report_inline_agent_result_declaration (a_type: ET_TYPE)
1503 -- Report that the declaration of the "Result" entity,
1504 -- of type `a_type', of an inline agent has been processed.
1505 local
1506 l_dynamic_type: ET_DYNAMIC_TYPE
1507 l_dynamic_type_set: ET_DYNAMIC_TYPE_SET
1508 do
1509 if current_type = current_dynamic_type.base_type then
1510 if not attached current_inline_agent as l_current_inline_agent then
1511 -- Internal error: the declaration of the "Result" entity
1512 -- of an inline agent should occur in an inline agent.
1513 set_fatal_error
1514 error_handler.report_giaaa_error
1515 elseif not attached l_current_inline_agent.implicit_result as l_implicit_result then
1516 -- Internal error: the declaration of the "Result" entity
1517 -- of an inline agent should occur in a query inline agent.
1518 set_fatal_error
1519 error_handler.report_giaaa_error
1520 else
1521 l_dynamic_type := current_dynamic_system.dynamic_type (a_type, current_type)
1522 l_dynamic_type_set := new_dynamic_type_set (l_dynamic_type)
1523 set_dynamic_type_set (l_dynamic_type_set, l_implicit_result)
1524 end
1525 end
1526 end
1527
1528 report_integer_8_constant (a_constant: ET_INTEGER_CONSTANT; a_type: ET_CLASS_TYPE)
1529 -- Report that an integer_8 of type `a_type' in the context
1530 -- of `current_type' has been processed.
1531 do
1532 report_constant_expression (a_constant, a_type)
1533 end
1534
1535 report_integer_16_constant (a_constant: ET_INTEGER_CONSTANT; a_type: ET_CLASS_TYPE)
1536 --- Report that an integer_16 of type `a_type' in the context
1537 -- of `current_type' has been processed.
1538 do
1539 report_constant_expression (a_constant, a_type)
1540 end
1541
1542 report_integer_32_constant (a_constant: ET_INTEGER_CONSTANT; a_type: ET_CLASS_TYPE)
1543 -- Report that an integer_32 of type `a_type' in the context
1544 -- of `current_type' has been processed.
1545 do
1546 report_constant_expression (a_constant, a_type)
1547 end
1548
1549 report_integer_64_constant (a_constant: ET_INTEGER_CONSTANT; a_type: ET_CLASS_TYPE)
1550 -- Report that an integer_64 of type `a_type' in the context
1551 -- of `current_type' has been processed.
1552 do
1553 report_constant_expression (a_constant, a_type)
1554 end
1555
1556 report_local_assignment_target (a_name: ET_IDENTIFIER; a_local: ET_LOCAL_VARIABLE)
1557 -- Report that the local variable `a_name' has been
1558 -- processed as target of an assignment (attempt).
1559 do
1560 if current_type = current_dynamic_type.base_type then
1561 a_name.set_index (a_local.name.index)
1562 end
1563 end
1564
1565 report_local_variable (a_name: ET_IDENTIFIER; a_local: ET_LOCAL_VARIABLE)
1566 -- Report that a call to local variable `a_name' has been processed.
1567 do
1568 if current_type = current_dynamic_type.base_type then
1569 a_name.set_index (a_local.name.index)
1570 end
1571 end
1572
1573 report_local_variable_declaration (a_local: ET_LOCAL_VARIABLE)
1574 -- Report that the declaration of the local variable `a_local'
1575 -- of a feature has been processed.
1576 local
1577 l_dynamic_type: ET_DYNAMIC_TYPE
1578 l_dynamic_type_set: ET_DYNAMIC_TYPE_SET
1579 do
1580 if current_type = current_dynamic_type.base_type then
1581 l_dynamic_type := current_dynamic_system.dynamic_type (a_local.type, current_type)
1582 l_dynamic_type_set := new_dynamic_type_set (l_dynamic_type)
1583 set_dynamic_type_set (l_dynamic_type_set, a_local.name)
1584 end
1585 end
1586
1587 report_manifest_array (an_expression: ET_MANIFEST_ARRAY; a_type: ET_TYPE; a_context: ET_TYPE_CONTEXT)
1588 -- Report that a manifest array of type `a_type' in context
1589 -- of `a_context' has been processed.
1590 local
1591 l_type: ET_DYNAMIC_TYPE
1592 l_queries: ET_DYNAMIC_FEATURE_LIST
1593 l_dynamic_type_set: detachable ET_DYNAMIC_TYPE_SET
1594 do
1595 if current_type = current_dynamic_type.base_type then
1596 l_type := current_dynamic_system.dynamic_type (a_type, a_context)
1597 mark_type_alive (l_type)
1598 set_dynamic_type_set (l_type, an_expression)
1599 -- Make sure that types "SPECIAL [XXX]" (used in feature 'area'), and
1600 -- "INTEGER" (used in feature 'lower' and 'upper') are marked as alive.
1601 l_queries := l_type.queries
1602 if l_queries.count < 3 then
1603 -- Error already reported in ET_DYNAMIC_SYSTEM.compile_kernel.
1604 set_fatal_error
1605 -- TODO: internal error
1606 else
1607 -- Feature 'area' should be the first in the list of features.
1608 l_dynamic_type_set := l_queries.item (1).result_type_set
1609 if l_dynamic_type_set = Void then
1610 -- Error in feature 'area', already reported in ET_DYNAMIC_SYSTEM.compile_kernel.
1611 set_fatal_error
1612 -- TODO: internal error
1613 else
1614 mark_type_alive (l_dynamic_type_set.static_type)
1615 end
1616 -- Feature 'lower' should be the second in the list of features.
1617 l_dynamic_type_set := l_queries.item (2).result_type_set
1618 if l_dynamic_type_set = Void then
1619 -- Error in feature 'lower', already reported in ET_DYNAMIC_SYSTEM.compile_kernel.
1620 set_fatal_error
1621 -- TODO: internal error
1622 else
1623 mark_type_alive (l_dynamic_type_set.static_type)
1624 end
1625 -- Feature 'upper' should be the third in the list of features.
1626 l_dynamic_type_set := l_queries.item (3).result_type_set
1627 if l_dynamic_type_set = Void then
1628 -- Error in feature 'upper', already reported in ET_DYNAMIC_SYSTEM.compile_kernel.
1629 set_fatal_error
1630 -- TODO: internal error
1631 else
1632 mark_type_alive (l_dynamic_type_set.static_type)
1633 end
1634 end
1635 end
1636 end
1637
1638 report_manifest_tuple (an_expression: ET_MANIFEST_TUPLE; a_type: ET_TYPE; a_context: ET_TYPE_CONTEXT)
1639 -- Report that a manifest tuple of type `a_type' in context of
1640 -- `a_context' has been processed.
1641 local
1642 l_type: ET_DYNAMIC_TYPE
1643 do
1644 if current_type = current_dynamic_type.base_type then
1645 l_type := current_dynamic_system.dynamic_type (a_type, a_context)
1646 mark_type_alive (l_type)
1647 set_dynamic_type_set (l_type, an_expression)
1648 end
1649 end
1650
1651 report_manifest_type (an_expression: ET_MANIFEST_TYPE; a_type: ET_TYPE; a_context: ET_TYPE_CONTEXT)
1652 -- Report that a manifest type of type `a_type' in context of
1653 -- in `a_context' has been processed.
1654 local
1655 l_type: ET_DYNAMIC_TYPE
1656 do
1657 if current_type = current_dynamic_type.base_type then
1658 l_type := current_dynamic_system.dynamic_type (a_type, a_context)
1659 mark_type_alive (l_type)
1660 set_dynamic_type_set (l_type, an_expression)
1661 end
1662 end
1663
1664 report_named_object_test (a_object_test: ET_NAMED_OBJECT_TEST; a_local_type: ET_TYPE_CONTEXT)
1665 -- Report that the object-test `a_object_test' with local
1666 -- of type `a_local_type' has been processed.
1667 local
1668 l_dynamic_type: ET_DYNAMIC_TYPE
1669 l_dynamic_type_set: ET_DYNAMIC_TYPE_SET
1670 do
1671 if current_type = current_dynamic_type.base_type then
1672 -- Object-tests are of type "BOOLEAN".
1673 report_constant_expression (a_object_test, current_universe_impl.boolean_type)
1674 -- Take care of the type of the object-test local.
1675 l_dynamic_type := current_dynamic_system.dynamic_type (tokens.identity_type, a_local_type)
1676 l_dynamic_type_set := new_dynamic_type_set (l_dynamic_type)
1677 -- An object-test local is assumed to be never Void.
1678 l_dynamic_type_set.set_never_void
1679 set_dynamic_type_set (l_dynamic_type_set, a_object_test.name)
1680 propagate_named_object_test_dynamic_types (a_object_test)
1681 end
1682 end
1683
1684 report_natural_8_constant (a_constant: ET_INTEGER_CONSTANT; a_type: ET_CLASS_TYPE)
1685 -- Report that a natural_8 of type `a_type' in the context
1686 -- of `current_type' has been processed.
1687 do
1688 report_constant_expression (a_constant, a_type)
1689 end
1690
1691 report_natural_16_constant (a_constant: ET_INTEGER_CONSTANT; a_type: ET_CLASS_TYPE)
1692 -- Report that a natural_16 of type `a_type' in the context
1693 -- of `current_type' has been processed.
1694 do
1695 report_constant_expression (a_constant, a_type)
1696 end
1697
1698 report_natural_32_constant (a_constant: ET_INTEGER_CONSTANT; a_type: ET_CLASS_TYPE)
1699 -- Report that a natural_32 of type `a_type' in the context
1700 -- of `current_type' has been processed.
1701 do
1702 report_constant_expression (a_constant, a_type)
1703 end
1704
1705 report_natural_64_constant (a_constant: ET_INTEGER_CONSTANT; a_type: ET_CLASS_TYPE)
1706 -- Report that a natural_64 of type `a_type' in the context
1707 -- of `current_type' has been processed.
1708 do
1709 report_constant_expression (a_constant, a_type)
1710 end
1711
1712 report_object_equality_expression (an_expression: ET_OBJECT_EQUALITY_EXPRESSION; a_target_type: ET_TYPE_CONTEXT)
1713 -- Report that an object equality expression has been processed.
1714 -- `a_target_type' is the type of the target of the call to 'is_equal'
1715 -- internally invoked by the object equality expression.
1716 local
1717 l_object_equality: ET_DYNAMIC_OBJECT_EQUALITY_EXPRESSION
1718 l_target_type_set: detachable ET_DYNAMIC_TYPE_SET
1719 do
1720 if current_type = current_dynamic_type.base_type then
1721 report_constant_expression (an_expression, current_universe_impl.boolean_type)
1722 l_target_type_set := dynamic_type_set (an_expression.left)
1723 if l_target_type_set = Void then
1724 -- Internal error: the dynamic type sets of the
1725 -- left operand should be known at this stage.
1726 set_fatal_error
1727 error_handler.report_giaaa_error
1728 else
1729 create l_object_equality.make (an_expression, l_target_type_set, current_dynamic_feature, current_dynamic_type)
1730 l_target_type_set.static_type.put_object_equality_expression (l_object_equality)
1731 propagate_object_equality_expression_target_dynamic_types (l_object_equality)
1732 end
1733 end
1734 end
1735
1736 report_object_test (a_object_test: ET_OBJECT_TEST)
1737 -- Report that the object-test `a_object_test' has been processed.
1738 do
1739 report_constant_expression (a_object_test, current_universe_impl.boolean_type)
1740 end
1741
1742 report_object_test_type (a_object_test: ET_OBJECT_TEST; a_type: ET_TYPE; a_context: ET_TYPE_CONTEXT)
1743 -- Report that the type `a_type' in context `a_context' appearing
1744 -- in the object-test `a_object_test' has been processed.
1745 local
1746 l_type: ET_DYNAMIC_TYPE
1747 do
1748 if current_type = current_dynamic_type.base_type then
1749 l_type := current_dynamic_system.dynamic_type (a_type, a_context)
1750 mark_type_alive (l_type)
1751 end
1752 end
1753
1754 report_object_test_local (a_name: ET_IDENTIFIER; a_object_test: ET_NAMED_OBJECT_TEST)
1755 -- Report that a call to object-test local `a_name' has been processed.
1756 do
1757 if current_type = current_dynamic_type.base_type then
1758 a_name.set_index (a_object_test.name.index)
1759 end
1760 end
1761
1762 report_pointer_expression (an_expression: ET_ADDRESS_EXPRESSION; a_type: ET_CLASS_TYPE)
1763 -- Report that a pointer expression of type `a_type' in the context
1764 -- of `current_type' has been processed.
1765 do
1766 report_constant_expression (an_expression, a_type)
1767 end
1768
1769 report_precursor_expression (an_expression: ET_PRECURSOR_EXPRESSION; a_parent_type: ET_BASE_TYPE; a_query: ET_QUERY)
1770 -- Report that a precursor expression has been processed.
1771 -- `a_parent_type' is viewed in the context of `current_type'
1772 -- and `a_query' is the precursor feature.
1773 local
1774 i, nb: INTEGER
1775 l_parent_type: ET_DYNAMIC_TYPE
1776 l_precursor: ET_DYNAMIC_FEATURE
1777 l_dynamic_type_set: detachable ET_DYNAMIC_TYPE_SET
1778 l_actual: ET_EXPRESSION
1779 do
1780 if current_type = current_dynamic_type.base_type then
1781 l_parent_type := current_dynamic_system.dynamic_type (a_parent_type, current_type)
1782 l_precursor := current_dynamic_feature.dynamic_precursor (a_query, l_parent_type, current_dynamic_system)
1783 if attached an_expression.arguments as l_actuals then
1784 nb := l_actuals.count
1785 from i := 1 until i > nb loop
1786 l_actual := l_actuals.actual_argument (i)
1787 propagate_argument_operand_dynamic_types (l_actual, i, l_precursor)
1788 i := i + 1
1789 end
1790 end
1791 l_dynamic_type_set := l_precursor.result_type_set
1792 if l_dynamic_type_set = Void then
1793 -- Internal error: the result type set of a query cannot be void.
1794 set_fatal_error
1795 error_handler.report_giaaa_error
1796 else
1797 set_dynamic_type_set (l_dynamic_type_set, an_expression)
1798 end
1799 end
1800 end
1801
1802 report_precursor_instruction (an_instruction: ET_PRECURSOR_INSTRUCTION; a_parent_type: ET_BASE_TYPE; a_procedure: ET_PROCEDURE)
1803 -- Report that a precursor instruction has been processed.
1804 -- `a_parent_type' is viewed in the context of `current_type'
1805 -- and `a_procedure' is the precursor feature.
1806 local
1807 i, nb: INTEGER
1808 l_parent_type: ET_DYNAMIC_TYPE
1809 l_precursor: ET_DYNAMIC_FEATURE
1810 l_actual: ET_EXPRESSION
1811 do
1812 if current_type = current_dynamic_type.base_type then
1813 l_parent_type := current_dynamic_system.dynamic_type (a_parent_type, current_type)
1814 l_precursor := current_dynamic_feature.dynamic_precursor (a_procedure, l_parent_type, current_dynamic_system)
1815 if attached an_instruction.arguments as l_actuals then
1816 nb := l_actuals.count
1817 from i := 1 until i > nb loop
1818 l_actual := l_actuals.actual_argument (i)
1819 propagate_argument_operand_dynamic_types (l_actual, i, l_precursor)
1820 i := i + 1
1821 end
1822 end
1823 end
1824 end
1825
1826 report_procedure_address (an_expression: ET_FEATURE_ADDRESS; a_procedure: ET_PROCEDURE)
1827 -- Report that function `a_procedure' has been processed
1828 -- as target of feature address `an_expression'.
1829 local
1830 l_dynamic_procedure: ET_DYNAMIC_FEATURE
1831 do
1832 if current_type = current_dynamic_type.base_type then
1833 l_dynamic_procedure := current_dynamic_type.dynamic_procedure (a_procedure, current_dynamic_system)
1834 l_dynamic_procedure.set_address (True)
1835 -- TODO: the dynamic type set of the formal arguments of `l_dynamic_procedure'
1836 -- may be altered when its address is passed to an external routine.
1837 end
1838 end
1839
1840 report_procedure_inline_agent (an_expression: ET_PROCEDURE_INLINE_AGENT; a_type: ET_TYPE; a_context: ET_TYPE_CONTEXT)
1841 -- Report that procedure inline agent of type `a_type' in `a_context' has been processed.
1842 do
1843 if current_type = current_dynamic_type.base_type then
1844 report_inline_agent (an_expression, a_type, a_context)
1845 end
1846 end
1847
1848 report_qualified_call_expression (an_expression: ET_QUALIFIED_FEATURE_CALL_EXPRESSION; a_target_type: ET_TYPE_CONTEXT; a_query: ET_QUERY)
1849 -- Report that a qualified call expression has been processed.
1850 local
1851 l_target_type_set: detachable ET_DYNAMIC_TYPE_SET
1852 l_result_type_set: ET_DYNAMIC_TYPE_SET
1853 l_dynamic_call: ET_DYNAMIC_QUALIFIED_QUERY_CALL
1854 l_target: ET_EXPRESSION
1855 l_type: ET_TYPE
1856 l_actuals: detachable ET_ACTUAL_ARGUMENTS
1857 l_actual_type_set: detachable ET_DYNAMIC_TYPE_SET
1858 l_dynamic_type: detachable ET_DYNAMIC_TYPE
1859 do
1860 if current_type = current_dynamic_type.base_type then
1861 l_target := an_expression.target
1862 l_target_type_set := dynamic_type_set (l_target)
1863 if l_target_type_set = Void then
1864 -- Internal error: the dynamic type sets of the
1865 -- target should be known at this stage.
1866 set_fatal_error
1867 error_handler.report_giaaa_error
1868 else
1869 l_type := a_query.type
1870 -- TODO: like argument (the following is just a workaround
1871 -- which works only in a limited number of cases, in particular
1872 -- for ANY.clone).
1873 if attached {ET_LIKE_FEATURE} l_type as l_like and then l_like.is_like_argument then
1874 l_actuals := an_expression.arguments
1875 if l_actuals /= Void and then l_actuals.count = 1 then
1876 l_actual_type_set := dynamic_type_set (l_actuals.actual_argument (1))
1877 if l_actual_type_set = Void then
1878 -- Internal error: the dynamic type sets of the
1879 -- arguments should be known at this stage.
1880 set_fatal_error
1881 error_handler.report_giaaa_error
1882 else
1883 l_dynamic_type := l_actual_type_set.static_type
1884 end
1885 end
1886 end
1887 if l_dynamic_type = Void then
1888 l_dynamic_type := current_dynamic_system.dynamic_type (l_type, l_target_type_set.static_type.base_type)
1889 end
1890 l_result_type_set := new_dynamic_type_set (l_dynamic_type)
1891 -- Unless proven otherwise after possible attachments,
1892 -- the result is assumed to be never Void.
1893 l_result_type_set.set_never_void
1894 set_dynamic_type_set (l_result_type_set, an_expression)
1895 create l_dynamic_call.make (an_expression, l_target_type_set, l_result_type_set, current_dynamic_feature, current_dynamic_type)
1896 l_target_type_set.static_type.put_query_call (l_dynamic_call)
1897 propagate_qualified_call_target_dynamic_types (l_dynamic_call)
1898 end
1899 end
1900 end
1901
1902 report_qualified_call_instruction (an_instruction: ET_QUALIFIED_FEATURE_CALL_INSTRUCTION; a_target_type: ET_TYPE_CONTEXT; a_procedure: ET_PROCEDURE)
1903 -- Report that a qualified call instruction has been processed.
1904 local
1905 l_target_type_set: detachable ET_DYNAMIC_TYPE_SET
1906 l_dynamic_call: ET_DYNAMIC_QUALIFIED_PROCEDURE_CALL
1907 l_target: ET_EXPRESSION
1908 do
1909 if current_type = current_dynamic_type.base_type then
1910 l_target := an_instruction.target
1911 l_target_type_set := dynamic_type_set (l_target)
1912 if l_target_type_set = Void then
1913 -- Internal error: the dynamic type sets of the
1914 -- target should be known at this stage.
1915 set_fatal_error
1916 error_handler.report_giaaa_error
1917 else
1918 create l_dynamic_call.make (an_instruction, l_target_type_set, current_dynamic_feature, current_dynamic_type)
1919 l_target_type_set.static_type.put_procedure_call (l_dynamic_call)
1920 propagate_qualified_call_target_dynamic_types (l_dynamic_call)
1921 end
1922 end
1923 end
1924
1925 report_qualified_procedure_call_agent (an_expression: ET_CALL_AGENT; a_procedure: ET_PROCEDURE; an_agent_type: ET_TYPE; a_context: ET_TYPE_CONTEXT)
1926 -- Report that a qualified procedure call (to `a_procedure') agent
1927 -- of type `an_agent_type' in `a_context' has been processed.
1928 do
1929 if current_type = current_dynamic_type.base_type then
1930 report_qualified_call_agent (an_expression, a_procedure, an_agent_type, a_context)
1931 end
1932 end
1933
1934 report_qualified_query_call_agent (an_expression: ET_CALL_AGENT; a_query: ET_QUERY; an_agent_type: ET_TYPE; a_context: ET_TYPE_CONTEXT)
1935 -- Report that a qualified query call (to `a_query') agent
1936 -- of type `an_agent_type' in `a_context' has been processed.
1937 do
1938 if current_type = current_dynamic_type.base_type then
1939 report_qualified_call_agent (an_expression, a_query, an_agent_type, a_context)
1940 end
1941 end
1942
1943 report_qualified_call_agent (an_expression: ET_CALL_AGENT; a_feature: ET_FEATURE; an_agent_type: ET_TYPE; a_context: ET_TYPE_CONTEXT)
1944 -- Report that a qualified call (to `a_feature') agent
1945 -- of type `an_agent_type' in `a_context' has been processed.
1946 local
1947 l_dynamic_type: ET_DYNAMIC_TYPE
1948 l_target_type_set: detachable ET_DYNAMIC_TYPE_SET
1949 l_open_operand_type_sets: ET_DYNAMIC_TYPE_SET_LIST
1950 l_target: ET_AGENT_TARGET
1951 i, nb: INTEGER
1952 j, nb2: INTEGER
1953 l_actuals: detachable ET_AGENT_ARGUMENT_OPERANDS
1954 l_actual: ET_AGENT_ARGUMENT_OPERAND
1955 l_dynamic_type_set: ET_DYNAMIC_TYPE_SET
1956 l_result_type_set: detachable ET_DYNAMIC_TYPE_SET
1957 l_dynamic_procedure_call: ET_DYNAMIC_QUALIFIED_PROCEDURE_CALL
1958 do
1959 l_dynamic_type := current_dynamic_system.dynamic_type (an_agent_type, a_context)
1960 mark_type_alive (l_dynamic_type)
1961 set_dynamic_type_set (l_dynamic_type, an_expression)
1962 if not attached {ET_DYNAMIC_ROUTINE_TYPE} l_dynamic_type as l_dynamic_agent_type then
1963 -- Internal error: the dynamic type of an agent should be an agent type.
1964 set_fatal_error
1965 error_handler.report_giaaa_error
1966 else
1967 l_open_operand_type_sets := l_dynamic_agent_type.open_operand_type_sets
1968 nb2 := l_open_operand_type_sets.count
1969 l_target := an_expression.target
1970 if attached {ET_EXPRESSION} l_target as l_target_expression then
1971 l_target_type_set := dynamic_type_set (l_target_expression)
1972 else
1973 -- The agent is of the form: agent {TYPE}.f
1974 -- The dynamic type set of the target is the first of open operand dynamic type sets.
1975 j := 1
1976 if not l_open_operand_type_sets.is_empty then
1977 l_target_type_set := l_open_operand_type_sets.item (1)
1978 set_dynamic_type_set (l_target_type_set, l_target)
1979 end
1980 end
1981 if l_target_type_set = Void then
1982 -- Internal error: the dynamic type sets of the
1983 -- target should be known at this stage.
1984 set_fatal_error
1985 error_handler.report_giaaa_error
1986 else
1987 -- Set dynamic type sets of open operands.
1988 l_actuals := an_expression.arguments
1989 if l_actuals /= Void then
1990 nb := l_actuals.count
1991 if nb = 0 then
1992 -- Do nothing.
1993 else
1994 from i := 1 until i > nb loop
1995 l_actual := l_actuals.actual_argument (i)
1996 if attached {ET_EXPRESSION} l_actual then
1997 -- Do nothing.
1998 else
1999 -- Open operand.
2000 j := j + 1
2001 if j > nb2 then
2002 -- Internal error: missing open operands.
2003 set_fatal_error
2004 error_handler.report_giaaa_error
2005 else
2006 l_dynamic_type_set := l_open_operand_type_sets.item (j)
2007 set_dynamic_type_set (l_dynamic_type_set, l_actual)
2008 end
2009 end
2010 i := i + 1
2011 end
2012 if j < nb2 then
2013 -- Internal error: too many open operands.
2014 set_fatal_error
2015 error_handler.report_giaaa_error
2016 end
2017 end
2018 end
2019 l_result_type_set := l_dynamic_agent_type.result_type_set
2020 if l_result_type_set /= Void then
2021 if not attached an_expression.implicit_result as l_implicit_result then
2022 -- Internal error: if the type of the agent has a result type set,
2023 -- then the agent has to be a query agent.
2024 set_fatal_error
2025 error_handler.report_giaaa_error
2026 else
2027 set_dynamic_type_set (l_result_type_set, l_implicit_result)
2028 report_agent_qualified_query_call (an_expression, l_target_type_set, l_result_type_set)
2029 end
2030 else
2031 create l_dynamic_procedure_call.make (an_expression, l_target_type_set, current_dynamic_feature, current_dynamic_type)
2032 l_target_type_set.static_type.put_procedure_call (l_dynamic_procedure_call)
2033 propagate_qualified_call_target_dynamic_types (l_dynamic_procedure_call)
2034 end
2035 end
2036 propagate_agent_closed_operands_dynamic_types (an_expression, l_dynamic_agent_type)
2037 end
2038 end
2039
2040 report_agent_qualified_query_call (an_expression: ET_CALL_AGENT; a_target_type_set: ET_DYNAMIC_TYPE_SET; a_result_type_set: ET_DYNAMIC_TYPE_SET)
2041 -- Report the agent `an_expression' makes a qualified query call
2042 -- on `a_target_type_set' and returns `a_result_type_set'.
2043 require
2044 an_expression_not_void: an_expression /= Void
2045 qualified_call_agent: an_expression.is_qualified_call
2046 query_call: not an_expression.is_procedure
2047 a_target_type_set_not_void: a_target_type_set /= Void
2048 a_result_type_set_not_void: a_result_type_set /= Void
2049 local
2050 l_dynamic_query_call: ET_DYNAMIC_QUALIFIED_QUERY_CALL
2051 do
2052 create l_dynamic_query_call.make (an_expression, a_target_type_set, a_result_type_set, current_dynamic_feature, current_dynamic_type)
2053 a_target_type_set.static_type.put_query_call (l_dynamic_query_call)
2054 propagate_qualified_call_target_dynamic_types (l_dynamic_query_call)
2055 end
2056
2057 report_query_inline_agent (an_expression: ET_QUERY_INLINE_AGENT; a_type: ET_TYPE; a_context: ET_TYPE_CONTEXT)
2058 -- Report that a query inline agent of type `a_type' in `a_context' has been processed.
2059 do
2060 if current_type = current_dynamic_type.base_type then
2061 report_inline_agent (an_expression, a_type, a_context)
2062 end
2063 end
2064
2065 report_real_32_constant (a_constant: ET_REAL_CONSTANT; a_type: ET_CLASS_TYPE)
2066 -- Report that a real_32 of type `a_type' in the context
2067 -- of `current_type' has been processed.
2068 do
2069 report_constant_expression (a_constant, a_type)
2070 end
2071
2072 report_real_64_constant (a_constant: ET_REAL_CONSTANT; a_type: ET_CLASS_TYPE)
2073 -- Report that a real_64 of type `a_type' in the context
2074 -- of `current_type' has been processed.
2075 do
2076 report_constant_expression (a_constant, a_type)
2077 end
2078
2079 report_result (an_expression: ET_RESULT)
2080 -- Report that the result entity has been processed.
2081 local
2082 l_dynamic_type_set: detachable ET_DYNAMIC_TYPE_SET
2083 l_implicit_result: detachable ET_RESULT
2084 l_result_index: INTEGER
2085 do
2086 if current_type = current_dynamic_type.base_type then
2087 if attached current_inline_agent as l_current_inline_agent then
2088 l_implicit_result := l_current_inline_agent.implicit_result
2089 if l_implicit_result /= Void then
2090 l_dynamic_type_set := dynamic_type_set (l_implicit_result)
2091 l_result_index := l_implicit_result.index
2092 end
2093 else
2094 l_dynamic_type_set := current_dynamic_feature.result_type_set
2095 l_result_index := result_index.item
2096 end
2097 if l_dynamic_type_set = Void then
2098 -- Internal error: the result type set of a function cannot be void.
2099 set_fatal_error
2100 error_handler.report_giaaa_error
2101 else
2102 if an_expression.index = 0 then
2103 an_expression.set_index (l_result_index)
2104 end
2105 set_dynamic_type_set (l_dynamic_type_set, an_expression)
2106 if current_inline_agent = Void then
2107 if result_index.item = 0 then
2108 result_index.put (an_expression.index)
2109 end
2110 end
2111 end
2112 end
2113 end
2114
2115 report_result_assignment_target (a_result: ET_RESULT)
2116 -- Report that the result entity has been processed
2117 -- as target of an assignment (attempt).
2118 local
2119 l_dynamic_type_set: detachable ET_DYNAMIC_TYPE_SET
2120 l_implicit_result: detachable ET_RESULT
2121 l_result_index: INTEGER
2122 do
2123 if current_type = current_dynamic_type.base_type then
2124 if attached current_inline_agent as l_current_inline_agent then
2125 l_implicit_result := l_current_inline_agent.implicit_result
2126 if l_implicit_result /= Void then
2127 l_dynamic_type_set := dynamic_type_set (l_implicit_result)
2128 l_result_index := l_implicit_result.index
2129 end
2130 else
2131 l_dynamic_type_set := current_dynamic_feature.result_type_set
2132 l_result_index := result_index.item
2133 end
2134 if l_dynamic_type_set = Void then
2135 -- Internal error: the result type set of a function cannot be void.
2136 set_fatal_error
2137 error_handler.report_giaaa_error
2138 else
2139 if a_result.index = 0 then
2140 a_result.set_index (l_result_index)
2141 end
2142 set_dynamic_type_set (l_dynamic_type_set, a_result)
2143 if current_inline_agent = Void then
2144 if result_index.item = 0 then
2145 result_index.put (a_result.index)
2146 end
2147 end
2148 end
2149 end
2150 end
2151
2152 report_static_call_expression (an_expression: ET_STATIC_CALL_EXPRESSION; a_type: ET_TYPE; a_query: ET_QUERY)
2153 -- Report that a static call expression has been processed.
2154 local
2155 i, nb: INTEGER
2156 l_dynamic_type: ET_DYNAMIC_TYPE
2157 l_dynamic_query: ET_DYNAMIC_FEATURE
2158 l_dynamic_type_set: detachable ET_DYNAMIC_TYPE_SET
2159 l_actual: ET_EXPRESSION
2160 do
2161 if current_type = current_dynamic_type.base_type then
2162 l_dynamic_type := current_dynamic_system.dynamic_type (a_type, current_type)
2163 l_dynamic_query := l_dynamic_type.dynamic_query (a_query, current_dynamic_system)
2164 l_dynamic_query.set_static (True)
2165 l_dynamic_type.set_static (True)
2166 if attached an_expression.arguments as l_actuals then
2167 nb := l_actuals.count
2168 from i := 1 until i > nb loop
2169 l_actual := l_actuals.actual_argument (i)
2170 propagate_argument_operand_dynamic_types (l_actual, i, l_dynamic_query)
2171 i := i + 1
2172 end
2173 end
2174 l_dynamic_type_set := l_dynamic_query.result_type_set
2175 if l_dynamic_type_set = Void then
2176 -- Internal error: the result type set of a query cannot be void.
2177 set_fatal_error
2178 error_handler.report_giaaa_error
2179 else
2180 set_dynamic_type_set (l_dynamic_type_set, an_expression)
2181 end
2182 end
2183 end
2184
2185 report_static_call_instruction (an_instruction: ET_STATIC_CALL_INSTRUCTION; a_type: ET_TYPE; a_procedure: ET_PROCEDURE)
2186 -- Report that a static call instruction has been processed.
2187 local
2188 i, nb: INTEGER
2189 l_dynamic_type: ET_DYNAMIC_TYPE
2190 l_dynamic_procedure: ET_DYNAMIC_FEATURE
2191 l_actual: ET_EXPRESSION
2192 do
2193 if current_type = current_dynamic_type.base_type then
2194 l_dynamic_type := current_dynamic_system.dynamic_type (a_type, current_type)
2195 l_dynamic_procedure := l_dynamic_type.dynamic_procedure (a_procedure, current_dynamic_system)
2196 l_dynamic_procedure.set_static (True)
2197 l_dynamic_type.set_static (True)
2198 if attached an_instruction.arguments as l_actuals then
2199 nb := l_actuals.count
2200 from i := 1 until i > nb loop
2201 l_actual := l_actuals.actual_argument (i)
2202 propagate_argument_operand_dynamic_types (l_actual, i, l_dynamic_procedure)
2203 i := i + 1
2204 end
2205 end
2206 end
2207 end
2208
2209 report_string_constant (a_string: ET_MANIFEST_STRING; a_type: ET_CLASS_TYPE)
2210 -- Report that `a_string', whose type is always `a_type'
2211 -- in the context of `current_type', has been processed.
2212 require
2213 no_error: not has_fatal_error
2214 a_string_not_void: a_string /= Void
2215 a_type_not_void: a_type /= Void
2216 local
2217 l_string_type: ET_DYNAMIC_TYPE
2218 l_area_type_set: detachable ET_DYNAMIC_TYPE_SET
2219 l_area_type: ET_DYNAMIC_TYPE
2220 do
2221 if current_type = current_dynamic_type.base_type then
2222 l_string_type := current_dynamic_system.dynamic_type (a_type, current_type)
2223 mark_type_alive (l_string_type)
2224 if l_string_type.attribute_count < 2 then
2225 -- Internal error: class "STRING" should have at least the
2226 -- features 'area' and 'count' as first features.
2227 -- Already reported in ET_DYNAMIC_SYSTEM.compile_kernel.
2228 set_fatal_error
2229 error_handler.report_giaaa_error
2230 else
2231 -- Attribute 'area'.
2232 l_area_type_set := l_string_type.queries.item (1).result_type_set
2233 if l_area_type_set = Void then
2234 -- Error in feature 'area', already reported in ET_DYNAMIC_SYSTEM.compile_kernel.
2235 set_fatal_error
2236 error_handler.report_giaaa_error
2237 else
2238 l_area_type := l_area_type_set.static_type
2239 mark_type_alive (l_area_type)
2240 propagate_manifest_string_area_dynamic_type (l_area_type, l_area_type_set, a_string)
2241 end
2242 end
2243 constant_indexes.search (l_string_type)
2244 if constant_indexes.found and a_string.index = 0 then
2245 a_string.set_index (constant_indexes.found_item)
2246 end
2247 set_dynamic_type_set (l_string_type, a_string)
2248 if not constant_indexes.found then
2249 constant_indexes.force_last (a_string.index, l_string_type)
2250 end
2251 end
2252 end
2253
2254 report_string_8_constant (a_string: ET_MANIFEST_STRING; a_type: ET_CLASS_TYPE)
2255 -- Report that a string_8 of type `a_type' in the context
2256 -- of `current_type' has been processed.
2257 do
2258 report_string_constant (a_string, a_type)
2259 end
2260
2261 report_string_32_constant (a_string: ET_MANIFEST_STRING; a_type: ET_CLASS_TYPE)
2262 -- Report that a string_8 of type `a_type' in the context
2263 -- of `current_type' has been processed.
2264 do
2265 report_string_constant (a_string, a_type)
2266 end
2267
2268 report_strip_expression (an_expression: ET_STRIP_EXPRESSION; a_type: ET_TYPE; a_context: ET_TYPE_CONTEXT)
2269 -- Report that a strip expression of type `a_type'
2270 -- in `a_context' has been processed.
2271 local
2272 l_type: ET_DYNAMIC_TYPE
2273 do
2274 if current_type = current_dynamic_type.base_type then
2275 l_type := current_dynamic_system.dynamic_type (a_type, a_context)
2276 mark_type_alive (l_type)
2277 set_dynamic_type_set (l_type, an_expression)
2278 end
2279 end
2280
2281 report_tuple_label_call_agent (an_expression: ET_CALL_AGENT; an_agent_type: ET_TYPE; a_context: ET_TYPE_CONTEXT)
2282 -- Report that a tuple label call agent of type `an_agent_type'
2283 -- in `a_context' has been processed.
2284 local
2285 l_dynamic_type: ET_DYNAMIC_TYPE
2286 l_target_type_set: detachable ET_DYNAMIC_TYPE_SET
2287 l_open_operand_type_sets: ET_DYNAMIC_TYPE_SET_LIST
2288 l_target: ET_AGENT_TARGET
2289 l_result_type_set: detachable ET_DYNAMIC_TYPE_SET
2290 do
2291 if current_type = current_dynamic_type.base_type then
2292 l_dynamic_type := current_dynamic_system.dynamic_type (an_agent_type, a_context)
2293 mark_type_alive (l_dynamic_type)
2294 set_dynamic_type_set (l_dynamic_type, an_expression)
2295 if not attached {ET_DYNAMIC_ROUTINE_TYPE} l_dynamic_type as l_dynamic_agent_type then
2296 -- Internal error: the dynamic type of an agent should be an agent type.
2297 set_fatal_error
2298 error_handler.report_giaaa_error
2299 else
2300 l_open_operand_type_sets := l_dynamic_agent_type.open_operand_type_sets
2301 l_target := an_expression.target
2302 if attached {ET_EXPRESSION} l_target as l_target_expression then
2303 l_target_type_set := dynamic_type_set (l_target_expression)
2304 else
2305 -- The agent is of the form: agent {TYPE}.f
2306 -- The dynamic type set of the target is the first of open operand dynamic type sets.
2307 if not l_open_operand_type_sets.is_empty then
2308 l_target_type_set := l_open_operand_type_sets.item (1)
2309 set_dynamic_type_set (l_target_type_set, l_target)
2310 end
2311 end
2312 l_result_type_set := l_dynamic_agent_type.result_type_set
2313 if l_target_type_set = Void then
2314 -- Internal error: the dynamic type sets of the
2315 -- target should be known at this stage.
2316 set_fatal_error
2317 error_handler.report_giaaa_error
2318 elseif l_result_type_set = Void then
2319 -- Internal error: if the corresponding feature is a query
2320 -- then the result type set should not be Void.
2321 set_fatal_error
2322 error_handler.report_giaaa_error
2323 elseif not attached an_expression.implicit_result as l_implicit_result then
2324 -- Internal error: a tuple call agent should have an implicit result.
2325 -- See precondition 'query_call' and the postcondition of ET_CALL_AGENT.is_procedure.
2326 set_fatal_error
2327 error_handler.report_giaaa_error
2328 else
2329 set_dynamic_type_set (l_result_type_set, l_implicit_result)
2330 report_agent_qualified_query_call (an_expression, l_target_type_set, l_result_type_set)
2331 end
2332 end
2333 end
2334 end
2335
2336 report_tuple_label_expression (an_expression: ET_QUALIFIED_FEATURE_CALL_EXPRESSION; a_target_type: ET_TYPE_CONTEXT)
2337 -- Report that a call to a tuple label has been processed.
2338 local
2339 l_target: ET_EXPRESSION
2340 l_target_type_set: detachable ET_DYNAMIC_TYPE_SET
2341 l_item_type_sets: ET_DYNAMIC_TYPE_SET_LIST
2342 l_index: INTEGER
2343 l_dynamic_type: ET_DYNAMIC_TYPE
2344 l_result_type_set: ET_DYNAMIC_TYPE_SET
2345 l_dynamic_call: ET_DYNAMIC_QUALIFIED_QUERY_CALL
2346 do
2347 if current_type = current_dynamic_type.base_type then
2348 l_target := an_expression.target
2349 l_target_type_set := dynamic_type_set (l_target)
2350 if l_target_type_set = Void then
2351 -- Internal error: the dynamic type sets of the
2352 -- target should be known at this stage.
2353 set_fatal_error
2354 error_handler.report_giaaa_error
2355 else
2356 if not attached {ET_DYNAMIC_TUPLE_TYPE} l_target_type_set.static_type as l_tuple_type then
2357 -- Internal error: the target of a label expression
2358 -- should be a Tuple.
2359 set_fatal_error
2360 error_handler.report_giaaa_error
2361 else
2362 l_item_type_sets := l_tuple_type.item_type_sets
2363 l_index := an_expression.name.seed
2364 if not l_item_type_sets.valid_index (l_index) then
2365 -- Internal error: invalid label index.
2366 set_fatal_error
2367 error_handler.report_giaaa_error
2368 else
2369 l_dynamic_type := l_item_type_sets.item (l_index).static_type
2370 l_result_type_set := new_dynamic_type_set (l_dynamic_type)
2371 -- Unless proven otherwise after possible attachments,
2372 -- the result is assumed to be never Void.
2373 l_result_type_set.set_never_void
2374 set_dynamic_type_set (l_result_type_set, an_expression)
2375 create l_dynamic_call.make (an_expression, l_target_type_set, l_result_type_set, current_dynamic_feature, current_dynamic_type)
2376 l_target_type_set.static_type.put_query_call (l_dynamic_call)
2377 propagate_qualified_call_target_dynamic_types (l_dynamic_call)
2378 end
2379 end
2380 end
2381 end
2382 end
2383
2384 report_tuple_label_setter (an_assigner: ET_ASSIGNER_INSTRUCTION; a_target_type: ET_TYPE_CONTEXT)
2385 -- Report that a call to the setter of a tuple label has been processed.
2386 local
2387 l_dynamic_call: ET_DYNAMIC_QUALIFIED_PROCEDURE_CALL
2388 l_target: ET_EXPRESSION
2389 l_target_type_set: detachable ET_DYNAMIC_TYPE_SET
2390 l_call: ET_QUALIFIED_FEATURE_CALL_EXPRESSION
2391 do
2392 if current_type = current_dynamic_type.base_type then
2393 l_call := an_assigner.call
2394 l_target := l_call.target
2395 l_target_type_set := dynamic_type_set (l_target)
2396 if l_target_type_set = Void then
2397 -- Internal error: the dynamic type sets of the
2398 -- target should be known at this stage.
2399 set_fatal_error
2400 error_handler.report_giaaa_error
2401 else
2402 create l_dynamic_call.make (an_assigner, l_target_type_set, current_dynamic_feature, current_dynamic_type)
2403 l_target_type_set.static_type.put_procedure_call (l_dynamic_call)
2404 propagate_qualified_call_target_dynamic_types (l_dynamic_call)
2405 end
2406 end
2407 end
2408
2409 report_typed_pointer_expression (an_expression: ET_ADDRESS_EXPRESSION; a_type: ET_TYPE; a_context: ET_TYPE_CONTEXT)
2410 -- Report that a typed pointer expression of type `a_type'
2411 -- in `a_context' has been processed.
2412 local
2413 l_type: ET_DYNAMIC_TYPE
2414 do
2415 if current_type = current_dynamic_type.base_type then
2416 l_type := current_dynamic_system.dynamic_type (a_type, a_context)
2417 mark_type_alive (l_type)
2418 set_dynamic_type_set (l_type, an_expression)
2419 end
2420 end
2421
2422 report_unqualified_call_expression (an_expression: ET_FEATURE_CALL_EXPRESSION; a_query: ET_QUERY)
2423 -- Report that an unqualified call expression has been processed.
2424 local
2425 i, nb: INTEGER
2426 l_dynamic_query: ET_DYNAMIC_FEATURE
2427 l_dynamic_type_set: detachable ET_DYNAMIC_TYPE_SET
2428 l_actuals: detachable ET_ACTUAL_ARGUMENTS
2429 l_actual: ET_EXPRESSION
2430 l_open_operand_type_sets: ET_DYNAMIC_TYPE_SET_LIST
2431 l_open_operand_type_set: ET_DYNAMIC_TYPE_SET
2432 l_actual_type_set: detachable ET_DYNAMIC_TYPE_SET
2433 l_result_type_set: detachable ET_DYNAMIC_TYPE_SET
2434 do
2435 if current_type = current_dynamic_type.base_type then
2436 l_dynamic_query := current_dynamic_type.dynamic_query (a_query, current_dynamic_system)
2437 l_dynamic_query.set_regular (True)
2438 l_actuals := an_expression.arguments
2439 if l_actuals /= Void then
2440 nb := l_actuals.count
2441 if nb = 1 then
2442 l_actual := l_actuals.actual_argument (1)
2443 if l_dynamic_query.is_builtin_function_item and then current_dynamic_type.is_agent_type then
2444 -- This is something of the form: 'item ([...])'
2445 -- Try to get the open operand type sets directly from the
2446 -- argument if it is a manifest tuple.
2447 if not attached {ET_DYNAMIC_ROUTINE_TYPE} current_dynamic_type as l_agent_type then
2448 -- Internal error: it has to be an agent type.
2449 set_fatal_error
2450 error_handler.report_giaaa_error
2451 else
2452 if attached {ET_MANIFEST_TUPLE} l_actual as l_manifest_tuple then
2453 l_open_operand_type_sets := l_agent_type.open_operand_type_sets
2454 nb := l_open_operand_type_sets.count
2455 if l_manifest_tuple.count < nb then
2456 -- Internal error: the actual argument conforms to the
2457 -- formal argument of 'item', so there cannot be less
2458 -- items in the tuple.
2459 set_fatal_error
2460 error_handler.report_giaaa_error
2461 else
2462 from i := 1 until i > nb loop
2463 l_actual := l_manifest_tuple.expression (i)
2464 l_open_operand_type_set := l_open_operand_type_sets.item (i)
2465 propagate_argument_dynamic_types (l_actual, l_open_operand_type_set)
2466 i := i + 1
2467 end
2468 end
2469 else
2470 propagate_argument_operand_dynamic_types (l_actual, 1, l_dynamic_query)
2471 end
2472 end
2473 else
2474 propagate_argument_operand_dynamic_types (l_actual, 1, l_dynamic_query)
2475 end
2476 else
2477 from i := 1 until i > nb loop
2478 l_actual := l_actuals.actual_argument (i)
2479 propagate_argument_operand_dynamic_types (l_actual, i, l_dynamic_query)
2480 i := i + 1
2481 end
2482 end
2483 end
2484 l_result_type_set := l_dynamic_query.result_type_set
2485 l_dynamic_type_set := l_result_type_set
2486 -- TODO: like argument (the following is just a workaround
2487 -- which works only in a limited number of cases, in particular
2488 -- for ANY.clone).
2489 if attached {ET_LIKE_FEATURE} a_query.type as l_like and then l_like.is_like_argument then
2490 if l_actuals /= Void and then l_actuals.count = 1 then
2491 l_actual_type_set := dynamic_type_set (l_actuals.actual_argument (1))
2492 if l_actual_type_set = Void then
2493 -- Internal error: the dynamic type sets of the
2494 -- arguments should be known at this stage.
2495 set_fatal_error
2496 error_handler.report_giaaa_error
2497 else
2498 l_dynamic_type_set := new_dynamic_type_set (l_actual_type_set.static_type)
2499 if l_result_type_set /= Void then
2500 propagate_like_argument_dynamic_types (an_expression, l_result_type_set, l_dynamic_type_set)
2501 end
2502 end
2503 end
2504 end
2505 if l_dynamic_type_set = Void then
2506 -- Internal error: the result type set of a query cannot be void.
2507 set_fatal_error
2508 error_handler.report_giaaa_error
2509 else
2510 set_dynamic_type_set (l_dynamic_type_set, an_expression)
2511 end
2512 end
2513 end
2514
2515 report_unqualified_call_instruction (an_instruction: ET_FEATURE_CALL_INSTRUCTION; a_procedure: ET_PROCEDURE)
2516 -- Report that an unqualified call instruction has been processed.
2517 local
2518 i, nb: INTEGER
2519 l_dynamic_procedure: ET_DYNAMIC_FEATURE
2520 l_actual: ET_EXPRESSION
2521 l_open_operand_type_sets: ET_DYNAMIC_TYPE_SET_LIST
2522 l_open_operand_type_set: ET_DYNAMIC_TYPE_SET
2523 do
2524 if current_type = current_dynamic_type.base_type then
2525 l_dynamic_procedure := current_dynamic_type.dynamic_procedure (a_procedure, current_dynamic_system)
2526 l_dynamic_procedure.set_regular (True)
2527 if attached an_instruction.arguments as l_actuals then
2528 nb := l_actuals.count
2529 if nb = 1 then
2530 l_actual := l_actuals.actual_argument (1)
2531 if l_dynamic_procedure.is_builtin_routine_call and then current_dynamic_type.is_agent_type then
2532 -- This is something of the form: 'call ([...])'
2533 -- Try to get the open operand type sets directly from the
2534 -- argument if it is a manifest tuple.
2535 if not attached {ET_DYNAMIC_ROUTINE_TYPE} current_dynamic_type as l_agent_type then
2536 -- Internal error: it has to be an agent type.
2537 set_fatal_error
2538 error_handler.report_giaaa_error
2539 else
2540 if attached {ET_MANIFEST_TUPLE} l_actual as l_manifest_tuple then
2541 l_open_operand_type_sets := l_agent_type.open_operand_type_sets
2542 nb := l_open_operand_type_sets.count
2543 if l_manifest_tuple.count < nb then
2544 -- Internal error: the actual argument conforms to the
2545 -- formal argument of 'call', so there cannot be less
2546 -- items in the tuple.
2547 set_fatal_error
2548 error_handler.report_giaaa_error
2549 else
2550 from i := 1 until i > nb loop
2551 l_actual := l_manifest_tuple.expression (i)
2552 l_open_operand_type_set := l_open_operand_type_sets.item (i)
2553 propagate_argument_dynamic_types (l_actual, l_open_operand_type_set)
2554 i := i + 1
2555 end
2556 end
2557 else
2558 propagate_argument_operand_dynamic_types (l_actual, 1, l_dynamic_procedure)
2559 end
2560 end
2561 else
2562 propagate_argument_operand_dynamic_types (l_actual, 1, l_dynamic_procedure)
2563 end
2564 else
2565 from i := 1 until i > nb loop
2566 l_actual := l_actuals.actual_argument (i)
2567 propagate_argument_operand_dynamic_types (l_actual, i, l_dynamic_procedure)
2568 i := i + 1
2569 end
2570 end
2571 end
2572 end
2573 end
2574
2575 report_unqualified_procedure_call_agent (an_expression: ET_CALL_AGENT; a_procedure: ET_PROCEDURE; a_type: ET_TYPE; a_context: ET_TYPE_CONTEXT)
2576 -- Report that an unqualified procedure call (to `a_procedure') agent
2577 -- of type `a_type' in `a_context' has been processed.
2578 local
2579 l_dynamic_feature: ET_DYNAMIC_FEATURE
2580 do
2581 if current_type = current_dynamic_type.base_type then
2582 l_dynamic_feature := current_dynamic_type.dynamic_procedure (a_procedure, current_dynamic_system)
2583 report_unqualified_call_agent (an_expression, l_dynamic_feature, a_type, a_context)
2584 end
2585 end
2586
2587 report_unqualified_query_call_agent (an_expression: ET_CALL_AGENT; a_query: ET_QUERY; a_type: ET_TYPE; a_context: ET_TYPE_CONTEXT)
2588 -- Report that an unqualified query call (to `a_query') agent
2589 -- of type `a_type' in `a_context' has been processed.
2590 local
2591 l_dynamic_feature: ET_DYNAMIC_FEATURE
2592 do
2593 if current_type = current_dynamic_type.base_type then
2594 l_dynamic_feature := current_dynamic_type.dynamic_query (a_query, current_dynamic_system)
2595 if not attached l_dynamic_feature.result_type_set as l_result_type_set then
2596 -- Internal error: a query should have a result type set.
2597 set_fatal_error
2598 error_handler.report_giaaa_error
2599 elseif not attached an_expression.implicit_result as l_implicit_result then
2600 -- Internal error: a query call agent should have an implicit result.
2601 -- See precondition 'query_call' and the postcondition of ET_CALL_AGENT.is_procedure.
2602 set_fatal_error
2603 error_handler.report_giaaa_error
2604 else
2605 set_dynamic_type_set (l_result_type_set, l_implicit_result)
2606 report_unqualified_call_agent (an_expression, l_dynamic_feature, a_type, a_context)
2607 end
2608 end
2609 end
2610
2611 report_unqualified_call_agent (an_expression: ET_CALL_AGENT; a_feature: ET_DYNAMIC_FEATURE; a_type: ET_TYPE; a_context: ET_TYPE_CONTEXT)
2612 -- Report that an unqualified call (to `a_feature') agent
2613 -- of type `a_type' in `a_context' has been processed.
2614 require
2615 no_error: not has_fatal_error
2616 an_expression_not_void: an_expression /= Void
2617 unqualified_call_agent: not an_expression.is_qualified_call
2618 a_feature_not_void: a_feature /= Void
2619 a_type_not_void: a_type /= Void
2620 a_context_not_void: a_context /= Void
2621 a_context_valid: a_context.is_valid_context
2622 local
2623 l_dynamic_type: ET_DYNAMIC_TYPE
2624 l_open_operand_type_sets: ET_DYNAMIC_TYPE_SET_LIST
2625 l_open_operand_type_set: ET_DYNAMIC_TYPE_SET
2626 l_result_type_set: detachable ET_DYNAMIC_TYPE_SET
2627 l_actuals: detachable ET_AGENT_ARGUMENT_OPERANDS
2628 l_actual: ET_AGENT_ARGUMENT_OPERAND
2629 l_actual_expression: ET_EXPRESSION
2630 i, nb: INTEGER
2631 j, nb2: INTEGER
2632 l_not_done: BOOLEAN
2633 l_target: ET_AGENT_TARGET
2634 do
2635 a_feature.set_regular (True)
2636 l_dynamic_type := current_dynamic_system.dynamic_type (a_type, a_context)
2637 mark_type_alive (l_dynamic_type)
2638 set_dynamic_type_set (l_dynamic_type, an_expression)
2639 if not attached {ET_DYNAMIC_ROUTINE_TYPE} l_dynamic_type as l_agent_type then
2640 -- Internal error: the dynamic type of an agent should be an agent type.
2641 set_fatal_error
2642 error_handler.report_giaaa_error
2643 else
2644 -- Set dynamic type set of implicit 'Current' target.
2645 l_target := an_expression.target
2646 if l_target.index = 0 and current_index.item /= 0 then
2647 l_target.set_index (current_index.item)
2648 end
2649 set_dynamic_type_set (current_dynamic_type, l_target)
2650 if current_index.item = 0 then
2651 current_index.put (l_target.index)
2652 end
2653 -- Dynamic type set of 'Result'.
2654 l_result_type_set := l_agent_type.result_type_set
2655 if l_result_type_set /= Void then
2656 propagate_call_agent_result_dynamic_types (an_expression, a_feature, l_result_type_set)
2657 end
2658 -- Set dynamic type sets of open operands.
2659 l_actuals := an_expression.arguments
2660 if l_actuals /= Void then
2661 nb := l_actuals.count
2662 if nb = 1 and then (a_feature.is_builtin_routine_call or a_feature.is_builtin_function_item) and then current_dynamic_type.is_agent_type then
2663 -- This is something of the form: 'agent call ([...])' or 'agent item ([...])'
2664 -- Try to get the open operand type sets directly from the
2665 -- argument if it is a manifest tuple.
2666 if not attached {ET_DYNAMIC_ROUTINE_TYPE} current_dynamic_type as l_routine_type then
2667 -- Internal error: it has to be an agent type.
2668 set_fatal_error
2669 error_handler.report_giaaa_error
2670 else
2671 l_actual := l_actuals.actual_argument (1)
2672 if attached {ET_MANIFEST_TUPLE} l_actual as l_manifest_tuple then
2673 l_open_operand_type_sets := l_routine_type.open_operand_type_sets
2674 nb := l_open_operand_type_sets.count
2675 if l_manifest_tuple.count < nb then
2676 -- Internal error: the actual argument conforms to the
2677 -- formal argument of 'call' or 'item', so there cannot
2678 -- be less items in the tuple.
2679 set_fatal_error
2680 error_handler.report_giaaa_error
2681 else
2682 from i := 1 until i > nb loop
2683 l_actual_expression := l_manifest_tuple.expression (i)
2684 l_open_operand_type_set := l_open_operand_type_sets.item (i)
2685 propagate_argument_dynamic_types (l_actual_expression, l_open_operand_type_set)
2686 i := i + 1
2687 end
2688 end
2689 else
2690 l_not_done := True
2691 end
2692 end
2693 else
2694 l_not_done := True
2695 end
2696 if l_not_done then
2697 l_open_operand_type_sets := l_agent_type.open_operand_type_sets
2698 nb2 := l_open_operand_type_sets.count
2699 from i := 1 until i > nb loop
2700 l_actual := l_actuals.actual_argument (i)
2701 if attached {ET_EXPRESSION} l_actual as l_actual_expression2 then
2702 propagate_argument_operand_dynamic_types (l_actual_expression2, i, a_feature)
2703 else
2704 -- Open operand.
2705 j := j + 1
2706 if j > nb2 then
2707 -- Internal error: missing open operands.
2708 set_fatal_error
2709 error_handler.report_giaaa_error
2710 else
2711 l_open_operand_type_set := l_open_operand_type_sets.item (j)
2712 set_dynamic_type_set (l_open_operand_type_set, l_actual)
2713 propagate_argument_operand_dynamic_types (l_actual, i, a_feature)
2714 end
2715 end
2716 i := i + 1
2717 end
2718 if j < nb2 then
2719 -- Internal error: too many open operands.
2720 set_fatal_error
2721 error_handler.report_giaaa_error
2722 end
2723 end
2724 end
2725 propagate_agent_closed_operands_dynamic_types (an_expression, l_agent_type)
2726 end
2727 end
2728
2729 report_void_constant (an_expression: ET_VOID)
2730 -- Report that a Void has been processed.
2731 local
2732 l_type: ET_DYNAMIC_TYPE
2733 do
2734 if current_type = current_dynamic_type.base_type then
2735 l_type := current_dynamic_system.none_type
2736 if an_expression.index = 0 and none_index.item /= 0 then
2737 an_expression.set_index (none_index.item)
2738 end
2739 set_dynamic_type_set (l_type, an_expression)
2740 if none_index.item = 0 then
2741 none_index.put (an_expression.index)
2742 end
2743 end
2744 end
2745
2746 feature {NONE} -- Built-in features
2747
2748 report_builtin_function (a_feature: ET_EXTERNAL_FUNCTION)
2749 -- Report that a built-in function that returns an object of the same
2750 -- type as its declared type is being analyzed.
2751 require
2752 no_error: not has_fatal_error
2753 a_feature_not_void: a_feature /= Void
2754 local
2755 l_result_type: ET_DYNAMIC_TYPE
2756 l_base_type: ET_BASE_TYPE
2757 do
2758 if current_type = current_dynamic_type.base_type then
2759 l_result_type := result_type_set.static_type
2760 l_base_type := l_result_type.base_type
2761 if current_universe_impl.string_8_type.same_named_type_with_type_marks (l_base_type, tokens.implicit_attached_type_mark, current_type, tokens.implicit_attached_type_mark, current_type) then
2762 mark_string_type_alive (l_result_type)
2763 elseif current_universe_impl.string_32_type.same_named_type_with_type_marks (l_base_type, tokens.implicit_attached_type_mark, current_type, tokens.implicit_attached_type_mark, current_type) then
2764 mark_string_type_alive (l_result_type)
2765 else
2766 mark_type_alive (l_result_type)
2767 end
2768 propagate_builtin_result_dynamic_types (l_result_type, current_dynamic_feature)
2769 end
2770 end
2771
2772 report_builtin_procedure (a_feature: ET_EXTERNAL_PROCEDURE)
2773 -- Report that a built-in procedure is being analyzed.
2774 require
2775 no_error: not has_fatal_error
2776 a_feature_not_void: a_feature /= Void
2777 do
2778 -- Do nothing.
2779 end
2780
2781 report_builtin_any_twin (a_feature: ET_EXTERNAL_FUNCTION)
2782 -- Report that built-in feature 'ANY.twin' is being analyzed.
2783 require
2784 no_error: not has_fatal_error
2785 a_feature_not_void: a_feature /= Void
2786 local
2787 l_copy_feature: detachable ET_DYNAMIC_FEATURE
2788 do
2789 if current_type = current_dynamic_type.base_type then
2790 propagate_builtin_result_dynamic_types (current_dynamic_type, current_dynamic_feature)
2791 -- Feature `copy' is called internally.
2792 l_copy_feature := current_dynamic_type.seeded_dynamic_procedure (current_system.copy_seed, current_dynamic_system)
2793 if l_copy_feature = Void then
2794 -- Internal error: all classes should have a feature
2795 -- 'copy'. Otherwise we get an error when parsing
2796 -- class ANY if there is no such feature.
2797 set_fatal_error
2798 error_handler.report_giaaa_error
2799 else
2800 l_copy_feature.set_regular (True)
2801 propagate_builtin_actual_argument_dynamic_types (current_dynamic_type, 1, l_copy_feature)
2802 end
2803 end
2804 end
2805
2806 report_builtin_exception_manager_catch (a_feature: ET_EXTERNAL_PROCEDURE)
2807 -- Report that built-in feature 'EXCEPTION_MANAGER.catch' is being analyzed.
2808 require
2809 no_error: not has_fatal_error
2810 a_feature_not_void: a_feature /= Void
2811 do
2812 if current_type = current_dynamic_type.base_type then
2813 -- Feature 'ISE_EXCEPTION_MANAGER.catch' is called internally.
2814 if not attached current_dynamic_system.ise_exception_manager_type.seeded_dynamic_query (a_feature.first_seed, current_dynamic_system) as l_ise_exception_manager_feature then
2815 -- Internal error: "ISE_EXCEPTION_MANAGER" is a descendant of
2816 -- "EXCEPTION_MANAGER". So it should have a feature with the
2817 -- same seed as `a_feature'. Otherwise we get an error when
2818 -- flattening the features of "ISE_EXCEPTION_MANAGER".
2819 set_fatal_error
2820 error_handler.report_giaaa_error
2821 else
2822 l_ise_exception_manager_feature.set_regular (True)
2823 propagate_builtin_actual_argument_dynamic_types (argument_type_set (1), 1, l_ise_exception_manager_feature)
2824 end
2825 end
2826 end
2827
2828 report_builtin_exception_manager_exception_from_code (a_feature: ET_EXTERNAL_FUNCTION)
2829 -- Report that built-in feature 'EXCEPTION_MANAGER.exception_from_code' is being analyzed.
2830 require
2831 no_error: not has_fatal_error
2832 a_feature_not_void: a_feature /= Void
2833 do
2834 if current_type = current_dynamic_type.base_type then
2835 -- Feature 'ISE_EXCEPTION_MANAGER.exception_from_code' is called internally.
2836 if not attached current_dynamic_system.ise_exception_manager_type.seeded_dynamic_query (a_feature.first_seed, current_dynamic_system) as l_ise_exception_manager_feature then
2837 -- Internal error: "ISE_EXCEPTION_MANAGER" is a descendant of
2838 -- "EXCEPTION_MANAGER". So it should have a feature with the
2839 -- same seed as `a_feature'. Otherwise we get an error when
2840 -- flattening the features of "ISE_EXCEPTION_MANAGER".
2841 set_fatal_error
2842 error_handler.report_giaaa_error
2843 elseif not attached l_ise_exception_manager_feature.result_type_set as l_result_type_set then
2844 -- Internal error: 'ISE_EXCEPTION_MANAGER.exception_from_code' is a redefinition
2845 -- of 'EXCEPTION_MANAGER.exception_from_code'. So it should be a query.
2846 -- Otherwise we get an error when flattening the features of "ISE_EXCEPTION_MANAGER".
2847 set_fatal_error
2848 error_handler.report_giaaa_error
2849 else
2850 l_ise_exception_manager_feature.set_regular (True)
2851 propagate_builtin_actual_argument_dynamic_types (argument_type_set (1), 1, l_ise_exception_manager_feature)
2852 propagate_builtin_result_dynamic_types (l_result_type_set, current_dynamic_feature)
2853 end
2854 end
2855 end
2856
2857 report_builtin_exception_manager_ignore (a_feature: ET_EXTERNAL_PROCEDURE)
2858 -- Report that built-in feature 'EXCEPTION_MANAGER.ignore' is being analyzed.
2859 require
2860 no_error: not has_fatal_error
2861 a_feature_not_void: a_feature /= Void
2862 do
2863 if current_type = current_dynamic_type.base_type then
2864 -- Feature 'ISE_EXCEPTION_MANAGER.ignore' is called internally.
2865 if not attached current_dynamic_system.ise_exception_manager_type.seeded_dynamic_query (a_feature.first_seed, current_dynamic_system) as l_ise_exception_manager_feature then
2866 -- Internal error: "ISE_EXCEPTION_MANAGER" is a descendant of
2867 -- "EXCEPTION_MANAGER". So it should have a feature with the
2868 -- same seed as `a_feature'. Otherwise we get an error when
2869 -- flattening the features of "ISE_EXCEPTION_MANAGER".
2870 set_fatal_error
2871 error_handler.report_giaaa_error
2872 else
2873 l_ise_exception_manager_feature.set_regular (True)
2874 propagate_builtin_actual_argument_dynamic_types (argument_type_set (1), 1, l_ise_exception_manager_feature)
2875 end
2876 end
2877 end
2878
2879 report_builtin_exception_manager_is_caught (a_feature: ET_EXTERNAL_FUNCTION)
2880 -- Report that built-in feature 'EXCEPTION_MANAGER.is_caught' is being analyzed.
2881 require
2882 no_error: not has_fatal_error
2883 a_feature_not_void: a_feature /= Void
2884 do
2885 if current_type = current_dynamic_type.base_type then
2886 -- Feature 'ISE_EXCEPTION_MANAGER.is_caught' is called internally.
2887 if not attached current_dynamic_system.ise_exception_manager_type.seeded_dynamic_query (a_feature.first_seed, current_dynamic_system) as l_ise_exception_manager_feature then
2888 -- Internal error: "ISE_EXCEPTION_MANAGER" is a descendant of
2889 -- "EXCEPTION_MANAGER". So it should have a feature with the
2890 -- same seed as `a_feature'. Otherwise we get an error when
2891 -- flattening the features of "ISE_EXCEPTION_MANAGER".
2892 set_fatal_error
2893 error_handler.report_giaaa_error
2894 elseif not attached l_ise_exception_manager_feature.result_type_set as l_result_type_set then
2895 -- Internal error: 'ISE_EXCEPTION_MANAGER.is_caught' is a redefinition
2896 -- of 'EXCEPTION_MANAGER.is_caught'. So it should be a query.
2897 -- Otherwise we get an error when flattening the features of "ISE_EXCEPTION_MANAGER".
2898 set_fatal_error
2899 error_handler.report_giaaa_error
2900 else
2901 l_ise_exception_manager_feature.set_regular (True)
2902 propagate_builtin_actual_argument_dynamic_types (argument_type_set (1), 1, l_ise_exception_manager_feature)
2903 propagate_builtin_result_dynamic_types (l_result_type_set, current_dynamic_feature)
2904 end
2905 end
2906 end
2907
2908 report_builtin_exception_manager_is_ignorable (a_feature: ET_EXTERNAL_FUNCTION)
2909 -- Report that built-in feature 'EXCEPTION_MANAGER.is_ignorable' is being analyzed.
2910 require
2911 no_error: not has_fatal_error
2912 a_feature_not_void: a_feature /= Void
2913 do
2914 if current_type = current_dynamic_type.base_type then
2915 -- Feature 'ISE_EXCEPTION_MANAGER.is_ignorable' is called internally.
2916 if not attached current_dynamic_system.ise_exception_manager_type.seeded_dynamic_query (a_feature.first_seed, current_dynamic_system) as l_ise_exception_manager_feature then
2917 -- Internal error: "ISE_EXCEPTION_MANAGER" is a descendant of
2918 -- "EXCEPTION_MANAGER". So it should have a feature with the
2919 -- same seed as `a_feature'. Otherwise we get an error when
2920 -- flattening the features of "ISE_EXCEPTION_MANAGER".
2921 set_fatal_error
2922 error_handler.report_giaaa_error
2923 elseif not attached l_ise_exception_manager_feature.result_type_set as l_result_type_set then
2924 -- Internal error: 'ISE_EXCEPTION_MANAGER.is_ignorable' is a redefinition
2925 -- of 'EXCEPTION_MANAGER.is_ignorable'. So it should be a query.
2926 -- Otherwise we get an error when flattening the features of "ISE_EXCEPTION_MANAGER".
2927 set_fatal_error
2928 error_handler.report_giaaa_error
2929 else
2930 l_ise_exception_manager_feature.set_regular (True)
2931 propagate_builtin_actual_argument_dynamic_types (argument_type_set (1), 1, l_ise_exception_manager_feature)
2932 propagate_builtin_result_dynamic_types (l_result_type_set, current_dynamic_feature)
2933 end
2934 end
2935 end
2936
2937 report_builtin_exception_manager_is_ignored (a_feature: ET_EXTERNAL_FUNCTION)
2938 -- Report that built-in feature 'EXCEPTION_MANAGER.is_ignored' is being analyzed.
2939 require
2940 no_error: not has_fatal_error
2941 a_feature_not_void: a_feature /= Void
2942 do
2943 if current_type = current_dynamic_type.base_type then
2944 -- Feature 'ISE_EXCEPTION_MANAGER.is_ignored' is called internally.
2945 if not attached current_dynamic_system.ise_exception_manager_type.seeded_dynamic_query (a_feature.first_seed, current_dynamic_system) as l_ise_exception_manager_feature then
2946 -- Internal error: "ISE_EXCEPTION_MANAGER" is a descendant of
2947 -- "EXCEPTION_MANAGER". So it should have a feature with the
2948 -- same seed as `a_feature'. Otherwise we get an error when
2949 -- flattening the features of "ISE_EXCEPTION_MANAGER".
2950 set_fatal_error
2951 error_handler.report_giaaa_error
2952 elseif not attached l_ise_exception_manager_feature.result_type_set as l_result_type_set then
2953 -- Internal error: 'ISE_EXCEPTION_MANAGER.is_ignored' is a redefinition
2954 -- of 'EXCEPTION_MANAGER.is_ignored'. So it should be a query.
2955 -- Otherwise we get an error when flattening the features of "ISE_EXCEPTION_MANAGER".
2956 set_fatal_error
2957 error_handler.report_giaaa_error
2958 else
2959 l_ise_exception_manager_feature.set_regular (True)
2960 propagate_builtin_actual_argument_dynamic_types (argument_type_set (1), 1, l_ise_exception_manager_feature)
2961 propagate_builtin_result_dynamic_types (l_result_type_set, current_dynamic_feature)
2962 end
2963 end
2964 end
2965
2966 report_builtin_exception_manager_is_raisable (a_feature: ET_EXTERNAL_FUNCTION)
2967 -- Report that built-in feature 'EXCEPTION_MANAGER.is_raisable' is being analyzed.
2968 require
2969 no_error: not has_fatal_error
2970 a_feature_not_void: a_feature /= Void
2971 do
2972 if current_type = current_dynamic_type.base_type then
2973 -- Feature 'ISE_EXCEPTION_MANAGER.is_raisable' is called internally.
2974 if not attached current_dynamic_system.ise_exception_manager_type.seeded_dynamic_query (a_feature.first_seed, current_dynamic_system) as l_ise_exception_manager_feature then
2975 -- Internal error: "ISE_EXCEPTION_MANAGER" is a descendant of
2976 -- "EXCEPTION_MANAGER". So it should have a feature with the
2977 -- same seed as `a_feature'. Otherwise we get an error when
2978 -- flattening the features of "ISE_EXCEPTION_MANAGER".
2979 set_fatal_error
2980 error_handler.report_giaaa_error
2981 elseif not attached l_ise_exception_manager_feature.result_type_set as l_result_type_set then
2982 -- Internal error: 'ISE_EXCEPTION_MANAGER.is_raisable' is a redefinition
2983 -- of 'EXCEPTION_MANAGER.is_raisable'. So it should be a query.
2984 -- Otherwise we get an error when flattening the features of "ISE_EXCEPTION_MANAGER".
2985 set_fatal_error
2986 error_handler.report_giaaa_error
2987 else
2988 l_ise_exception_manager_feature.set_regular (True)
2989 propagate_builtin_actual_argument_dynamic_types (argument_type_set (1), 1, l_ise_exception_manager_feature)
2990 propagate_builtin_result_dynamic_types (l_result_type_set, current_dynamic_feature)
2991 end
2992 end
2993 end
2994
2995 report_builtin_exception_manager_last_exception (a_feature: ET_EXTERNAL_FUNCTION)
2996 -- Report that built-in feature 'EXCEPTION_MANAGER.last_exception' is being analyzed.
2997 require
2998 no_error: not has_fatal_error
2999 a_feature_not_void: a_feature /= Void
3000 do
3001 if current_type = current_dynamic_type.base_type then
3002 -- Feature 'ISE_EXCEPTION_MANAGER.last_exception' is called internally.
3003 if not attached current_dynamic_system.ise_exception_manager_type.seeded_dynamic_query (a_feature.first_seed, current_dynamic_system) as l_ise_exception_manager_feature then
3004 -- Internal error: "ISE_EXCEPTION_MANAGER" is a descendant of
3005 -- "EXCEPTION_MANAGER". So it should have a feature with the
3006 -- same seed as `a_feature'. Otherwise we get an error when
3007 -- flattening the features of "ISE_EXCEPTION_MANAGER".
3008 set_fatal_error
3009 error_handler.report_giaaa_error
3010 elseif not attached l_ise_exception_manager_feature.result_type_set as l_result_type_set then
3011 -- Internal error: 'ISE_EXCEPTION_MANAGER.last_exception' is a redefinition
3012 -- of 'EXCEPTION_MANAGER.last_exception'. So it should be a query.
3013 -- Otherwise we get an error when flattening the features of "ISE_EXCEPTION_MANAGER".
3014 set_fatal_error
3015 error_handler.report_giaaa_error
3016 else
3017 l_ise_exception_manager_feature.set_regular (True)
3018 propagate_builtin_result_dynamic_types (l_result_type_set, current_dynamic_feature)
3019 end
3020 end
3021 end
3022
3023 report_builtin_exception_manager_raise (a_feature: ET_EXTERNAL_PROCEDURE)
3024 -- Report that built-in feature 'EXCEPTION_MANAGER.raise' is being analyzed.
3025 require
3026 no_error: not has_fatal_error
3027 a_feature_not_void: a_feature /= Void
3028 do
3029 if current_type = current_dynamic_type.base_type then
3030 -- Feature 'ISE_EXCEPTION_MANAGER.raise' is called internally.
3031 if not attached current_dynamic_system.ise_exception_manager_type.seeded_dynamic_query (a_feature.first_seed, current_dynamic_system) as l_ise_exception_manager_feature then
3032 -- Internal error: "ISE_EXCEPTION_MANAGER" is a descendant of
3033 -- "EXCEPTION_MANAGER". So it should have a feature with the
3034 -- same seed as `a_feature'. Otherwise we get an error when
3035 -- flattening the features of "ISE_EXCEPTION_MANAGER".
3036 set_fatal_error
3037 error_handler.report_giaaa_error
3038 else
3039 l_ise_exception_manager_feature.set_regular (True)
3040 propagate_builtin_actual_argument_dynamic_types (argument_type_set (1), 1, l_ise_exception_manager_feature)
3041 end
3042 end
3043 end
3044
3045 report_builtin_exception_manager_set_is_ignored (a_feature: ET_EXTERNAL_PROCEDURE)
3046 -- Report that built-in feature 'EXCEPTION_MANAGER.set_is_ignored' is being analyzed.
3047 require
3048 no_error: not has_fatal_error
3049 a_feature_not_void: a_feature /= Void
3050 do
3051 if current_type = current_dynamic_type.base_type then
3052 -- Feature 'ISE_EXCEPTION_MANAGER.set_is_ignored' is called internally.
3053 if not attached current_dynamic_system.ise_exception_manager_type.seeded_dynamic_query (a_feature.first_seed, current_dynamic_system) as l_ise_exception_manager_feature then
3054 -- Internal error: "ISE_EXCEPTION_MANAGER" is a descendant of
3055 -- "EXCEPTION_MANAGER". So it should have a feature with the
3056 -- same seed as `a_feature'. Otherwise we get an error when
3057 -- flattening the features of "ISE_EXCEPTION_MANAGER".
3058 set_fatal_error
3059 error_handler.report_giaaa_error
3060 else
3061 l_ise_exception_manager_feature.set_regular (True)
3062 propagate_builtin_actual_argument_dynamic_types (argument_type_set (1), 1, l_ise_exception_manager_feature)
3063 propagate_builtin_actual_argument_dynamic_types (argument_type_set (2), 2, l_ise_exception_manager_feature)
3064 end
3065 end
3066 end
3067
3068 report_builtin_exception_manager_type_of_code (a_feature: ET_EXTERNAL_FUNCTION)
3069 -- Report that built-in feature 'EXCEPTION_MANAGER.type_of_code' is being analyzed.
3070 require
3071 no_error: not has_fatal_error
3072 a_feature_not_void: a_feature /= Void
3073 do
3074 if current_type = current_dynamic_type.base_type then
3075 -- Feature 'ISE_EXCEPTION_MANAGER.type_of_code' is called internally.
3076 if not attached current_dynamic_system.ise_exception_manager_type.seeded_dynamic_query (a_feature.first_seed, current_dynamic_system) as l_ise_exception_manager_feature then
3077 -- Internal error: "ISE_EXCEPTION_MANAGER" is a descendant of
3078 -- "EXCEPTION_MANAGER". So it should have a feature with the
3079 -- same seed as `a_feature'. Otherwise we get an error when
3080 -- flattening the features of "ISE_EXCEPTION_MANAGER".
3081 set_fatal_error
3082 error_handler.report_giaaa_error
3083 elseif not attached l_ise_exception_manager_feature.result_type_set as l_result_type_set then
3084 -- Internal error: 'ISE_EXCEPTION_MANAGER.type_of_code' is a redefinition
3085 -- of 'EXCEPTION_MANAGER.type_of_code'. So it should be a query.
3086 -- Otherwise we get an error when flattening the features of "ISE_EXCEPTION_MANAGER".
3087 set_fatal_error
3088 error_handler.report_giaaa_error
3089 else
3090 l_ise_exception_manager_feature.set_regular (True)
3091 propagate_builtin_actual_argument_dynamic_types (argument_type_set (1), 1, l_ise_exception_manager_feature)
3092 propagate_builtin_result_dynamic_types (l_result_type_set, current_dynamic_feature)
3093 end
3094 end
3095 end
3096
3097 report_builtin_exception_manager_factory_exception_manager (a_feature: ET_EXTERNAL_FUNCTION)
3098 -- Report that built-in feature 'EXCEPTION_MANAGER_FACTORY.exception_manager' is being analyzed.
3099 require
3100 no_error: not has_fatal_error
3101 a_feature_not_void: a_feature /= Void
3102 local
3103 l_result_type: ET_DYNAMIC_TYPE
3104 do
3105 if current_type = current_dynamic_type.base_type then
3106 l_result_type := current_dynamic_system.ise_exception_manager_type
3107 mark_type_alive (l_result_type)
3108 propagate_builtin_result_dynamic_types (l_result_type, current_dynamic_feature)
3109 end
3110 end
3111
3112 report_builtin_function_item (a_feature: ET_EXTERNAL_FUNCTION)
3113 -- Report that built-in feature 'FUNCTION.item' is being analyzed.
3114 require
3115 no_error: not has_fatal_error
3116 a_feature_not_void: a_feature /= Void
3117 local
3118 l_result_type_set: detachable ET_DYNAMIC_TYPE_SET
3119 l_result_type: ET_DYNAMIC_TYPE
3120 do
3121 if current_type = current_dynamic_type.base_type then
3122 l_result_type_set := current_dynamic_feature.result_type_set
3123 if l_result_type_set = Void then
3124 -- Internal error: it was already checked during parsing
3125 -- that the signature should be 'item (i: OPEN_ARGS): RESULT_TYPE'.
3126 set_fatal_error
3127 error_handler.report_giaaa_error
3128 elseif l_result_type_set.is_expanded then
3129 l_result_type := l_result_type_set.static_type
3130 mark_type_alive (l_result_type)
3131 end
3132 end
3133 end
3134
3135 report_builtin_identified_eif_id_object (a_feature: ET_EXTERNAL_FUNCTION)
3136 -- Report that built-in feature 'IDENTIFIED.eif_id_object' is being analyzed.
3137 require
3138 no_error: not has_fatal_error
3139 a_feature_not_void: a_feature /= Void
3140 do
3141 -- Do nothing.
3142 end
3143
3144 report_builtin_identified_eif_object_id (a_feature: ET_EXTERNAL_FUNCTION)
3145 -- Report that built-in feature 'IDENTIFIED.eif_object_id' is being analyzed.
3146 require
3147 no_error: not has_fatal_error
3148 a_feature_not_void: a_feature /= Void
3149 do
3150 -- Do nothing.
3151 end
3152
3153 report_builtin_internal_type_of_type (a_feature: ET_EXTERNAL_FUNCTION)
3154 -- Report that built-in feature 'INTERNAL.type_of_type' is being analyzed.
3155 require
3156 no_error: not has_fatal_error
3157 a_feature_not_void: a_feature /= Void
3158 do
3159 -- Do nothing.
3160 end
3161
3162 report_builtin_special_item (a_feature: ET_EXTERNAL_FUNCTION)
3163 -- Report that built-in feature 'SPECIAL.item' is being analyzed.
3164 require
3165 no_error: not has_fatal_error
3166 a_feature_not_void: a_feature /= Void
3167 local
3168 l_result_type_set: detachable ET_DYNAMIC_TYPE_SET
3169 do
3170 if current_type = current_dynamic_type.base_type then
3171 l_result_type_set := current_dynamic_feature.result_type_set
3172 if l_result_type_set = Void then
3173 -- Internal error: it was already checked during parsing
3174 -- that the signature should be 'item (i: INTEGER): G'.
3175 set_fatal_error
3176 error_handler.report_giaaa_error
3177 elseif l_result_type_set.is_expanded then
3178 mark_type_alive (l_result_type_set.static_type)
3179 end
3180 end
3181 end
3182
3183 report_builtin_tuple_put_reference (a_feature: ET_EXTERNAL_PROCEDURE)
3184 -- Report that built-in feature 'TUPLE.put_reference' is being analyzed.
3185 require
3186 no_error: not has_fatal_error
3187 a_feature_not_void: a_feature /= Void
3188 local
3189 l_item_type_sets: ET_DYNAMIC_TYPE_SET_LIST
3190 l_item_type_set: ET_DYNAMIC_TYPE_SET
3191 i, nb: INTEGER
3192 do
3193 if current_type = current_dynamic_type.base_type then
3194 if not attached {ET_DYNAMIC_TUPLE_TYPE} current_dynamic_type as l_tuple_type then
3195 -- Internal error: this was already reported during parsing.
3196 -- This built-in feature can only be in class TUPLE (and
3197 -- its descendants).
3198 set_fatal_error
3199 error_handler.report_giaaa_error
3200 else
3201 l_item_type_sets := l_tuple_type.item_type_sets
3202 nb := l_item_type_sets.count
3203 from i := 1 until i > nb loop
3204 l_item_type_set := l_item_type_sets.item (i)
3205 if not l_item_type_set.is_expanded or else not l_item_type_set.static_type.is_basic then
3206 propagate_builtin_formal_argument_dynamic_types (1, l_item_type_set)
3207 end
3208 i := i + 1
3209 end
3210 end
3211 end
3212 end
3213
3214 report_builtin_tuple_reference_item (a_feature: ET_EXTERNAL_FUNCTION)
3215 -- Report that built-in feature 'TUPLE.reference_item' is being analyzed.
3216 require
3217 no_error: not has_fatal_error
3218 a_feature_not_void: a_feature /= Void
3219 local
3220 l_item_type_sets: ET_DYNAMIC_TYPE_SET_LIST
3221 l_item_type_set: ET_DYNAMIC_TYPE_SET
3222 i, nb: INTEGER
3223 do
3224 if current_type = current_dynamic_type.base_type then
3225 if not attached {ET_DYNAMIC_TUPLE_TYPE} current_dynamic_type as l_tuple_type then
3226 -- Internal error: this was already reported during parsing.
3227 -- This built-in feature can only be in class TUPLE (and
3228 -- its descendants).
3229 set_fatal_error
3230 error_handler.report_giaaa_error
3231 else
3232 l_item_type_sets := l_tuple_type.item_type_sets
3233 nb := l_item_type_sets.count
3234 from i := 1 until i > nb loop
3235 l_item_type_set := l_item_type_sets.item (i)
3236 if not l_item_type_set.is_expanded or else not l_item_type_set.static_type.is_basic then
3237 propagate_builtin_result_dynamic_types (l_item_type_set, current_dynamic_feature)
3238 end
3239 i := i + 1
3240 end
3241 end
3242 end
3243 end
3244
3245 report_builtin_type_default (a_feature: ET_EXTERNAL_FUNCTION)
3246 -- Report that built-in feature 'TYPE.default' is being analyzed.
3247 require
3248 no_error: not has_fatal_error
3249 a_feature_not_void: a_feature /= Void
3250 local
3251 l_result_type: ET_DYNAMIC_TYPE
3252 do
3253 if current_type = current_dynamic_type.base_type then
3254 l_result_type := result_type_set.static_type
3255 -- The Result is either expanded or Void.
3256 -- Nothing to propagate when it is Void.
3257 if l_result_type.is_expanded then
3258 mark_type_alive (l_result_type)
3259 propagate_builtin_result_dynamic_types (l_result_type, current_dynamic_feature)
3260 end
3261 end
3262 end
3263
3264 report_builtin_type_field_count (a_feature: ET_EXTERNAL_FUNCTION)
3265 -- Report that built-in feature 'TYPE.field_count' is being analyzed.
3266 require
3267 no_error: not has_fatal_error
3268 a_feature_not_void: a_feature /= Void
3269 local
3270 l_parameters: detachable ET_ACTUAL_PARAMETERS
3271 l_dynamic_type: ET_DYNAMIC_TYPE
3272 l_result_type: ET_DYNAMIC_TYPE
3273 do
3274 if current_type = current_dynamic_type.base_type then
3275 l_parameters := current_type.actual_parameters
3276 if l_parameters = Void or else l_parameters.count < 1 then
3277 -- Internal error: we should have already checked by now
3278 -- that class "TYPE" has a generic parameter.
3279 set_fatal_error
3280 error_handler.report_giaaa_error
3281 else
3282 l_dynamic_type := current_dynamic_system.dynamic_type (l_parameters.type (1), current_type)
3283 l_dynamic_type.use_all_attributes (current_dynamic_system)
3284 l_result_type := result_type_set.static_type
3285 mark_type_alive (l_result_type)
3286 propagate_builtin_result_dynamic_types (l_result_type, current_dynamic_feature)
3287 end
3288 end
3289 end
3290
3291 report_builtin_type_field (a_feature: ET_EXTERNAL_FUNCTION)
3292 -- Report that built-in feature 'TYPE.field' is being analyzed.
3293 require
3294 no_error: not has_fatal_error
3295 a_feature_not_void: a_feature /= Void
3296 local
3297 l_parameters: detachable ET_ACTUAL_PARAMETERS
3298 l_dynamic_type: ET_DYNAMIC_TYPE
3299 l_result_type_set: detachable ET_DYNAMIC_TYPE_SET
3300 l_queries: ET_DYNAMIC_FEATURE_LIST
3301 i, nb: INTEGER
3302 do
3303 if current_type = current_dynamic_type.base_type then
3304 l_parameters := current_type.actual_parameters
3305 if l_parameters = Void or else l_parameters.count < 1 then
3306 -- Internal error: we should have already checked by now
3307 -- that class "TYPE" has a generic parameter.
3308 set_fatal_error
3309 error_handler.report_giaaa_error
3310 else
3311 l_dynamic_type := current_dynamic_system.dynamic_type (l_parameters.type (1), current_type)
3312 l_dynamic_type.use_all_attributes (current_dynamic_system)
3313 l_queries := l_dynamic_type.queries
3314 nb := l_dynamic_type.attribute_count
3315 from i := 1 until i > nb loop
3316 l_result_type_set := l_queries.item (i).result_type_set
3317 if l_result_type_set = Void then
3318 -- Internal error: attributes have a result type.
3319 set_fatal_error
3320 error_handler.report_giaaa_error
3321 else
3322 propagate_builtin_result_dynamic_types (l_result_type_set, current_dynamic_feature)
3323 end
3324 i := i + 1
3325 end
3326 end
3327 end
3328 end
3329
3330 report_builtin_type_field_static_type (a_feature: ET_EXTERNAL_FUNCTION)
3331 -- Report that built-in feature 'TYPE.field_static_type' is being analyzed.
3332 require
3333 no_error: not has_fatal_error
3334 a_feature_not_void: a_feature /= Void
3335 local
3336 l_parameters: detachable ET_ACTUAL_PARAMETERS
3337 l_dynamic_type: ET_DYNAMIC_TYPE
3338 l_result_type_set: detachable ET_DYNAMIC_TYPE_SET
3339 l_result_type: ET_DYNAMIC_TYPE
3340 l_meta_type: ET_DYNAMIC_TYPE
3341 l_queries: ET_DYNAMIC_FEATURE_LIST
3342 i, nb: INTEGER
3343 do
3344 if current_type = current_dynamic_type.base_type then
3345 l_parameters := current_type.actual_parameters
3346 if l_parameters = Void or else l_parameters.count < 1 then
3347 -- Internal error: we should have already checked by now
3348 -- that class "TYPE" has a generic parameter.
3349 set_fatal_error
3350 error_handler.report_giaaa_error
3351 else
3352 l_dynamic_type := current_dynamic_system.dynamic_type (l_parameters.type (1), current_type)
3353 l_dynamic_type.use_all_attributes (current_dynamic_system)
3354 l_queries := l_dynamic_type.queries
3355 nb := l_dynamic_type.attribute_count
3356 from i := 1 until i > nb loop
3357 l_result_type_set := l_queries.item (i).result_type_set
3358 if l_result_type_set = Void then
3359 -- Internal error: attributes have a result type.
3360 set_fatal_error
3361 error_handler.report_giaaa_error
3362 else
3363 l_result_type := l_result_type_set.static_type
3364 l_meta_type := current_dynamic_system.meta_type (l_result_type)
3365 mark_type_alive (l_meta_type)
3366 propagate_builtin_result_dynamic_types (l_meta_type, current_dynamic_feature)
3367 end
3368 i := i + 1
3369 end
3370 end
3371 end
3372 end
3373
3374 report_builtin_type_generic_parameter_type (a_feature: ET_EXTERNAL_FUNCTION)
3375 -- Report that built-in feature 'TYPE.generic_parameter_type' is being analyzed.
3376 require
3377 no_error: not has_fatal_error
3378 a_feature_not_void: a_feature /= Void
3379 local
3380 l_base_type: ET_BASE_TYPE
3381 l_parameters: detachable ET_ACTUAL_PARAMETERS
3382 l_type: ET_TYPE
3383 l_dynamic_type: ET_DYNAMIC_TYPE
3384 l_result_type: ET_DYNAMIC_TYPE
3385 i, nb: INTEGER
3386 do
3387 if current_type = current_dynamic_type.base_type then
3388 l_parameters := current_type.actual_parameters
3389 if l_parameters = Void or else l_parameters.count < 1 then
3390 -- Internal error: we should have already checked by now
3391 -- that class "TYPE" has a generic parameter.
3392 set_fatal_error
3393 error_handler.report_giaaa_error
3394 else
3395 l_base_type := l_parameters.type (1).shallow_base_type (current_type)
3396 l_parameters := l_base_type.actual_parameters
3397 if l_parameters /= Void then
3398 -- We should have already checked by now that the result
3399 -- type of the built-in feature TYPE.generic_parameter
3400 -- is "TYPE [ANY]".
3401 nb := l_parameters.count
3402 from i := 1 until i > nb loop
3403 l_type := l_parameters.type (i)
3404 l_dynamic_type := current_dynamic_system.dynamic_type (l_type, current_type)
3405 l_result_type := current_dynamic_system.meta_type (l_dynamic_type)
3406 mark_type_alive (l_result_type)
3407 propagate_builtin_result_dynamic_types (l_result_type, current_dynamic_feature)
3408 i := i + 1
3409 end
3410 end
3411 end
3412 end
3413 end
3414
3415 report_builtin_type_new_instance (a_feature: ET_EXTERNAL_FUNCTION)
3416 -- Report that built-in feature 'TYPE.new_instance' is being analyzed.
3417 require
3418 no_error: not has_fatal_error
3419 a_feature_not_void: a_feature /= Void
3420 local
3421 l_result_type: ET_DYNAMIC_TYPE
3422 do
3423 if current_type = current_dynamic_type.base_type then
3424 l_result_type := result_type_set.static_type
3425 if l_result_type.base_class.is_deferred or l_result_type.base_class.is_none then
3426 -- Return Void when the base class is deferred, or NONE.
3427 elseif current_dynamic_system.is_new_instance_type (l_result_type) then
3428 -- Return Void when the result type is not alive (i.e. no object of that
3429 -- type has been otherwise created in the system).
3430 if current_dynamic_system.new_instance_types /= Void then
3431 -- Mark the type as if it has been explicitly specified.
3432 mark_type_alive (l_result_type)
3433 end
3434 propagate_builtin_result_dynamic_types (l_result_type, current_dynamic_feature)
3435 end
3436 end
3437 end
3438
3439 report_builtin_type_new_special_any_instance (a_feature: ET_EXTERNAL_FUNCTION)
3440 -- Report that built-in feature 'TYPE.new_special_any_instance' is being analyzed.
3441 require
3442 no_error: not has_fatal_error
3443 a_feature_not_void: a_feature /= Void
3444 local
3445 l_parameters: detachable ET_ACTUAL_PARAMETERS
3446 l_result_type: ET_DYNAMIC_TYPE
3447 do
3448 if current_type = current_dynamic_type.base_type then
3449 l_parameters := current_type.actual_parameters
3450 if l_parameters = Void or else l_parameters.count < 1 then
3451 -- Internal error: we should have already checked by now
3452 -- that class "TYPE" has a generic parameter.
3453 set_fatal_error
3454 error_handler.report_giaaa_error
3455 else
3456 l_result_type := current_dynamic_system.dynamic_type (l_parameters.type (1), current_type)
3457 if attached {ET_DYNAMIC_SPECIAL_TYPE} l_result_type as l_special_type and then not l_special_type.item_type_set.static_type.is_expanded and then current_dynamic_system.is_new_instance_type (l_result_type) then
3458 -- Return Void when the result type is not alive (i.e. no object
3459 -- of that type has been otherwise created in the system).
3460 if current_dynamic_system.new_instance_types /= Void then
3461 -- Mark the type as if it has been explicitly specified.
3462 mark_type_alive (l_special_type)
3463 end
3464 propagate_builtin_result_dynamic_types (l_special_type, current_dynamic_feature)
3465 end
3466 end
3467 end
3468 end
3469
3470 report_builtin_type_set_reference_field (a_feature: ET_EXTERNAL_PROCEDURE)
3471 -- Report that built-in feature 'TYPE.set_reference_field' is being analyzed.
3472 require
3473 no_error: not has_fatal_error
3474 a_feature_not_void: a_feature /= Void
3475 local
3476 l_parameters: detachable ET_ACTUAL_PARAMETERS
3477 l_dynamic_type: ET_DYNAMIC_TYPE
3478 l_result_type_set: detachable ET_DYNAMIC_TYPE_SET
3479 l_queries: ET_DYNAMIC_FEATURE_LIST
3480 i, nb: INTEGER
3481 do
3482 if current_type = current_dynamic_type.base_type then
3483 l_parameters := current_type.actual_parameters
3484 if l_parameters = Void or else l_parameters.count < 1 then
3485 -- Internal error: we should have already checked by now
3486 -- that class "TYPE" has a generic parameter.
3487 set_fatal_error
3488 error_handler.report_giaaa_error
3489 else
3490 l_dynamic_type := current_dynamic_system.dynamic_type (l_parameters.type (1), current_type)
3491 l_dynamic_type.use_all_attributes (current_dynamic_system)
3492 l_queries := l_dynamic_type.queries
3493 nb := l_dynamic_type.attribute_count
3494 from i := 1 until i > nb loop
3495 l_result_type_set := l_queries.item (i).result_type_set
3496 if l_result_type_set = Void then
3497 -- Internal error: attributes have a result type.
3498 set_fatal_error
3499 error_handler.report_giaaa_error
3500 elseif not l_result_type_set.is_expanded then
3501 propagate_builtin_formal_argument_dynamic_types (3, l_result_type_set)
3502 end
3503 i := i + 1
3504 end
3505 end
3506 end
3507 end
3508
3509 feature {ET_FEATURE_CHECKER} -- Access
3510
3511 current_dynamic_type: ET_DYNAMIC_TYPE
3512 -- Target type of `current_dynamic_feature'
3513
3514 current_dynamic_feature: ET_DYNAMIC_FEATURE
3515 -- Feature whose dynamic type sets are being built
3516
3517 current_index: DS_CELL [INTEGER]
3518 -- Index of dynamic type set of "Current" in `dynamic_type_sets'
3519
3520 result_index: DS_CELL [INTEGER]
3521 -- Index of dynamic type set of "Result" in `dynamic_type_sets'
3522
3523 constant_indexes: DS_HASH_TABLE [INTEGER, ET_DYNAMIC_TYPE]
3524 -- Indexes of dynamic type set of constant expressions in `dynamic_type_sets'
3525
3526 none_index: DS_CELL [INTEGER]
3527 -- Index of dynamic type set of none expressions in `dynamic_type_sets'
3528
3529 feature {NONE} -- Feature checker
3530
3531 feature_checker: ET_FEATURE_CHECKER
3532 -- Feature checker to be used when processing preconditions
3533 -- to get the attachment scope
3534
3535 feature {NONE} -- Implementation
3536
3537 propagate_agent_closed_operands_dynamic_types (an_agent: ET_AGENT; an_agent_type: ET_DYNAMIC_ROUTINE_TYPE)
3538 -- Propagate dynamic types of closed operands of `an_agent' to the
3539 -- dynamic type set of the attribute 'closed_operands' of `an_agent_type'.
3540 require
3541 an_agent_not_void: an_agent /= Void
3542 an_agent_type_not_void: an_agent_type /= Void
3543 do
3544 -- Do nothing.
3545 end
3546
3547 propagate_argument_dynamic_types (an_actual: ET_ARGUMENT_OPERAND; a_formal_type_set: ET_DYNAMIC_TYPE_SET)
3548 -- Propagate dynamic types of actual argument `an_actual'
3549 -- to the dynamic type set `a_formal_type_set' of the
3550 -- corresponding formal argument.
3551 require
3552 an_actual_not_void: an_actual /= Void
3553 a_formal_type_set_not_void: a_formal_type_set /= Void
3554 do
3555 -- Do nothing.
3556 end
3557
3558 propagate_argument_operand_dynamic_types (an_actual: ET_ARGUMENT_OPERAND; a_formal: INTEGER; a_callee: ET_DYNAMIC_FEATURE)
3559 -- Propagate dynamic types of actual argument `an_actual'
3560 -- to the dynamic type set of the corresponding formal
3561 -- argument at index `a_formal' in `a_callee'.
3562 require
3563 an_actual_not_void: an_actual /= Void
3564 a_callee_not_void: a_callee /= Void
3565 do
3566 -- Do nothing.
3567 end
3568
3569 propagate_assignment_dynamic_types (an_assignment: ET_ASSIGNMENT)
3570 -- Propagate dynamic types of the source of `an_assignment'
3571 -- to the dynamic type set of the target of `an_assignment'.
3572 require
3573 an_assignment_not_void: an_assignment /= Void
3574 do
3575 -- Do nothing.
3576 end
3577
3578 propagate_assignment_attempt_dynamic_types (an_assignment_attempt: ET_ASSIGNMENT_ATTEMPT)
3579 -- Propagate dynamic types of the source of `an_assignment_attempt'
3580 -- to the dynamic type set of the target of `an_assignment_attempt'.
3581 require
3582 an_assignment_attempt_not_void: an_assignment_attempt /= Void
3583 do
3584 -- Do nothing.
3585 end
3586
3587 propagate_builtin_actual_argument_dynamic_types (a_source_type_set: ET_DYNAMIC_TYPE_SET; a_formal: INTEGER; a_callee: ET_DYNAMIC_FEATURE)
3588 -- Propagate dynamic types of `a_source_type_set' to the dynamic type set
3589 -- of the formal argument at index `a_formal' in `a_callee' when involved
3590 -- in built-in feature `current_dynamic_feature'.
3591 require
3592 a_source_type_set_not_void: a_source_type_set /= Void
3593 a_callee_not_void: a_callee /= Void
3594 do
3595 -- Do nothing.
3596 end
3597
3598 propagate_builtin_formal_argument_dynamic_types (a_formal: INTEGER; a_target_type_set: ET_DYNAMIC_TYPE_SET)
3599 -- Propagate dynamic types of the dynamic type set of the formal argument
3600 -- at index `a_formal' in built-in feature `current_dynamic_feature'
3601 -- to `a_target_type_set'.
3602 require
3603 a_target_type_set_not_void: a_target_type_set /= Void
3604 do
3605 -- Do nothing.
3606 end
3607
3608 propagate_builtin_result_dynamic_types (a_source_type_set: ET_DYNAMIC_TYPE_SET; a_query: ET_DYNAMIC_FEATURE)
3609 -- Propagate dynamic types of `a_source_type_set' to the dynamic type set
3610 -- of the result of the built-in feature `a_query'.
3611 require
3612 a_source_type_set_not_void: a_source_type_set /= Void
3613 a_query_not_void: a_query /= Void
3614 do
3615 -- Do nothing.
3616 end
3617
3618 propagate_call_agent_result_dynamic_types (an_agent: ET_CALL_AGENT; a_query: ET_DYNAMIC_FEATURE; a_result_type_set: ET_DYNAMIC_TYPE_SET)
3619 -- Propagate dynamic types of the result of `a_query' to the dynamic type set
3620 -- `a_result_type_set' of the result of type of `an_agent' (probably a FUNCTION
3621 -- or a PREDICATE).
3622 require
3623 an_agent_not_void: an_agent /= Void
3624 a_query_not_void: a_query /= Void
3625 a_result_type_set_not_void: a_result_type_set /= Void
3626 do
3627 -- Do nothing.
3628 end
3629
3630 propagate_creation_dynamic_type (a_creation_type: ET_DYNAMIC_TYPE; a_creation: ET_CREATION_INSTRUCTION)
3631 -- Propagate the creation type `a_creation_type' of `a_creation'
3632 -- to the dynamic type set of the target of `a_creation'.
3633 require
3634 a_creation_type_not_void: a_creation_type /= Void
3635 a_creation_not_void: a_creation /= Void
3636 do
3637 -- Do nothing.
3638 end
3639
3640 propagate_inline_agent_result_dynamic_types (an_agent: ET_INLINE_AGENT; a_result_type_set: ET_DYNAMIC_TYPE_SET)
3641 -- Propagate dynamic types of the result of the associated feature of `an_agent'
3642 -- to the dynamic type set `a_result_type_set' of the result of type of `an_agent'
3643 -- (probably a FUNCTION or a PREDICATE).
3644 require
3645 an_agent_not_void: an_agent /= Void
3646 a_result_type_set_not_void: a_result_type_set /= Void
3647 do
3648 -- Do nothing.
3649 end
3650
3651 propagate_like_argument_dynamic_types (a_call: ET_FEATURE_CALL_EXPRESSION; a_formal_type_set, an_actual_type_set: ET_DYNAMIC_TYPE_SET)
3652 -- When `a_call' is a call to a query whose type is of the form "like argument",
3653 -- propagate dynamic types `a_formal_type_set' of the result of that query
3654 -- to the dynamic type set `an_actual_type_set' of the call.
3655 -- `a_formal_type_set' has a static type which corresponds to the formal type of the argument.
3656 -- `an_actual_type_set' has a static type which corresponds to the actual type of the argument.
3657 require
3658 a_call_not_void: a_call /= Void
3659 a_formal_type_set_not_void: a_formal_type_set /= Void
3660 an_actual_type_set_not_void: an_actual_type_set /= Void
3661 do
3662 -- Do nothing.
3663 end
3664
3665 propagate_manifest_string_area_dynamic_type (a_area_type: ET_DYNAMIC_TYPE; a_area_type_set: ET_DYNAMIC_TYPE_SET; a_string: ET_MANIFEST_STRING)
3666 -- Propagate the dynamic type of the 'area' of manifest string `a_string'
3667 -- to its dynamic type set `a_area_type_set'.
3668 require
3669 a_area_type_not_void: a_area_type /= Void
3670 a_area_type_set_not_void: a_area_type_set /= Void
3671 a_string_not_void: a_string /= Void
3672 do
3673 -- Do nothing.
3674 end
3675
3676 propagate_named_object_test_dynamic_types (a_object_test: ET_NAMED_OBJECT_TEST)
3677 -- Propagate dynamic types of the expression of `a_object_test'
3678 -- to the dynamic type set of the local of `a_object_test'.
3679 require
3680 a_object_test_not_void: a_object_test /= Void
3681 do
3682 -- Do nothing.
3683 end
3684
3685 propagate_qualified_call_target_dynamic_types (a_call: ET_DYNAMIC_QUALIFIED_CALL)
3686 -- Propagate the dynamic types of the target of `a_call' to the call itself.
3687 require
3688 a_call_not_void: a_call /= Void
3689 do
3690 -- Do nothing.
3691 end
3692
3693 propagate_equality_expression_target_dynamic_types (a_equality: ET_DYNAMIC_EQUALITY_EXPRESSION)
3694 -- Propagate the dynamic types of the target of `a_equality' to the equality itself.
3695 require
3696 a_equality_not_void: a_equality /= Void
3697 do
3698 -- Do nothing.
3699 end
3700
3701 propagate_object_equality_expression_target_dynamic_types (a_equality: ET_DYNAMIC_OBJECT_EQUALITY_EXPRESSION)
3702 -- Propagate the dynamic types of the target of `a_equality' to the object-equality itself.
3703 require
3704 a_equality_not_void: a_equality /= Void
3705 do
3706 -- Do nothing.
3707 end
3708
3709 propagate_tuple_label_argument_dynamic_types (a_label_type_set: ET_DYNAMIC_TYPE_SET; a_assigner: ET_ASSIGNER_INSTRUCTION)
3710 -- Propagate dynamic types of the source of tuple label setter `a_assigner'
3711 -- to the dynamic type set `a_label_type_set' of the corresponding tuple label.
3712 require
3713 a_label_type_set_not_void: a_label_type_set /= Void
3714 a_assigner_not_void: a_assigner /= Void
3715 do
3716 -- Do nothing.
3717 end
3718
3719 propagate_tuple_label_result_dynamic_types (a_label_type_set, a_result_type_set: ET_DYNAMIC_TYPE_SET)
3720 -- Propagate dynamic types `a_label_type_set' of a tuple label
3721 -- to the dynamic type set `a_result_type_set' of the result type
3722 -- of the associated qualified call.
3723 require
3724 a_label_type_set_not_void: a_label_type_set /= Void
3725 a_result_type_set_not_void: a_result_type_set /= Void
3726 do
3727 -- Do nothing.
3728 end
3729
3730 dynamic_type_set (an_operand: ET_OPERAND): detachable ET_DYNAMIC_TYPE_SET
3731 -- Dynamic type set associated with `an_operand';
3732 -- Void if unknown yet
3733 require
3734 an_operand_not_void: an_operand /= Void
3735 local
3736 i: INTEGER
3737 do
3738 i := an_operand.index
3739 if i >= 1 and i <= dynamic_type_sets.count then
3740 Result := dynamic_type_sets.item (i)
3741 end
3742 end
3743
3744 result_type_set: ET_DYNAMIC_TYPE_SET
3745 -- Dynamic type set associated with result of feature being processed;
3746 -- Report a fatal error if not known
3747 do
3748 if attached current_dynamic_feature.result_type_set as l_result_type_set then
3749 Result := l_result_type_set
3750 else
3751 -- Internal error: dynamic type set not known.
3752 set_fatal_error
3753 error_handler.report_giaaa_error
3754 Result := current_dynamic_system.unknown_type
3755 end
3756 ensure
3757 result_type_set_not_void: Result /= Void
3758 end
3759
3760 argument_type_set (i: INTEGER): ET_DYNAMIC_TYPE_SET
3761 -- Dynamic type set associated with the `i'-th argument of feature being processed;
3762 -- Report a fatal error if not known
3763 do
3764 if attached current_dynamic_feature.argument_type_set (i) as l_argumnt_type_set then
3765 Result := l_argumnt_type_set
3766 else
3767 -- Internal error: dynamic type set not known.
3768 set_fatal_error
3769 error_handler.report_giaaa_error
3770 Result := current_dynamic_system.unknown_type
3771 end
3772 ensure
3773 argument_type_set_not_void: Result /= Void
3774 end
3775
3776 set_dynamic_type_set (a_dynamic_type_set: ET_DYNAMIC_TYPE_SET; an_operand: ET_OPERAND)
3777 -- Set dynamic type set associated with `an_operand' to `a_dynamic_type_set'.
3778 require
3779 a_dynamic_type_set_not_void: a_dynamic_type_set /= Void
3780 an_operand_not_void: an_operand /= Void
3781 local
3782 i, nb: INTEGER
3783 l_unknown: ET_DYNAMIC_TYPE
3784 do
3785 i := an_operand.index
3786 if i = 0 then
3787 dynamic_type_sets.force_last (a_dynamic_type_set)
3788 an_operand.set_index (dynamic_type_sets.count)
3789 else
3790 nb := dynamic_type_sets.count
3791 if i <= nb then
3792 dynamic_type_sets.put (a_dynamic_type_set, i)
3793 else
3794 l_unknown := current_dynamic_system.unknown_type
3795 i := i - 1
3796 from until nb >= i loop
3797 dynamic_type_sets.force_last (l_unknown)
3798 nb := nb + 1
3799 end
3800 dynamic_type_sets.force_last (a_dynamic_type_set)
3801 end
3802 end
3803 ensure
3804 dynamic_type_set_set: dynamic_type_set (an_operand) = a_dynamic_type_set
3805 end
3806
3807 dynamic_type_sets: ET_DYNAMIC_TYPE_SET_LIST
3808 -- Dynamic type sets of expressions within current feature
3809
3810 dummy_dynamic_type: ET_DYNAMIC_TYPE
3811 -- Dummy dynamic type
3812 once
3813 create Result.make (current_type, current_class)
3814 ensure
3815 dummy_dynamic_type_not_void: Result /= Void
3816 end
3817
3818 dummy_dynamic_feature: ET_DYNAMIC_FEATURE
3819 -- Dummy dynamic feature
3820 once
3821 create Result.make (dummy_feature, dummy_dynamic_type, current_dynamic_system)
3822 ensure
3823 dummy_dynamic_feature_not_void: Result /= Void
3824 end
3825
3826 invariant
3827
3828 dynamic_type_sets_not_void: dynamic_type_sets /= Void
3829 current_dynamic_type_not_void: current_dynamic_type /= Void
3830 current_dynamic_feature_not_void: current_dynamic_feature /= Void
3831 current_index_not_void: current_index /= Void
3832 result_index_not_void: result_index /= Void
3833 constant_indexes_not_void: constant_indexes /= Void
3834 none_index_not_void: none_index /= Void
3835
3836 end

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.23