|
@@ -1148,7 +1148,7 @@ implementation
|
|
|
containing constants }
|
|
|
if is_boolean(left.resultdef) and is_boolean(right.resultdef) then
|
|
|
begin
|
|
|
- if is_constboolnode(left) and not(might_have_sideeffects(right)) then
|
|
|
+ if is_constboolnode(left) then
|
|
|
begin
|
|
|
if ((nodetype=andn) and (tordconstnode(left).value<>0)) or
|
|
|
((nodetype=orn) and (tordconstnode(left).value=0)) or
|
|
@@ -1158,8 +1158,9 @@ implementation
|
|
|
right:=nil;
|
|
|
exit;
|
|
|
end
|
|
|
- else if ((nodetype=orn) and (tordconstnode(left).value<>0)) or
|
|
|
- ((nodetype=andn) and (tordconstnode(left).value=0)) then
|
|
|
+ else if not(might_have_sideeffects(right)) and
|
|
|
+ (((nodetype=orn) and (tordconstnode(left).value<>0)) or
|
|
|
+ ((nodetype=andn) and (tordconstnode(left).value=0))) then
|
|
|
begin
|
|
|
result:=left;
|
|
|
left:=nil;
|
|
@@ -1172,7 +1173,7 @@ implementation
|
|
|
exit;
|
|
|
end
|
|
|
end
|
|
|
- else if is_constboolnode(right) and not(might_have_sideeffects(left)) then
|
|
|
+ else if is_constboolnode(right) then
|
|
|
begin
|
|
|
if ((nodetype=andn) and (tordconstnode(right).value<>0)) or
|
|
|
((nodetype=orn) and (tordconstnode(right).value=0)) or
|
|
@@ -1182,8 +1183,9 @@ implementation
|
|
|
left:=nil;
|
|
|
exit;
|
|
|
end
|
|
|
- else if ((nodetype=orn) and (tordconstnode(right).value<>0)) or
|
|
|
- ((nodetype=andn) and (tordconstnode(right).value=0)) then
|
|
|
+ else if not(might_have_sideeffects(left)) and
|
|
|
+ (((nodetype=orn) and (tordconstnode(right).value<>0)) or
|
|
|
+ ((nodetype=andn) and (tordconstnode(right).value=0))) then
|
|
|
begin
|
|
|
result:=right;
|
|
|
right:=nil;
|