@@ -255,9 +255,6 @@ feature -- Initialization
255255 if attached creators as l_creators then
256256 l_creators .reset
257257 end
258- if attached convert_features as l_convert_features then
259- l_convert_features .reset
260- end
261258 ensure
262259 same_name : name = old name
263260 same_id : id = old id
@@ -280,6 +277,9 @@ feature -- Initialization
280277 reset_interface_checked
281278 queries .reset_after_features_flattened
282279 procedures .reset_after_features_flattened
280+ if attached convert_features as l_convert_features then
281+ l_convert_features .reset
282+ end
283283 if attached formal_parameters as l_formal_parameters then
284284 l_formal_parameters .reset_constraint_renames
285285 l_formal_parameters .reset_constraint_creation_procedures
@@ -2482,6 +2482,60 @@ feature -- Conversion
24822482 end
24832483 end
24842484
2485+ has_convert_to_with_base_class (a_class : ET_CLASS ): BOOLEAN
2486+ -- Is there a conversion query whose convert type's base class is `a_class`?
2487+ require
2488+ a_class_not_void : a_class /= Void
2489+ local
2490+ i , nb : INTEGER
2491+ a_feature : ET_CONVERT_FEATURE
2492+ other_type : ET_TYPE
2493+ do
2494+ if attached convert_features as l_convert_features then
2495+ other_type := tokens .identity_type
2496+ nb := l_convert_features .count
2497+ from i := 1 until i > nb loop
2498+ a_feature := l_convert_features .convert_feature (i )
2499+ if a_feature .is_convert_to then
2500+ -- Do not take into account the attachment and
2501+ -- separateness status of the types involved.
2502+ if a_feature .types .has_base_class (a_class , Current ) then
2503+ Result := True
2504+ i := nb + 1 -- Jump out of the loop.
2505+ end
2506+ end
2507+ i := i + 1
2508+ end
2509+ end
2510+ end
2511+
2512+ has_convert_from_with_base_class (a_class : ET_CLASS ): BOOLEAN
2513+ -- Is there a conversion procedure whose convert type's base class is `a_class`?
2514+ require
2515+ a_class_not_void : a_class /= Void
2516+ local
2517+ i , nb : INTEGER
2518+ a_feature : ET_CONVERT_FEATURE
2519+ other_type : ET_TYPE
2520+ do
2521+ if attached convert_features as l_convert_features then
2522+ other_type := tokens .identity_type
2523+ nb := l_convert_features .count
2524+ from i := 1 until i > nb loop
2525+ a_feature := l_convert_features .convert_feature (i )
2526+ if a_feature .is_convert_from then
2527+ -- Do not take into account the attachment and
2528+ -- separateness status of the types involved.
2529+ if a_feature .types .has_base_class (a_class , Current ) then
2530+ Result := True
2531+ i := nb + 1 -- Jump out of the loop.
2532+ end
2533+ end
2534+ i := i + 1
2535+ end
2536+ end
2537+ end
2538+
24852539 convert_features : detachable ET_CONVERT_FEATURE_LIST
24862540 -- Conversion clauses
24872541
0 commit comments