mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-20 11:09:42 +02:00
* fixed repeat continue until true;
This commit is contained in:
parent
ba6a341854
commit
8772ddfc7b
@ -182,6 +182,7 @@ Fixed bugs:
|
||||
bug0157.pp Invalid compilation and also crashes OK 0.99.7 (PFV)
|
||||
bug0158.pp Invalid boolean typecast OK 0.99.7 (PFV)
|
||||
bug0159.pp Invalid virtual functions - should compile OK 0.99.7 (FK)
|
||||
bug0162.pp continue in repeat ... until loop doesn't work correct OK 0.99.8 (PFV)
|
||||
bug0164.pp crash when using undeclared array index in with statement OK 0.99.8 (PFV)
|
||||
|
||||
Unproducable bugs:
|
||||
@ -216,7 +217,6 @@ bug0152.pp End value of loop variable must be calculated before loop
|
||||
variable is initialized.
|
||||
bug0161.pp internal error when trying to create a set with another set as
|
||||
its element (instead of a syntax error)
|
||||
bug0162.pp continue in repeat ... until loop doesn't work correct
|
||||
bug0163.pp missing <= and >= operators for sets.
|
||||
bug0165.pp missing range check code for enumerated types.
|
||||
bug0166.pp forward type used in declaration crashes instead of error
|
||||
|
@ -55,62 +55,51 @@ implementation
|
||||
|
||||
procedure second_while_repeatn(var p : ptree);
|
||||
var
|
||||
l1,l2,l3,oldclabel,oldblabel : plabel;
|
||||
lcont,lbreak,lloop,
|
||||
oldclabel,oldblabel : plabel;
|
||||
otlabel,oflabel : plabel;
|
||||
begin
|
||||
getlabel(l1);
|
||||
getlabel(l2);
|
||||
getlabel(lloop);
|
||||
getlabel(lcont);
|
||||
getlabel(lbreak);
|
||||
{ arrange continue and breaklabels: }
|
||||
oldclabel:=aktcontinuelabel;
|
||||
oldblabel:=aktbreaklabel;
|
||||
if p^.treetype=repeatn then
|
||||
begin
|
||||
emitl(A_LABEL,l1);
|
||||
aktcontinuelabel:=l1;
|
||||
aktbreaklabel:=l2;
|
||||
cleartempgen;
|
||||
if assigned(p^.right) then
|
||||
secondpass(p^.right);
|
||||
|
||||
otlabel:=truelabel;
|
||||
oflabel:=falselabel;
|
||||
truelabel:=l2;
|
||||
falselabel:=l1;
|
||||
cleartempgen;
|
||||
secondpass(p^.left);
|
||||
maketojumpbool(p^.left);
|
||||
emitl(A_LABEL,l2);
|
||||
truelabel:=otlabel;
|
||||
falselabel:=oflabel;
|
||||
end
|
||||
{ handling code at the end as it is much more efficient, and makes
|
||||
while equal to repeat loop, only the end true/false is swapped (PFV) }
|
||||
if p^.treetype=whilen then
|
||||
emitl(A_JMP,lcont);
|
||||
|
||||
emitl(A_LABEL,lloop);
|
||||
|
||||
aktcontinuelabel:=lcont;
|
||||
aktbreaklabel:=lbreak;
|
||||
cleartempgen;
|
||||
if assigned(p^.right) then
|
||||
secondpass(p^.right);
|
||||
|
||||
emitl(A_LABEL,lcont);
|
||||
otlabel:=truelabel;
|
||||
oflabel:=falselabel;
|
||||
if p^.treetype=whilen then
|
||||
begin
|
||||
truelabel:=lloop;
|
||||
falselabel:=lbreak;
|
||||
end
|
||||
{ repeatn }
|
||||
else
|
||||
begin
|
||||
{ handling code at the end as it is much more efficient }
|
||||
emitl(A_JMP,l2);
|
||||
begin
|
||||
truelabel:=lbreak;
|
||||
falselabel:=lloop;
|
||||
end;
|
||||
cleartempgen;
|
||||
secondpass(p^.left);
|
||||
maketojumpbool(p^.left);
|
||||
emitl(A_LABEL,lbreak);
|
||||
truelabel:=otlabel;
|
||||
falselabel:=oflabel;
|
||||
|
||||
emitl(A_LABEL,l1);
|
||||
cleartempgen;
|
||||
|
||||
getlabel(l3);
|
||||
aktcontinuelabel:=l2;
|
||||
aktbreaklabel:=l3;
|
||||
|
||||
if assigned(p^.right) then
|
||||
secondpass(p^.right);
|
||||
|
||||
emitl(A_LABEL,l2);
|
||||
otlabel:=truelabel;
|
||||
oflabel:=falselabel;
|
||||
truelabel:=l1;
|
||||
falselabel:=l3;
|
||||
cleartempgen;
|
||||
secondpass(p^.left);
|
||||
maketojumpbool(p^.left);
|
||||
|
||||
emitl(A_LABEL,l3);
|
||||
truelabel:=otlabel;
|
||||
falselabel:=oflabel;
|
||||
end;
|
||||
aktcontinuelabel:=oldclabel;
|
||||
aktbreaklabel:=oldblabel;
|
||||
end;
|
||||
@ -735,7 +724,10 @@ do_jmp:
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.18 1998-09-26 15:03:04 florian
|
||||
Revision 1.19 1998-09-28 12:13:53 peter
|
||||
* fixed repeat continue until true;
|
||||
|
||||
Revision 1.18 1998/09/26 15:03:04 florian
|
||||
* small problems with DOM and excpetions fixed (code generation
|
||||
of raise was wrong and self was sometimes destroyed :()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user