Explorar el Código

* when specializing a generic also push symtables of structured owners

Sven/Sarah Barth hace 2 semanas
padre
commit
1f8a8dd160
Se han modificado 1 ficheros con 11 adiciones y 0 borrados
  1. 11 0
      compiler/pgenutil.pas

+ 11 - 0
compiler/pgenutil.pas

@@ -2777,6 +2777,7 @@ uses
       hmodule : tmodule;
       unitsyms : TFPHashObjectList;
       sym : tsym;
+      symtable : tsymtable;
       i : Integer;
       n : string;
 
@@ -2855,10 +2856,20 @@ uses
       unitsyms.free;
       if assigned(hmodule.globalsymtable) then
         symtablestack.push(hmodule.globalsymtable);
+      symtable:=genericdef.owner;
       { push the localsymtable if needed }
       if ((hmodule<>current_module) or not current_module.in_interface)
           and assigned(hmodule.localsymtable) then
         symtablestack.push(hmodule.localsymtable);
+      { also push the symtables of all owning types }
+      while assigned(symtable) and (symtable.symtabletype in [objectsymtable,recordsymtable]) do
+        begin
+          symtablestack.push(symtable);
+          if assigned(symtable.defowner) then
+            symtable:=symtable.defowner.owner
+          else
+            symtable:=nil;
+        end;
     end;
 
     procedure specialization_done(var state: tspecializationstate);