소스 검색

* have pointerdefs and classrefdefs "inherit" the df_generic and df_specialization flags from the def they point to and set the genericdef accordingly

git-svn-id: trunk@35091 -
svenbarth 8 년 전
부모
커밋
f8c23c84b6
2개의 변경된 파일23개의 추가작업 그리고 0개의 파일을 삭제
  1. 15 0
      compiler/ptype.pas
  2. 8 0
      compiler/symdef.pas

+ 15 - 0
compiler/ptype.pas

@@ -169,6 +169,21 @@ implementation
                               srsym:=tstoreddef(tmp).typesym;
                           end;
                         tabstractpointerdef(def).pointeddef:=ttypesym(srsym).typedef;
+                        { correctly set the generic/specialization flags and the genericdef }
+                        if df_generic in tstoreddef(tabstractpointerdef(def).pointeddef).defoptions then
+                          include(tstoreddef(def).defoptions,df_generic);
+                        if df_specialization in tstoreddef(tabstractpointerdef(def).pointeddef).defoptions then
+                          begin
+                            include(tstoreddef(def).defoptions,df_specialization);
+                            case def.typ of
+                              pointerdef:
+                                tstoreddef(def).genericdef:=cpointerdef.getreusable(tstoreddef(tabstractpointerdef(def).pointeddef).genericdef);
+                              classrefdef:
+                                tstoreddef(def).genericdef:=cclassrefdef.create(tstoreddef(tabstractpointerdef(def).pointeddef).genericdef);
+                              else
+                                internalerror(2016120901);
+                            end;
+                          end;
                         { avoid wrong unused warnings web bug 801 PM }
                         inc(ttypesym(srsym).refs);
                         { we need a class type for classrefdef }

+ 8 - 0
compiler/symdef.pas

@@ -3243,6 +3243,10 @@ implementation
       begin
         inherited create(dt,true);
         pointeddef:=def;
+        if df_generic in pointeddef.defoptions then
+          include(defoptions,df_generic);
+        if df_specialization in pointeddef.defoptions then
+          include(defoptions,df_specialization);
       end;
 
 
@@ -3294,6 +3298,8 @@ implementation
       begin
         inherited create(pointerdef,def);
         has_pointer_math:=cs_pointermath in current_settings.localswitches;
+        if df_specialization in tstoreddef(def).defoptions then
+          genericdef:=cpointerdef.getreusable(tstoreddef(def).genericdef);
       end;
 
 
@@ -3421,6 +3427,8 @@ implementation
     constructor tclassrefdef.create(def:tdef);
       begin
          inherited create(classrefdef,def);
+         if df_specialization in tstoreddef(def).defoptions then
+           genericdef:=cclassrefdef.create(tstoreddef(def).genericdef);
       end;