- remove functionality to get the code block when parsing again (let's open this pandora's box only when really needed...)

git-svn-id: trunk@42397 -
This commit is contained in:
svenbarth 2019-07-12 22:07:31 +00:00
parent a64a8f8deb
commit 3a02393584

View File

@ -33,8 +33,6 @@ interface
symdef,procinfo,optdfa; symdef,procinfo,optdfa;
type type
tcggetcodeblockfunc = function(pd: tprocdef) : tnode;
tcgprocinfo = class(tprocinfo) tcgprocinfo = class(tprocinfo)
private private
procedure CreateInlineInfo; procedure CreateInlineInfo;
@ -66,7 +64,7 @@ interface
procedure resetprocdef; procedure resetprocdef;
procedure add_to_symtablestack; procedure add_to_symtablestack;
procedure remove_from_symtablestack; procedure remove_from_symtablestack;
procedure parse_body(get_code_block_func: tcggetcodeblockfunc=nil); procedure parse_body;
function has_assembler_child : boolean; function has_assembler_child : boolean;
procedure set_eh_info; override; procedure set_eh_info; override;
@ -91,7 +89,7 @@ interface
{ reads any routine in the implementation, or a non-method routine { reads any routine in the implementation, or a non-method routine
declaration in the interface (depending on whether or not parse_only is declaration in the interface (depending on whether or not parse_only is
true) } true) }
procedure read_proc(isclassmethod:boolean; usefwpd: tprocdef; isgeneric:boolean; get_code_block_func: tcggetcodeblockfunc = nil); procedure read_proc(isclassmethod:boolean; usefwpd: tprocdef; isgeneric:boolean);
{ parses only the body of a non nested routine; needs a correctly setup pd } { parses only the body of a non nested routine; needs a correctly setup pd }
procedure read_proc_body(pd:tprocdef); procedure read_proc_body(pd:tprocdef);
@ -2071,7 +2069,7 @@ implementation
end; end;
procedure tcgprocinfo.parse_body(get_code_block_func: tcggetcodeblockfunc); procedure tcgprocinfo.parse_body;
var var
old_current_procinfo : tprocinfo; old_current_procinfo : tprocinfo;
old_block_type : tblock_type; old_block_type : tblock_type;
@ -2155,17 +2153,8 @@ implementation
current_scanner.startrecordtokens(procdef.generictokenbuf); current_scanner.startrecordtokens(procdef.generictokenbuf);
end; end;
if assigned(get_code_block_func) then { parse the code ... }
begin code:=block(current_module.islibrary);
{ generate the code-nodes }
code:=get_code_block_func(procdef);
init_main_block_syms(code);
end
else
begin
{ parse the code ... }
code:=block(current_module.islibrary);
end;
if recordtokens then if recordtokens then
begin begin
@ -2277,7 +2266,7 @@ implementation
end; end;
procedure read_proc_body(old_current_procinfo:tprocinfo;pd:tprocdef;get_code_block_func: tcggetcodeblockfunc=nil); procedure read_proc_body(old_current_procinfo:tprocinfo;pd:tprocdef);
{ {
Parses the procedure directives, then parses the procedure body, then Parses the procedure directives, then parses the procedure body, then
generates the code for it generates the code for it
@ -2323,7 +2312,7 @@ implementation
tokeninfo^[_FAIL].keyword:=alllanguagemodes; tokeninfo^[_FAIL].keyword:=alllanguagemodes;
end; end;
tcgprocinfo(current_procinfo).parse_body(get_code_block_func); tcgprocinfo(current_procinfo).parse_body;
{ reset _FAIL as _SELF normal } { reset _FAIL as _SELF normal }
if (pd.proctypeoption=potype_constructor) then if (pd.proctypeoption=potype_constructor) then
@ -2359,7 +2348,7 @@ implementation
assigned(current_procinfo.procdef.owner) and assigned(current_procinfo.procdef.owner) and
(current_procinfo.procdef.owner.defowner=current_procinfo.procdef.struct) (current_procinfo.procdef.owner.defowner=current_procinfo.procdef.struct)
) )
) and not(assigned(get_code_block_func)) then ) then
consume(_SEMICOLON); consume(_SEMICOLON);
if not isnestedproc then if not isnestedproc then
@ -2383,7 +2372,7 @@ implementation
end; end;
procedure read_proc(isclassmethod:boolean; usefwpd: tprocdef; isgeneric:boolean; get_code_block_func: tcggetcodeblockfunc); procedure read_proc(isclassmethod:boolean; usefwpd: tprocdef; isgeneric:boolean);
{ {
Parses the procedure directives, then parses the procedure body, then Parses the procedure directives, then parses the procedure body, then
generates the code for it generates the code for it
@ -2542,7 +2531,7 @@ implementation
{ compile procedure when a body is needed } { compile procedure when a body is needed }
if (pd_body in pdflags) then if (pd_body in pdflags) then
begin begin
read_proc_body(old_current_procinfo,pd, get_code_block_func); read_proc_body(old_current_procinfo,pd);
end end
else else
begin begin