* Move global variable in_preproc_comp_expr into tscannerfile class.

git-svn-id: trunk@36133 -
This commit is contained in:
maciej-izak 2017-05-06 12:12:50 +00:00
parent d493980bb2
commit 631d4a2d53
2 changed files with 8 additions and 6 deletions

View File

@ -143,6 +143,9 @@ interface
preproc_pattern : string;
preproc_token : ttoken;
{ true, if we are parsing preprocessor expressions }
in_preproc_comp_expr : boolean;
constructor Create(const fn:string; is_macro: boolean = false);
destructor Destroy;override;
{ File buffer things }
@ -238,9 +241,6 @@ interface
{$endif PREPROCWRITE}
var
{ true, if we are parsing preprocessor expressions }
in_preproc_comp_expr: boolean = false;
{ read strings }
c : char;
orgpattern,
@ -2120,12 +2120,12 @@ type
end;
begin
in_preproc_comp_expr:=true;
current_scanner.in_preproc_comp_expr:=true;
current_scanner.skipspace;
{ start preproc expression scanner }
current_scanner.preproc_token:=current_scanner.readpreproc;
preproc_comp_expr:=preproc_sub_expr(opcompare,true);
in_preproc_comp_expr:=false;
current_scanner.in_preproc_comp_expr:=false;
end;
function boolean_compile_time_expr(var valuedescr: string): Boolean;

View File

@ -2799,7 +2799,9 @@ implementation
begin
{ for symbols used in preprocessor expressions, we don't want to
increase references count (for smaller final binaries) }
if in_preproc_comp_expr then
if not assigned(current_scanner) then
internalerror(2017050601);
if current_scanner.in_preproc_comp_expr then
exit;
{ symbol uses count }
sym.IncRefCount;