浏览代码

* simplify tc_bool_2_int

git-svn-id: trunk@44712 -
florian 5 年之前
父节点
当前提交
4d73a9e637
共有 1 个文件被更改,包括 8 次插入0 次删除
  1. 8 0
      compiler/ncnv.pas

+ 8 - 0
compiler/ncnv.pas

@@ -3181,6 +3181,7 @@ implementation
         { must be done before code below, because we need the
         { must be done before code below, because we need the
           typeconversions for ordconstn's as well }
           typeconversions for ordconstn's as well }
         case convtype of
         case convtype of
+          tc_bool_2_int,
           tc_int_2_bool,
           tc_int_2_bool,
           tc_int_2_int:
           tc_int_2_int:
             begin
             begin
@@ -3216,6 +3217,13 @@ implementation
                       left:=nil;
                       left:=nil;
                       exit;
                       exit;
                     end;
                     end;
+                  if (convtype=tc_int_2_int) and (left.nodetype=typeconvn) and (ttypeconvnode(left).convtype=tc_bool_2_int) then
+                    begin
+                      ttypeconvnode(left).resultdef:=resultdef;
+                      result:=left;
+                      left:=nil;
+                      exit;
+                    end;
                 end;
                 end;
             end;
             end;
           else
           else