Browse Source

* correctly set the line info for the implicitly generated entry code nodes,
and update the code to also set it for some implicitly generated exit code

git-svn-id: trunk@34393 -

Jonas Maebe 9 years ago
parent
commit
eb2ce85269
1 changed files with 7 additions and 1 deletions
  1. 7 1
      compiler/psub.pas

+ 7 - 1
compiler/psub.pas

@@ -872,6 +872,7 @@ implementation
         { Generate procedure by combining init+body+final,
         { Generate procedure by combining init+body+final,
           depending on the implicit finally we need to add
           depending on the implicit finally we need to add
           an try...finally...end wrapper }
           an try...finally...end wrapper }
+        current_filepos:=entrypos;
         newblock:=internalstatements(newstatement);
         newblock:=internalstatements(newstatement);
         { initialization is common for all cases }
         { initialization is common for all cases }
         addstatement(newstatement,loadpara_asmnode);
         addstatement(newstatement,loadpara_asmnode);
@@ -925,7 +926,9 @@ implementation
               have managed variables/temps }
               have managed variables/temps }
             maybe_add_constructor_wrapper(code,
             maybe_add_constructor_wrapper(code,
               cs_implicit_exceptions in current_settings.moduleswitches);
               cs_implicit_exceptions in current_settings.moduleswitches);
+            current_filepos:=entrypos;
             addstatement(newstatement,code);
             addstatement(newstatement,code);
+            current_filepos:=exitpos;
             if assigned(nestedexitlabel) then
             if assigned(nestedexitlabel) then
               addstatement(newstatement,clabelnode.create(cnothingnode.create,nestedexitlabel));
               addstatement(newstatement,clabelnode.create(cnothingnode.create,nestedexitlabel));
             addstatement(newstatement,exitlabel_asmnode);
             addstatement(newstatement,exitlabel_asmnode);
@@ -938,7 +941,10 @@ implementation
               end;
               end;
           end;
           end;
         if not final_used then
         if not final_used then
-          cnodeutils.procdef_block_add_implicit_finalize_nodes(procdef,newstatement);
+          begin
+            current_filepos:=exitpos;
+            cnodeutils.procdef_block_add_implicit_finalize_nodes(procdef,newstatement);
+          end;
         do_firstpass(newblock);
         do_firstpass(newblock);
         code:=newblock;
         code:=newblock;
         current_filepos:=oldfilepos;
         current_filepos:=oldfilepos;