Browse Source

Replaced owner field by fileindex field in tpreprocstack class, in order to display correct include file for scan_e_endif_expected error

git-svn-id: trunk@35557 -
pierre 8 years ago
parent
commit
e87cc28b64
1 changed files with 6 additions and 3 deletions
  1. 6 3
      compiler/scanner.pas

+ 6 - 3
compiler/scanner.pas

@@ -51,7 +51,7 @@ interface
           next    : tpreprocstack;
           next    : tpreprocstack;
           name    : TIDString;
           name    : TIDString;
           line_nb : longint;
           line_nb : longint;
-          owner   : tscannerfile;
+          fileindex : longint;
           constructor Create(atyp:preproctyp;a:boolean;n:tpreprocstack);
           constructor Create(atyp:preproctyp;a:boolean;n:tpreprocstack);
        end;
        end;
 
 
@@ -3710,7 +3710,8 @@ type
         while assigned(preprocstack) do
         while assigned(preprocstack) do
          begin
          begin
            Message4(scan_e_endif_expected,preprocstring[preprocstack.typ],preprocstack.name,
            Message4(scan_e_endif_expected,preprocstring[preprocstack.typ],preprocstack.name,
-             preprocstack.owner.inputfile.name,tostr(preprocstack.line_nb));
+             current_module.sourcefiles.get_file_name(preprocstack.fileindex),
+             tostr(preprocstack.line_nb));
            poppreprocstack;
            poppreprocstack;
          end;
          end;
       end;
       end;
@@ -3747,7 +3748,7 @@ type
         preprocstack:=tpreprocstack.create(atyp, condition, preprocstack);
         preprocstack:=tpreprocstack.create(atyp, condition, preprocstack);
         preprocstack.name:=valuedescr;
         preprocstack.name:=valuedescr;
         preprocstack.line_nb:=line_no;
         preprocstack.line_nb:=line_no;
-        preprocstack.owner:=self;
+        preprocstack.fileindex:=current_filepos.fileindex;
         if preprocstack.accept then
         if preprocstack.accept then
           Message2(messid,preprocstack.name,'accepted')
           Message2(messid,preprocstack.name,'accepted')
         else
         else
@@ -3766,6 +3767,7 @@ type
                preprocstack.accept:=not preprocstack.accept;
                preprocstack.accept:=not preprocstack.accept;
            preprocstack.typ:=pp_else;
            preprocstack.typ:=pp_else;
            preprocstack.line_nb:=line_no;
            preprocstack.line_nb:=line_no;
+           preprocstack.fileindex:=current_filepos.fileindex;
            if preprocstack.accept then
            if preprocstack.accept then
             Message2(scan_c_else_found,preprocstack.name,'accepted')
             Message2(scan_c_else_found,preprocstack.name,'accepted')
            else
            else
@@ -3801,6 +3803,7 @@ type
                end;
                end;
 
 
            preprocstack.line_nb:=line_no;
            preprocstack.line_nb:=line_no;
+           preprocstack.fileindex:=current_filepos.fileindex;
            if preprocstack.accept then
            if preprocstack.accept then
              Message2(scan_c_else_found,preprocstack.name,'accepted')
              Message2(scan_c_else_found,preprocstack.name,'accepted')
            else
            else