瀏覽代碼

+ test for "@procvar_of_object <> nil" in delphi mode

Jonas Maebe 21 年之前
父節點
當前提交
cb8f28f93d
共有 1 個文件被更改,包括 39 次插入0 次删除
  1. 39 0
      tests/tbs/tb0477.pp

+ 39 - 0
tests/tbs/tb0477.pp

@@ -0,0 +1,39 @@
+{$mode delphi}
+
+type
+  TProc = procedure of object;
+
+  TTest = class
+  public
+    proc: TProc;
+    constructor Create;
+    procedure foo;
+    procedure bar;
+  end;
+
+constructor TTest.Create;
+begin
+  inherited;
+  proc := nil;
+end;
+
+procedure TTest.foo;
+begin
+  writeln('foo');
+end;
+
+procedure TTest.bar;
+begin
+  if @proc <> nil then proc;
+end;
+
+var
+  t: TTest;
+
+begin
+  t := TTest.Create;
+  t.proc := t.foo;
+  t.bar;
+  t.Free;
+end.
+