* 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:
Jonas Maebe 2016-08-26 13:02:10 +00:00
parent deda4c8247
commit 3669419bb3
3 changed files with 28 additions and 3 deletions

1
.gitattributes vendored
View File

@ -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

View File

@ -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
View 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.