From b954ea006e7f451daa65de0ad338abcd9697dba7 Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Tue, 20 Dec 2005 17:52:08 +0000 Subject: [PATCH] * generate the procsymbol before generating the code for the procedure, so that refences to this symbol are not treated as external git-svn-id: trunk@2009 - --- compiler/psub.pas | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/compiler/psub.pas b/compiler/psub.pas index 9fd7ba2685..a11555717f 100644 --- a/compiler/psub.pas +++ b/compiler/psub.pas @@ -608,7 +608,7 @@ implementation oldprocinfo : tprocinfo; oldaktmaxfpuregisters : longint; oldfilepos : tfileposinfo; - templist : Taasmoutput; + templist, symlist : Taasmoutput; headertai : tai; curralign : longint; begin @@ -637,6 +637,7 @@ implementation aktbreaklabel:=nil; aktcontinuelabel:=nil; templist:=Taasmoutput.create; + symlist:=Taasmoutput.create; { add parast/localst to symtablestack } add_to_symtablestack; @@ -682,6 +683,12 @@ implementation set_first_temp_offset; generate_parameter_info; + { allocate the symbol associated with the procedure, so that } + { references to itself are not treated as references to } + { externals } + aktfilepos:=entrypos; + gen_proc_symbol(symlist); + { Allocate space in temp/registers for parast and localst } aktfilepos:=entrypos; gen_alloc_symtable(aktproccode,procdef.parast); @@ -771,10 +778,9 @@ implementation { generate symbol and save end of header position } aktfilepos:=entrypos; - gen_proc_symbol(templist); - headertai:=tai(templist.last); + headertai:=tai(symlist.last); { insert symbol } - aktproccode.insertlist(templist); + aktproccode.insertlist(symlist); { Free space in temp/registers for parast and localst, must be done after gen_entry_code }