Try to avoid expectloc not set after first pass error for call node

git-svn-id: trunk@40309 -
This commit is contained in:
pierre 2018-11-13 15:51:32 +00:00
parent 122fd55564
commit cacd8f28eb

View File

@ -1903,9 +1903,16 @@ implementation
var var
lastinitstatement : tstatementnode; lastinitstatement : tstatementnode;
begin begin
if not assigned(n) then
exit;
if not assigned(callinitblock) then if not assigned(callinitblock) then
callinitblock:=internalstatements(lastinitstatement) begin
else callinitblock:=internalstatements(lastinitstatement);
lastinitstatement.left.free;
lastinitstatement.left:=n;
firstpass(tnode(callinitblock));
exit;
end;
lastinitstatement:=laststatement(callinitblock); lastinitstatement:=laststatement(callinitblock);
{ all these nodes must be immediately typechecked, because this routine } { all these nodes must be immediately typechecked, because this routine }
{ can be called from pass_1 (i.e., after typecheck has already run) and } { can be called from pass_1 (i.e., after typecheck has already run) and }
@ -1913,8 +1920,10 @@ implementation
{ pass_1, while the the typeinfo is already required after the } { pass_1, while the the typeinfo is already required after the }
{ typecheck pass for simplify purposes (not yet perfect, because the } { typecheck pass for simplify purposes (not yet perfect, because the }
{ statementnodes themselves are not typechecked this way) } { statementnodes themselves are not typechecked this way) }
firstpass(n);
addstatement(lastinitstatement,n); addstatement(lastinitstatement,n);
firstpass(tnode(lastinitstatement));
{ Update expectloc for callinitblock }
callinitblock.expectloc:=lastinitstatement.expectloc;
end; end;
@ -1922,13 +1931,22 @@ implementation
var var
lastdonestatement : tstatementnode; lastdonestatement : tstatementnode;
begin begin
if not assigned(n) then
exit;
if not assigned(callcleanupblock) then if not assigned(callcleanupblock) then
callcleanupblock:=internalstatements(lastdonestatement) begin
else callcleanupblock:=internalstatements(lastdonestatement);
lastdonestatement.left.free;
lastdonestatement.left:=n;
firstpass(tnode(callcleanupblock));
exit;
end;
lastdonestatement:=laststatement(callcleanupblock); lastdonestatement:=laststatement(callcleanupblock);
{ see comments in add_init_statement } { see comments in add_init_statement }
firstpass(n);
addstatement(lastdonestatement,n); addstatement(lastdonestatement,n);
firstpass(tnode(lastdonestatement));
{ Update expectloc for callcleanupblock }
callcleanupblock.expectloc:=lastdonestatement.expectloc;
end; end;