فهرست منبع

Ensure that the reference to the System unit is correctly set up for packages. Among other things this is needed to compile a package with the -gl option (though debug information doesn't work yet).

pmodules.pas:
  * convert AddUnit to a function and let it return the newly loaded module
  * proc_package: when parsing the contained units ensure that we correctly set up the System unit reference if we are to contain the System unit
  * proc_package: also set up the System unit reference once all units are loaded and this hasn't happened yet (because all contained units are already compiled)

git-svn-id: branches/svenbarth/packages@29044 -
svenbarth 10 سال پیش
والد
کامیت
3710c86a1f
1فایلهای تغییر یافته به همراه15 افزوده شده و 4 حذف شده
  1. 15 4
      compiler/pmodules.pas

+ 15 - 4
compiler/pmodules.pas

@@ -35,13 +35,13 @@ implementation
        SysUtils,
        SysUtils,
        globtype,version,systems,tokens,
        globtype,version,systems,tokens,
        cutils,cfileutl,cclasses,comphook,
        cutils,cfileutl,cclasses,comphook,
-       globals,verbose,fmodule,finput,fppu,globstat,
+       globals,verbose,fmodule,finput,fppu,globstat,fpcp,fpkg,
        symconst,symbase,symtype,symdef,symsym,symtable,symcreat,
        symconst,symbase,symtype,symdef,symsym,symtable,symcreat,
        wpoinfo,
        wpoinfo,
        aasmtai,aasmdata,aasmcpu,aasmbase,
        aasmtai,aasmdata,aasmcpu,aasmbase,
        cgbase,cgobj,ngenutil,
        cgbase,cgobj,ngenutil,
        nbas,nutils,ncgutil,
        nbas,nutils,ncgutil,
-       link,assemble,import,export,gendef,entfile,ppu,comprsrc,dbgbase,fpcp,
+       link,assemble,import,export,gendef,entfile,ppu,comprsrc,dbgbase,
        cresstr,procinfo,
        cresstr,procinfo,
        pexports,
        pexports,
        objcgutl,
        objcgutl,
@@ -170,7 +170,7 @@ implementation
         CheckResourcesUsed:=found;
         CheckResourcesUsed:=found;
       end;
       end;
 
 
-    procedure AddUnit(const s:string);
+    function AddUnit(const s:string):tmodule;
       var
       var
         hp : tppumodule;
         hp : tppumodule;
         unitsym : tunitsym;
         unitsym : tunitsym;
@@ -190,6 +190,7 @@ implementation
         tabstractunitsymtable(current_module.localsymtable).insertunit(unitsym);
         tabstractunitsymtable(current_module.localsymtable).insertunit(unitsym);
         { add to used units }
         { add to used units }
         current_module.addusedunit(hp,false,unitsym);
         current_module.addusedunit(hp,false,unitsym);
+        result:=hp;
       end;
       end;
 
 
 
 
@@ -1456,7 +1457,12 @@ type
                          module_name:=module_name+'.'+orgpattern;
                          module_name:=module_name+'.'+orgpattern;
                          consume(_ID);
                          consume(_ID);
                        end;
                        end;
-                     AddUnit(module_name);
+                     hp:=AddUnit(module_name);
+                     if (hp.modulename^='SYSTEM') and not assigned(systemunit) then
+                       begin
+                         systemunit:=tglobalsymtable(hp.globalsymtable);
+                         load_intern_types;
+                       end;
                    end
                    end
                  else
                  else
                    consume(_ID);
                    consume(_ID);
@@ -1549,6 +1555,11 @@ type
          uu:=tused_unit(usedunits.first);
          uu:=tused_unit(usedunits.first);
          while assigned(uu) do
          while assigned(uu) do
            begin
            begin
+             if not assigned(systemunit) and (uu.u.modulename^='SYSTEM') then
+               begin
+                 systemunit:=tglobalsymtable(uu.u.globalsymtable);
+                 load_intern_types;
+               end;
              if not assigned(uu.u.package) then
              if not assigned(uu.u.package) then
                export_unit(uu.u);
                export_unit(uu.u);