Преглед изворни кода

* Move global variable in_preproc_comp_expr into tscannerfile class.

git-svn-id: trunk@36133 -
maciej-izak пре 8 година
родитељ
комит
631d4a2d53
2 измењених фајлова са 8 додато и 6 уклоњено
  1. 5 5
      compiler/scanner.pas
  2. 3 1
      compiler/symtable.pas

+ 5 - 5
compiler/scanner.pas

@@ -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;

+ 3 - 1
compiler/symtable.pas

@@ -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;