Browse Source

* fixed parsing of declarations before asm statement

peter 22 years ago
parent
commit
215ccaafe2
2 changed files with 30 additions and 30 deletions
  1. 12 14
      compiler/pstatmnt.pas
  2. 18 16
      compiler/psub.pas

+ 12 - 14
compiler/pstatmnt.pas

@@ -1087,20 +1087,15 @@ implementation
          { space for the return value       }
          if not is_void(aktprocdef.rettype.def) then
            begin
-              aktprocdef.funcretsym:=tfuncretsym.create(aktprocsym.name,aktprocdef.rettype);
-              { insert in local symtable }
-              { but with another name, so that recursive calls are possible }
-              symtablestack.insert(aktprocdef.funcretsym);
-              symtablestack.insertvardata(aktprocdef.funcretsym);
-              symtablestack.rename(aktprocdef.funcretsym.name,'$result');
-              { update the symtablesize back to 0 if there were no locals }
-              if not haslocals then
-               symtablestack.datasize:=0;
-
-              { set the used registers depending on the function result }
-              procinfo.update_usedinproc_result;
+             symtablestack.rename(aktprocdef.funcretsym.name,'$result');
+             { update the symtablesize back to 0 if there were no locals }
+             if not haslocals then
+              symtablestack.datasize:=0;
+
+             { set the used registers depending on the function result }
+             procinfo.update_usedinproc_result;
+           end;
 
-            end;
          { force the asm statement }
          if token<>_ASM then
            consume(_ASM);
@@ -1147,7 +1142,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.82  2002-12-27 18:18:56  peter
+  Revision 1.83  2002-12-29 18:59:34  peter
+    * fixed parsing of declarations before asm statement
+
+  Revision 1.82  2002/12/27 18:18:56  peter
     * check for else after empty raise statement
 
   Revision 1.81  2002/11/27 02:37:14  peter

+ 18 - 16
compiler/psub.pas

@@ -84,21 +84,6 @@ implementation
       var
          storepos : tfileposinfo;
       begin
-         { parse const,types and vars }
-         read_declarations(islibrary);
-
-         { do we have an assembler block without the po_assembler?
-           we should allow this for Delphi compatibility (PFV) }
-         if (token=_ASM) and (m_delphi in aktmodeswitches) then
-          include(aktprocdef.procoptions,po_assembler);
-
-         { Handle assembler block different }
-         if (po_assembler in aktprocdef.procoptions) then
-          begin
-            block:=assembler_block;
-            exit;
-          end;
-
          if not is_void(aktprocdef.rettype.def) then
            begin
               { if the current is a function aktprocsym is non nil }
@@ -119,9 +104,23 @@ implementation
                  symtablestack.insert(aktprocdef.resultfuncretsym);
                end;
            end;
+         { parse const,types and vars }
+         read_declarations(islibrary);
 
          procinfo.handle_body_start;
 
+         { do we have an assembler block without the po_assembler?
+           we should allow this for Delphi compatibility (PFV) }
+         if (token=_ASM) and (m_delphi in aktmodeswitches) then
+          include(aktprocdef.procoptions,po_assembler);
+
+         { Handle assembler block different }
+         if (po_assembler in aktprocdef.procoptions) then
+          begin
+            block:=assembler_block;
+            exit;
+          end;
+
          {Unit initialization?.}
          if (lexlevel=unit_init_level) and (current_module.is_unit)
             or islibrary then
@@ -819,7 +818,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.84  2002-12-29 18:25:18  peter
+  Revision 1.85  2002-12-29 18:59:34  peter
+    * fixed parsing of declarations before asm statement
+
+  Revision 1.84  2002/12/29 18:25:18  peter
     * parse declarations before check _ASM token
 
   Revision 1.83  2002/12/29 14:57:50  peter