Browse Source

* if a symbol is not part of a symtable then assume it's from the current module

Sven/Sarah Barth 3 years ago
parent
commit
897f0e1784
1 changed files with 8 additions and 2 deletions
  1. 8 2
      compiler/pgenutil.pas

+ 8 - 2
compiler/pgenutil.pas

@@ -94,7 +94,10 @@ uses
         prettynamepart : ansistring;
         prettynamepart : ansistring;
         module : tmodule;
         module : tmodule;
       begin
       begin
-        module:=find_module_from_symtable(paramtype.owner);
+        if assigned(paramtype.owner) then
+          module:=find_module_from_symtable(paramtype.owner)
+        else
+          module:=current_module;
         if not assigned(module) then
         if not assigned(module) then
           internalerror(2016112802);
           internalerror(2016112802);
         namepart:='_$'+hexstr(module.moduleid,8)+'$$'+paramtype.unique_id_str;
         namepart:='_$'+hexstr(module.moduleid,8)+'$$'+paramtype.unique_id_str;
@@ -2678,7 +2681,10 @@ uses
       current_module.extendeddefs:=TFPHashObjectList.create(true);
       current_module.extendeddefs:=TFPHashObjectList.create(true);
       current_module.genericdummysyms:=tfphashobjectlist.create(true);
       current_module.genericdummysyms:=tfphashobjectlist.create(true);
       symtablestack:=tdefawaresymtablestack.create;
       symtablestack:=tdefawaresymtablestack.create;
-      hmodule:=find_module_from_symtable(genericdef.owner);
+      if not assigned(genericdef.owner) then
+        hmodule:=current_module
+      else
+        hmodule:=find_module_from_symtable(genericdef.owner);
       if hmodule=nil then
       if hmodule=nil then
         internalerror(200705152);
         internalerror(200705152);
       { collect all unit syms in the generic's unit as we need to establish
       { collect all unit syms in the generic's unit as we need to establish