From 8df1d1f9b8ca4339a5bd702f069922bbfc013958 Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Sat, 2 Jul 2016 21:09:59 +0000 Subject: [PATCH] * fixed compilation of tw15391 with range checking enabled after r34034: support maybe_call_procvar() on internal block nodes, which return their result via the last statement git-svn-id: trunk@34051 - --- .gitattributes | 1 + compiler/nutils.pas | 2 ++ tests/webtbs/tw15391a.pp | 41 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 tests/webtbs/tw15391a.pp diff --git a/.gitattributes b/.gitattributes index 86fb73a2cd..05511b8e14 100644 --- a/.gitattributes +++ b/.gitattributes @@ -14258,6 +14258,7 @@ tests/webtbs/tw15370.pp svneol=native#text/plain tests/webtbs/tw15377.pp svneol=native#text/pascal tests/webtbs/tw1539.pp svneol=native#text/plain tests/webtbs/tw15391.pp svneol=native#text/plain +tests/webtbs/tw15391a.pp svneol=native#text/plain tests/webtbs/tw15415.pp svneol=native#text/plain tests/webtbs/tw15446.pp svneol=native#text/plain tests/webtbs/tw15453a.pp svneol=native#text/plain diff --git a/compiler/nutils.pas b/compiler/nutils.pas index 66df7a833c..7e3d355537 100644 --- a/compiler/nutils.pas +++ b/compiler/nutils.pas @@ -414,6 +414,8 @@ implementation typeconvn, subscriptn : hp:=tunarynode(hp).left; + blockn: + hp:=laststatement(tblocknode(hp)).left else break; end; diff --git a/tests/webtbs/tw15391a.pp b/tests/webtbs/tw15391a.pp new file mode 100644 index 0000000000..8a94aea3b9 --- /dev/null +++ b/tests/webtbs/tw15391a.pp @@ -0,0 +1,41 @@ +{$ifdef fpc} +{$mode delphi} +{$endif} + +{$r+} + +type + FuncA = function : Integer of object; + ObjA = class + function Func1: Integer; + procedure Proc1(const Arr: Array of FuncA); + end; + +var A : ObjA; + +procedure test(fa: funca); +begin + if fa<>a.func1 then + halt(2); +end; + +function ObjA.Func1: Integer; +begin + Result := 1; +end; + +procedure ObjA.Proc1(const Arr: Array of FuncA); +begin + if (low(arr)<>0) or + (high(arr)<>1) or + assigned(arr[0]) or + (arr[1]<>a.func1) then + halt(1); +end; + +begin + A := ObjA.Create; + A.Proc1([nil,A.Func1]); + test(a.func1); + a.free; +end.