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

View File

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