* use set_current_scanner, add mainscanner

This commit is contained in:
Michaël Van Canneyt 2024-01-31 13:49:13 +01:00 committed by Michael Van Canneyt
parent 93ae6261cc
commit 3ce07ef6fa
2 changed files with 11 additions and 10 deletions

View File

@ -163,6 +163,7 @@ interface
localsymtable : TSymtable;{ pointer to the local symtable of this unit }
globalmacrosymtable, { pointer to the global macro symtable of this unit }
localmacrosymtable : TSymtable;{ pointer to the local macro symtable of this unit }
mainscanner : TObject; { scanner object used }
scanner : TObject; { scanner object used }
procinfo : TObject; { current procedure being compiled }
asmdata : TObject; { Assembler data }
@ -347,7 +348,7 @@ implementation
current_asmdata:=tasmdata(current_module.asmdata);
current_debuginfo:=tdebuginfo(current_module.debuginfo);
{ restore scanner and file positions }
current_scanner:=tscannerfile(current_module.scanner);
set_current_scanner(tscannerfile(current_module.scanner),false);
if assigned(current_scanner) then
begin
current_scanner.tempopeninputfile;
@ -363,7 +364,7 @@ implementation
else
begin
current_asmdata:=nil;
current_scanner:=nil;
set_current_scanner(nil,false);
current_debuginfo:=nil;
end;
end;
@ -682,8 +683,9 @@ implementation
{ also update current_scanner if it was pointing
to this module }
if current_scanner=tscannerfile(scanner) then
current_scanner:=nil;
tscannerfile(scanner).free;
set_current_scanner(nil,false);
freeandnil(scanner);
end;
if assigned(asmdata) then
begin
@ -784,9 +786,8 @@ implementation
{ also update current_scanner if it was pointing
to this module }
if current_scanner=tscannerfile(scanner) then
current_scanner:=nil;
tscannerfile(scanner).free;
scanner:=nil;
set_current_scanner(nil,false);
freeandnil(scanner);
end;
if assigned(procinfo) then
begin
@ -1152,8 +1153,8 @@ implementation
if assigned(scanner) then
begin
if current_scanner=tscannerfile(scanner) then
current_scanner:=nil;
tscannerfile(scanner).free;
set_current_scanner(nil,false);
FreeAndNil(scanner);
scanner:=nil;
end;

View File

@ -151,7 +151,7 @@ uses
current_module:=old_current_module; {!}
current_asmdata:=old_asmdata;
current_debuginfo:=old_debuginfo;
current_scanner:=old_scanner;
set_current_scanner(old_scanner,False);
parser_current_file:=old_parser_file;
end;
end;