@@ -556,60 +556,64 @@ object (self)
556556 | None -> None
557557 | Some (TArray (TComp _ as ty , _ , _ ) as tstructarray ) ->
558558 let cinfo = get_struct_type_compinfo ty in
559- let finfo0 = List. hd cinfo.bcfields in
560- let ftype = resolve_type finfo0.bftype in
561- (match ftype with
562- | Error _ -> None
563- | Ok ftype ->
564- let _ixftype = bcd#index_typ ftype in
565- let _ixctype = bcd#index_typ ty in
566- let _ =
567- chlog#add
568- " first field struct check"
569- (LBLOCK [
570- INT offset;
571- STR " : " ;
572- pretty_print_list
573- s#toList
574- (fun i -> STR (btype_to_string (bcd#get_typ i)))
575- " {" " ; " " }" ;
576- STR " : compinfo: " ;
577- STR cinfo.bcname;
578- STR " : first field type: " ;
579- STR (btype_to_string ftype)]) in
580- (* TBD: restore this check in a better way
581- if s#fold (fun acc i -> acc && (i = ixftype || i = ixctype)) true then
582- Some tstructarray
559+ (match cinfo.bcfields with
560+ | [] -> None
561+ | finfo0 ::_ ->
562+ let ftype = resolve_type finfo0.bftype in
563+ (match ftype with
564+ | Error _ -> None
565+ | Ok ftype ->
566+ let _ixftype = bcd#index_typ ftype in
567+ let _ixctype = bcd#index_typ ty in
568+ let _ =
569+ chlog#add
570+ " first field struct check"
571+ (LBLOCK [
572+ INT offset;
573+ STR " : " ;
574+ pretty_print_list
575+ s#toList
576+ (fun i -> STR (btype_to_string (bcd#get_typ i)))
577+ " {" " ; " " }" ;
578+ STR " : compinfo: " ;
579+ STR cinfo.bcname;
580+ STR " : first field type: " ;
581+ STR (btype_to_string ftype)]) in
582+ (* TBD: restore this check in a better way
583+ if s#fold (fun acc i -> acc && (i = ixftype || i = ixctype)) true then
584+ Some tstructarray
583585 else
584- None)*)
585- Some tstructarray)
586+ None)*)
587+ Some tstructarray) )
586588 | Some (TComp _ as ty ) ->
587589 let cinfo = get_struct_type_compinfo ty in
588- let finfo0 = List. hd cinfo.bcfields in
589- let ftype = resolve_type finfo0.bftype in
590- (match ftype with
591- | Error _ -> None
592- | Ok ftype ->
593- let ixftype = bcd#index_typ ftype in
594- let ixctype = bcd#index_typ ty in
595- let _ =
596- chlog#add
597- " first field struct check (TComp case)"
598- (LBLOCK [
599- INT offset;
600- STR " : " ;
601- pretty_print_list
602- s#toList
603- (fun i -> STR (btype_to_string (bcd#get_typ i)))
604- " {" " ; " " }" ;
605- STR " : compinfo: " ;
606- STR cinfo.bcname;
607- STR " : first field type: " ;
608- STR (btype_to_string ftype)]) in
609- if s#fold (fun acc i -> acc && (i = ixftype || i = ixctype)) true then
610- Some ftype
611- else
612- None )
590+ (match cinfo.bcfields with
591+ | [] -> None
592+ | finfo0 ::_ ->
593+ let ftype = resolve_type finfo0.bftype in
594+ (match ftype with
595+ | Error _ -> None
596+ | Ok ftype ->
597+ let ixftype = bcd#index_typ ftype in
598+ let ixctype = bcd#index_typ ty in
599+ let _ =
600+ chlog#add
601+ " first field struct check (TComp case)"
602+ (LBLOCK [
603+ INT offset;
604+ STR " : " ;
605+ pretty_print_list
606+ s#toList
607+ (fun i -> STR (btype_to_string (bcd#get_typ i)))
608+ " {" " ; " " }" ;
609+ STR " : compinfo: " ;
610+ STR cinfo.bcname;
611+ STR " : first field type: " ;
612+ STR (btype_to_string ftype)]) in
613+ if s#fold (fun acc i -> acc && (i = ixftype || i = ixctype)) true then
614+ Some ftype
615+ else
616+ None ))
613617 | _ -> None in
614618 let result = new IntCollections. set_t in
615619 begin
0 commit comments