浏览代码

* implicitly call procvars in tp/delphi modes for divmodn, shlshrn
and notn (mantis 7200)

git-svn-id: trunk@5724 -

Jonas Maebe 18 年之前
父节点
当前提交
4ae9ac969a
共有 3 个文件被更改,包括 46 次插入1 次删除
  1. 1 0
      .gitattributes
  2. 13 1
      compiler/nmat.pas
  3. 32 0
      tests/webtbs/tw7200.pp

+ 1 - 0
.gitattributes

@@ -7785,6 +7785,7 @@ tests/webtbs/tw7143.pp -text
 tests/webtbs/tw7161.pp svneol=native#text/plain
 tests/webtbs/tw7173.pp svneol=native#text/plain
 tests/webtbs/tw7195.pp svneol=native#text/plain
+tests/webtbs/tw7200.pp svneol=native#text/plain
 tests/webtbs/tw7227.pp svneol=native#text/plain
 tests/webtbs/tw7276.pp svneol=native#text/plain
 tests/webtbs/tw7281.pp svneol=native#text/plain

+ 13 - 1
compiler/nmat.pas

@@ -94,7 +94,8 @@ implementation
       defutil,
       htypechk,pass_1,
       cgbase,
-      ncon,ncnv,ncal,nadd;
+      ncon,ncnv,ncal,nadd,
+      nutils;
 
 {****************************************************************************
                               TMODDIVNODE
@@ -164,6 +165,10 @@ implementation
          if codegenerror then
            exit;
 
+         { tp procvar support }
+         maybe_call_procvar(left,true);
+         maybe_call_procvar(right,true);
+
          result:=simplify;
          if assigned(result) then
            exit;
@@ -495,6 +500,10 @@ implementation
          if codegenerror then
            exit;
 
+         { tp procvar support }
+         maybe_call_procvar(left,true);
+         maybe_call_procvar(right,true);
+
          result:=simplify;
          if assigned(result) then
            exit;
@@ -853,6 +862,9 @@ implementation
          if codegenerror then
            exit;
 
+         { tp procvar support }
+         maybe_call_procvar(left,true);
+
          resultdef:=left.resultdef;
 
          result:=simplify;

+ 32 - 0
tests/webtbs/tw7200.pp

@@ -0,0 +1,32 @@
+{$mode delphi}
+
+var i : integer;
+
+function GetInt : integer;
+begin
+ Result := 10;
+end;
+
+
+ var myfunc : function : integer;
+
+
+begin
+
+ myfunc := GetInt;
+
+ //i := integer(myfunc) div 2; //works
+ //i := myfunc; i := i div 2; //works
+ i := myfunc div 2; //does not work
+ if (i <> 5) then
+   halt(1);
+
+ i := myfunc shr 2;
+ if i <> 2 then
+   halt(2);
+
+ i := not myfunc;
+ if i <> not(integer(10)) then
+   halt(3);
+
+end.