From 350c88646076d1f1f38706522dd6fb3a92f0d159 Mon Sep 17 00:00:00 2001 From: florian Date: Tue, 22 Nov 2005 21:27:56 +0000 Subject: [PATCH] + support exit(); git-svn-id: trunk@1802 - --- .gitattributes | 1 + compiler/pexpr.pas | 35 ++++++++++++++++++++--------------- tests/webtbs/tw4537.pp | 12 ++++++++++++ 3 files changed, 33 insertions(+), 15 deletions(-) create mode 100644 tests/webtbs/tw4537.pp diff --git a/.gitattributes b/.gitattributes index 269f009973..8fd5c65087 100644 --- a/.gitattributes +++ b/.gitattributes @@ -6372,6 +6372,7 @@ tests/webtbs/tw4477.pp svneol=native#text/plain tests/webtbs/tw4487.pp -text svneol=unset#text/plain tests/webtbs/tw4489.pp -text svneol=unset#text/plain tests/webtbs/tw4496.pp svneol=native#text/plain +tests/webtbs/tw4537.pp svneol=native#text/plain tests/webtbs/ub1873.pp svneol=native#text/plain tests/webtbs/ub1883.pp svneol=native#text/plain tests/webtbs/uw0555.pp svneol=native#text/plain diff --git a/compiler/pexpr.pas b/compiler/pexpr.pas index 9311a0035b..a5575d9a7a 100644 --- a/compiler/pexpr.pas +++ b/compiler/pexpr.pas @@ -377,23 +377,28 @@ implementation begin if not (m_mac in aktmodeswitches) then begin - p1:=comp_expr(true); - consume(_RKLAMMER); - if (block_type=bt_except) then + if not(try_to_consume(_RKLAMMER)) then begin - Message(parser_e_exit_with_argument_not__possible); - { recovery } - p1.free; - p1:=nil; + p1:=comp_expr(true); + consume(_RKLAMMER); + if (block_type=bt_except) then + begin + Message(parser_e_exit_with_argument_not__possible); + { recovery } + p1.free; + p1:=nil; + end + else if (not assigned(current_procinfo) or + is_void(current_procinfo.procdef.rettype.def)) then + begin + Message(parser_e_void_function); + { recovery } + p1.free; + p1:=nil; + end; end - else if (not assigned(current_procinfo) or - is_void(current_procinfo.procdef.rettype.def)) then - begin - Message(parser_e_void_function); - { recovery } - p1.free; - p1:=nil; - end; + else + p1:=nil; end else begin diff --git a/tests/webtbs/tw4537.pp b/tests/webtbs/tw4537.pp new file mode 100644 index 0000000000..6159735ac5 --- /dev/null +++ b/tests/webtbs/tw4537.pp @@ -0,0 +1,12 @@ +procedure foo; + begin + exit(); + end; + +function bar: integer; + begin + exit(42); + end; + +begin +end.