mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-09 14:08:05 +02:00
* fixed tcasenode.simplify() in case we have to pass via a "less" branch of
of a tcaselabel that also has a valid "greater" branch to arrive at the correct entry (mantis #30522) git-svn-id: trunk@34379 -
This commit is contained in:
parent
deda4c8247
commit
3669419bb3
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -15207,6 +15207,7 @@ tests/webtbs/tw30431.pp svneol=native#text/plain
|
||||
tests/webtbs/tw30443.pp svneol=native#text/plain
|
||||
tests/webtbs/tw3045.pp svneol=native#text/plain
|
||||
tests/webtbs/tw3048.pp svneol=native#text/plain
|
||||
tests/webtbs/tw30522.pp svneol=native#text/plain
|
||||
tests/webtbs/tw3063.pp svneol=native#text/plain
|
||||
tests/webtbs/tw3064.pp svneol=native#text/plain
|
||||
tests/webtbs/tw3073.pp svneol=native#text/plain
|
||||
|
@ -873,14 +873,12 @@ implementation
|
||||
function tcasenode.simplify(forinline:boolean):tnode;
|
||||
var
|
||||
tmp: pcaselabel;
|
||||
walkup: boolean;
|
||||
begin
|
||||
result:=nil;
|
||||
if left.nodetype=ordconstn then
|
||||
begin
|
||||
tmp:=labels;
|
||||
{ check all case labels until we find one that fits }
|
||||
walkup:=assigned(tmp^.greater);
|
||||
while assigned(tmp) do
|
||||
begin
|
||||
if (tmp^._low<=tordconstnode(left).value) and
|
||||
@ -895,7 +893,7 @@ implementation
|
||||
exit;
|
||||
end;
|
||||
|
||||
if walkup then
|
||||
if tmp^._high<tordconstnode(left).value then
|
||||
tmp:=tmp^.greater
|
||||
else
|
||||
tmp:=tmp^.less;
|
||||
|
26
tests/webtbs/tw30522.pp
Normal file
26
tests/webtbs/tw30522.pp
Normal file
@ -0,0 +1,26 @@
|
||||
|
||||
type
|
||||
E = ( a, b, c );
|
||||
|
||||
begin
|
||||
case b of
|
||||
a: begin
|
||||
write( 'a' );
|
||||
halt(1);
|
||||
end;
|
||||
c: begin
|
||||
write( 'c' );
|
||||
halt(2);
|
||||
end;
|
||||
b:
|
||||
begin
|
||||
write( 'b' );
|
||||
halt(0);
|
||||
end;
|
||||
else
|
||||
begin
|
||||
write( '?' );
|
||||
halt(3);
|
||||
end
|
||||
end;
|
||||
end.
|
Loading…
Reference in New Issue
Block a user