|
@@ -183,10 +183,11 @@ implementation
|
|
var
|
|
var
|
|
hp : tppumodule;
|
|
hp : tppumodule;
|
|
unitsym : tunitsym;
|
|
unitsym : tunitsym;
|
|
|
|
+
|
|
begin
|
|
begin
|
|
{ load unit }
|
|
{ load unit }
|
|
hp:=registerunit(curr,s,'');
|
|
hp:=registerunit(curr,s,'');
|
|
- hp.loadppu;
|
|
|
|
|
|
+ hp.loadppu(curr);
|
|
hp.adddependency(curr);
|
|
hp.adddependency(curr);
|
|
{ add to symtable stack }
|
|
{ add to symtable stack }
|
|
symtablestack.push(hp.globalsymtable);
|
|
symtablestack.push(hp.globalsymtable);
|
|
@@ -293,6 +294,9 @@ implementation
|
|
|
|
|
|
|
|
|
|
procedure loadsystemunit(curr : tmodule);
|
|
procedure loadsystemunit(curr : tmodule);
|
|
|
|
+ var
|
|
|
|
+ state: pglobalstate;
|
|
|
|
+
|
|
begin
|
|
begin
|
|
{ we are going to rebuild the symtablestack, clear it first }
|
|
{ we are going to rebuild the symtablestack, clear it first }
|
|
symtablestack.clear;
|
|
symtablestack.clear;
|
|
@@ -319,7 +323,15 @@ implementation
|
|
internal types from the system unit }
|
|
internal types from the system unit }
|
|
AddUnit(curr,'system');
|
|
AddUnit(curr,'system');
|
|
systemunit:=tglobalsymtable(symtablestack.top);
|
|
systemunit:=tglobalsymtable(symtablestack.top);
|
|
|
|
+
|
|
|
|
+ { load_intern_types resets the scanner... }
|
|
|
|
+ current_scanner.tempcloseinputfile;
|
|
|
|
+ new(state);
|
|
|
|
+ save_global_state(state^,true);
|
|
load_intern_types;
|
|
load_intern_types;
|
|
|
|
+ restore_global_state(state^,true);
|
|
|
|
+ dispose(state);
|
|
|
|
+ current_scanner.tempopeninputfile;
|
|
|
|
|
|
{ Set the owner of errorsym and errortype to symtable to
|
|
{ Set the owner of errorsym and errortype to symtable to
|
|
prevent crashes when accessing .owner }
|
|
prevent crashes when accessing .owner }
|
|
@@ -330,7 +342,7 @@ implementation
|
|
if not (cs_compilesystem in current_settings.moduleswitches) then
|
|
if not (cs_compilesystem in current_settings.moduleswitches) then
|
|
if ([m_objfpc,m_delphi] * current_settings.modeswitches)<>[] then
|
|
if ([m_objfpc,m_delphi] * current_settings.modeswitches)<>[] then
|
|
if is_systemunit_unicode then
|
|
if is_systemunit_unicode then
|
|
- Include(current_settings.modeswitches,m_default_unicodestring)
|
|
|
|
|
|
+ Include(current_settings.modeswitches,m_default_unicodestring);
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
@@ -567,9 +579,26 @@ implementation
|
|
s,sorg : ansistring;
|
|
s,sorg : ansistring;
|
|
pu,pu2 : tused_unit;
|
|
pu,pu2 : tused_unit;
|
|
hp2 : tmodule;
|
|
hp2 : tmodule;
|
|
|
|
+ state: pglobalstate;
|
|
|
|
+
|
|
|
|
+ procedure restorestate;
|
|
|
|
+
|
|
|
|
+ begin
|
|
|
|
+ restore_global_state(state^,true);
|
|
|
|
+ if assigned(current_scanner) and (current_module.scanner=current_scanner) then
|
|
|
|
+ begin
|
|
|
|
+ if assigned(current_scanner.inputfile) then
|
|
|
|
+ current_scanner.tempopeninputfile;
|
|
|
|
+ end;
|
|
|
|
+
|
|
|
|
+ dispose(state);
|
|
|
|
+ end;
|
|
|
|
|
|
begin
|
|
begin
|
|
- parseusesclause(curr);
|
|
|
|
|
|
+ parseusesclause(curr);
|
|
|
|
+ current_scanner.tempcloseinputfile;
|
|
|
|
+ new(state);
|
|
|
|
+ save_global_state(state^,true);
|
|
{ Load the units }
|
|
{ Load the units }
|
|
pu:=tused_unit(curr.used_units.first);
|
|
pu:=tused_unit(curr.used_units.first);
|
|
while assigned(pu) do
|
|
while assigned(pu) do
|
|
@@ -579,10 +608,13 @@ implementation
|
|
if pu.in_uses and
|
|
if pu.in_uses and
|
|
(pu.in_interface=curr.in_interface) then
|
|
(pu.in_interface=curr.in_interface) then
|
|
begin
|
|
begin
|
|
- tppumodule(pu.u).loadppu;
|
|
|
|
|
|
+ tppumodule(pu.u).loadppu(curr);
|
|
{ is our module compiled? then we can stop }
|
|
{ is our module compiled? then we can stop }
|
|
if curr.state=ms_compiled then
|
|
if curr.state=ms_compiled then
|
|
- exit;
|
|
|
|
|
|
+ begin
|
|
|
|
+ Restorestate;
|
|
|
|
+ exit;
|
|
|
|
+ end;
|
|
{ add this unit to the dependencies }
|
|
{ add this unit to the dependencies }
|
|
pu.u.adddependency(curr);
|
|
pu.u.adddependency(curr);
|
|
{ save crc values }
|
|
{ save crc values }
|
|
@@ -636,6 +668,7 @@ implementation
|
|
end;
|
|
end;
|
|
pu:=tused_unit(pu.next);
|
|
pu:=tused_unit(pu.next);
|
|
end;
|
|
end;
|
|
|
|
+ Restorestate;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
@@ -990,6 +1023,7 @@ type
|
|
function parse_unit_interface_declarations(curr : tmodule) : boolean;
|
|
function parse_unit_interface_declarations(curr : tmodule) : boolean;
|
|
|
|
|
|
begin
|
|
begin
|
|
|
|
+ result:=true;
|
|
{ create whole program optimisation information (may already be
|
|
{ create whole program optimisation information (may already be
|
|
updated in the interface, e.g., in case of classrefdef typed
|
|
updated in the interface, e.g., in case of classrefdef typed
|
|
constants }
|
|
constants }
|
|
@@ -1031,7 +1065,6 @@ type
|
|
if not(cs_compilesystem in current_settings.moduleswitches) and
|
|
if not(cs_compilesystem in current_settings.moduleswitches) and
|
|
(Errorcount=0) then
|
|
(Errorcount=0) then
|
|
tppumodule(curr).getppucrc;
|
|
tppumodule(curr).getppucrc;
|
|
-
|
|
|
|
curr.in_interface:=false;
|
|
curr.in_interface:=false;
|
|
curr.interface_compiled:=true;
|
|
curr.interface_compiled:=true;
|
|
|
|
|
|
@@ -1069,7 +1102,7 @@ type
|
|
if curr.state=ms_compiled then
|
|
if curr.state=ms_compiled then
|
|
begin
|
|
begin
|
|
symtablestack.pop(curr.globalsymtable);
|
|
symtablestack.pop(curr.globalsymtable);
|
|
- exit;
|
|
|
|
|
|
+ exit(true);
|
|
end;
|
|
end;
|
|
result:=proc_unit_implementation(curr);
|
|
result:=proc_unit_implementation(curr);
|
|
end;
|
|
end;
|